New Login Script
Posted on
16th Feb 2014 07:03 pm by
admin
Hi all, i attempted to create a whole new login script witch isnt working for some reason i dont know why. When i put the users details and then press submit, it just refreshes the page, even when i put the wrong details in it still does the same..
<?php
session_start();
include_once"config.php";
if (strip_tags($_GET['logout']) == "yes"){
session_destroy();
}elseif (isset($_SESSION['username'])){
header("Location: index2.php");
exit();
}
if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){
$username = addslashes(strip_tags($_POST['username']));
$password = addslashes(strip_tags($_POST['password']));
$ip = $REMOTE_ADDR;
///check INFO
$sql = mysql_query("SELECT * FROM allmembers WHERE username='$username' AND password='$password' LIMIT 1");
$login_check = mysql_num_rows($sql);
$inf = mysql_fetch_object($sql);
if ($login_check == "0"){
$message="You could not be logged in";
}elseif ($login_check != "0"){
if ($login_check > "0"){
if ($inf->status == "Dead"){
include_once"dead.php";
exit();
}
if ($inf->status == "Banned"){
$encoded=md5(strtolower($username));
header("Location: banned.php?banned=$username&encoded=$encoded");
exit();
}
session_register('username');
$_SESSION['username'] = $inf->username;
$timestamp = time()+60;
mysql_query("UPDATE allmembers SET online='$timestamp' WHERE username='$username'");
mysql_query("UPDATE allmembers SET l_ip='$ip' WHERE username='$username'");
header("Location: members.php");
} else {
$message= "You could not be logged in.<br />";
}}}
$total_regged=mysql_num_rows(mysql_query("SELECT * FROM allmembers"));
$admins=mysql_num_rows(mysql_query("SELECT * FROM allmembers WHERE userlevel='2'"));
$mods=mysql_num_rows(mysql_query("SELECT * FROM allmembers WHERE userlevel='1'"));
$iti=mysql_fetch_object(mysql_query("SELECT * FROM site_stats WHERE id='1'"));
$most=$iti->online;
?>
Thats all the php code for my login system.
Thanks for your help.
219
7
Other php-forum
Change Sort Order to Display Newest File First
Hi Guys,
I have a page that sorts the contents (PDFs) of a directory and displays them on the
button help
i originally had this but realised it is much easier to have a button.
Code: <?php
Values disappear from my array :( HELP!
hey all, I have a lil mysql/php/apache script that queries a database
and pulls put 5 integers.
Post PHP form to non-existing page
The company that I work for host their PHP code on IIS on a Windows server, no Apache, so no mod_rew
Multiple includes losing variables
Hey all,
just starting out w php and ran into a problem pretty quickly. I'm
including seve
Display Database
I need to create a shopping cart. I found this code online: http://conceptlogic.com/jcart/
Unfort
Needing Youtube thumb nail fix.
I have a script on a site that pulls in you-tube videos,
The problem is, that the thumb nails for
How to get variable value on next page
Hello friends
i am working on payentry page ..there i have this code.........
Create comparison matrix?
I want to create a comparison script for forum software and was wondering is there any tutorial or b
single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w