PDA

View Full Version : internet explorer wont let me login to my site


silverglade
11-06-2009, 01:35 AM
hi, my login page works great in firefox, but in ie6 i have to accept all cookies, for it to let me in or i get the hack=Y message which i put as "naughty naughty".. the SESSION is not getting set, and so its not logging me in. i just dont know why it works in firefox and not internet explorer, i cant ask every user to change their cookie settings just to log into my page. any help greatly appreciated. thanks. derek

here is the login page code

<?php
include("connect1.php");

session_start();

//session start was here
$u = $_POST['username'];
$p = $_POST['password'];
$logoff = $_GET['logoff'];
$hack = $_GET['hack'];






if($logoff){


unset($_SESSION['userid']);



$message = "You have been logged off";




}


if($hack){

$message = "Naughty Naughty! "; // COOL

}


// escape username and password for use in SQL//person said on board "looks fine" like this
//to prevent sql injections
$u = mysql_real_escape_string($u);
$p = mysql_real_escape_string($p);


// if fields username and password have contents, then...
if(isset($u) && isset($p) && !empty($u) && !empty($p)){ ///changed from if ($u && $p)

$query = mysql_query("SELECT * FROM table2 WHERE username = '$u' AND password = '$p'");

$result = mysql_fetch_array($query);


if($result['username']){ // if username is set, go on...username is a key for $result, and a field in the table.

$message = "You have been logged in";


$_SESSION['userid'] = $result['username'];

header("Location:old.mainsite.php"); // this will redirect them to the application.php page. and exit the script here.
exit;


}else{

$message = "You do not exist on the system";

}



}
?>
<?php
//IP BANNING CODE START HERE
$s=$_SERVER["REMOTE_ADDR"];
//draws IP address of visitor
$ipbancheck="SELECT * from banip where IP='$s'";
$ipbancheck2=mysql_query($ipbancheck);
while($ipbancheck3=mysql_fetch_array($ipbancheck2) )
{
$IPBANNED=$ipbancheck3[IP];
}
//above lines check to see if user Ip is in banned IPs
if ($IPBANNED)
{
header('Location: http://derekvanderven.com/hacker.html');
//print "You have been banned ";

}
else
{

}
?>

here is the "bouncer": code to get them off if not authorized

<?php

session_start();// this is a session start declaration call. to let us know we are using sessions on this page.
// when you create a session you create an actual file on server that it writes to.
/*echo '<pre>';
print_r($_SESSION);
echo '</pre>';
exit;*/// TO TEST OUTPUT DEBUGGING WHY IT WOULDNT LET ME LOG IN
echo "session test:".$_SESSION['userid'];

if(!isset($_SESSION["userid"])){ // why would they be on this page if session is not set!!!! this code is a bouncer..a cop.

header("Location:index.php?hack=y"); // if it hasnt been set and they are on this page, hack=y and redirect them back with the naught naughty message.


exit;
}

?>

and here is the form code on the login page

<form id="form1" name="form1" method="post" action="">
<p>&nbsp;</p>
<table width="200" border="1" align="center">
<tr>
<td><span class="style2">Login to the secret pages</span></td>
</tr>
<tr>
<td><label for="username"> User name </label>
<input type="text" name="username" id="username" /></td>
</tr>
<tr>
<td><label for="password"> Password </label>
<input type="password" name="password" id="password" /></td>
</tr>
<tr>
<td height="44"><input type="submit" name="submit" id="submit" value="Submit" /></td>
</tr>
</table>
</form>

edbr
11-06-2009, 07:18 AM
security is the choice of the visitor maybe put a cookies need to be enabled notice