wallport10
11-10-2006, 01:46 AM
<?
include 'sql.php';
$username=$_POST["username"];
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query, $link) or die("Query Failed!2");
$password=$_POST["password"];
if ($line = mysql_fetch_array($result, MYSQL_ASSOC) ==''){
echo "<html><head><title>Login: Devastation</title></head><center><font color='white'>User $username not found in database!";
}else{
mysql_free_result($result);
$result = mysql_query($query, $link) or die("Query Failed!3");
$row = mysql_fetch_assoc($result);
if ($password == $row["password"]){
$id=$row['id'];
mysql_query("delete from online where id='$id'", $link) or die("Yeah");
mysql_query("insert into online values ('$id', '$tm')", $link) or die("Query Failed!4");
setcookie('Dev', $id, time()+3600);
$herm = $_COOKIE["Dev"];
$type=$row['type'];
print "<iframe name='I1' width='100%' height='90%' src='main.php' align='center' border='0' frameborder='0'>
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>";
print "<center><p align='bottom'><font size='1' color='white'><a href='main.php?link=home' target='I1'>Home</a> - <a href='main.php?link=prefs' target='I1'>Preferences</a> - <a href='main.php?link=leave' target='I1'>Leave Form</a> -";if($type=='1'){print "<a href='main.php?link=admin' target='I1'>Admin</a> - ";}print " <a href='main.php?link=logout' target='I1'>Logout</a>";
}else{
Print "<center><font color='white'>Invalid Password, try again!<br>";
}}
mysql_free_result($result);
mysql_close($link);
Its not creating a Cookie from what I see... on my main.php page here is what I have set up...
<?
/*Reset Cookie to prevent loggout*/
$id=$_COOKIE["Dev"];
/* Chech to see if Logged Out */
if ($id == ""){
setcookie ("Dev", "", time()-3600);
print "<html><body><center><h2>YOU ARE LOGGED OUT1</h2></center></body></html>";
exit;
}else{
include 'sql.php';
$result = mysql_query("SELECT id FROM online where id=$id" , $link) or die("Query1 failed");
$row = mysql_fetch_assoc($result);
if ($row["id"]!=$id){
setcookie ("Dev", "", time()-3600);
print "<html><body><center><h2>YOU ARE LOGGED OUT2</h2></center></body></html>";
exit;
mysql_close($link);
}}
I spent about 5 hours last night trying to get this to work... advice would be appreciated!
-Nate
include 'sql.php';
$username=$_POST["username"];
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query, $link) or die("Query Failed!2");
$password=$_POST["password"];
if ($line = mysql_fetch_array($result, MYSQL_ASSOC) ==''){
echo "<html><head><title>Login: Devastation</title></head><center><font color='white'>User $username not found in database!";
}else{
mysql_free_result($result);
$result = mysql_query($query, $link) or die("Query Failed!3");
$row = mysql_fetch_assoc($result);
if ($password == $row["password"]){
$id=$row['id'];
mysql_query("delete from online where id='$id'", $link) or die("Yeah");
mysql_query("insert into online values ('$id', '$tm')", $link) or die("Query Failed!4");
setcookie('Dev', $id, time()+3600);
$herm = $_COOKIE["Dev"];
$type=$row['type'];
print "<iframe name='I1' width='100%' height='90%' src='main.php' align='center' border='0' frameborder='0'>
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>";
print "<center><p align='bottom'><font size='1' color='white'><a href='main.php?link=home' target='I1'>Home</a> - <a href='main.php?link=prefs' target='I1'>Preferences</a> - <a href='main.php?link=leave' target='I1'>Leave Form</a> -";if($type=='1'){print "<a href='main.php?link=admin' target='I1'>Admin</a> - ";}print " <a href='main.php?link=logout' target='I1'>Logout</a>";
}else{
Print "<center><font color='white'>Invalid Password, try again!<br>";
}}
mysql_free_result($result);
mysql_close($link);
Its not creating a Cookie from what I see... on my main.php page here is what I have set up...
<?
/*Reset Cookie to prevent loggout*/
$id=$_COOKIE["Dev"];
/* Chech to see if Logged Out */
if ($id == ""){
setcookie ("Dev", "", time()-3600);
print "<html><body><center><h2>YOU ARE LOGGED OUT1</h2></center></body></html>";
exit;
}else{
include 'sql.php';
$result = mysql_query("SELECT id FROM online where id=$id" , $link) or die("Query1 failed");
$row = mysql_fetch_assoc($result);
if ($row["id"]!=$id){
setcookie ("Dev", "", time()-3600);
print "<html><body><center><h2>YOU ARE LOGGED OUT2</h2></center></body></html>";
exit;
mysql_close($link);
}}
I spent about 5 hours last night trying to get this to work... advice would be appreciated!
-Nate