I have a login.html
in which the form
is defined as follows:
<form method="post" action= "do_authorize.php" name="lform">
<span class="style1">First Initial Plus Last Name :</span>
<input type="text" name="user" size="25">
<input type="submit" value="login">
</form>
My do_authorize
is as follows:
<?
session_start();
require('../databaseConnectionFileFolder/dbconnection.php');
$user = $_POST["user"];
var_dump($user);
$_SESSION['username']=$user;
var_dump($user);
$sql="SELECT * FROM $table_name_users WHERE username = \"$user\"";
var_dump($sql);
$result=@mysql_query($sql,$connection) or die("couldn't execute query");
$num=mysql_numrows($result);
if ($num != 0) {
/*$cookie_name="$user";
$cookie_value="ok";
$cookie_expire=time()+86400;
$cookie_domain=".columbia.edu";
setcookie($cookie_name, $cookie_value, $cookie_expire, "/", $cookie_domain, 0);
*/
print "<script>";
print "self.location='somethingelse.php';";
print "</script>";
} else {
echo "<p>you're not authorized";
}
?>
I have included var_dump($user);
and var_dump($sql);
at appropriate places and it doesn't seem to print the user value and sql. All it prints every time on the browser is the following:
"; print "self.location='somethingelse.php';"; print ""; } else { echo "
you're not authorized"; } ?>
I was referring to this post and I did the sanity check as mentioned in the following comment by Dan Nissenbaum
and it works for me:
For sanity checking, does the same problem occur in an independent .php file in the same webroot - something simple like <?php $x = array(1,2,3); var_dump($x); ?>?