Ok I think I am a little confused as to if this is working or not:  I have
commented in the places where I am confused... if someone could please point
out why the variables "u_name & p_word" are not being registered that would
help me out a ton... thanks in advance,
--- Form to log user in ---
<form name="auth" method="post" action="auth_done.php">
  <input type="text" name="u_name"><br>
  <input type="password" name="p_word"><br>
  <input type="submit" name="login" value="login">
--- checks db to see if user exists ---
if ((!$u_name) || (!$p_word)) {
 header ("Location: index.php");
 $db_name = "bignicke";
 $table_name = "auth_users";
 $connection = @mysql_connect("localhost","user","password") or die("Could
not connect to Database, please try again later");
 $db = @mysql_select_db($db_name, $connection) or die("Could not select
Database, please try again later");
 $sql = "SELECT * from $table_name WHERE un = \"$u_name\" AND pw =
 $result = @mysql_query($sql,$connection) or die("Couldn't execute query");
 $num = mysql_numrows($result);
 if ($num !=0) {
 $msg = "<p class=\"content\">You have been authorized to make changes to
the web site.</p>";
 #session_register(u_name);  //cant tell if this has been registered with a
print statement
 #session_register(p_word);  //can't tell if this is either
 $_session['u_name'] = $u_name; //this must be wrong too
 $_session['p_word'] = $p_word; //still wont register session variables
 } else {
 header ('Location: index.php');
<body bgcolor="#FFFFFF" text="#000000">
echo $msg;
print (SESSION_ID());  // the session is working right here
print ($_SESSION['u_name']); // this will not print the registered variable
print ($_SESSION['p_word']);  // this is not printing the registered
variable either
print ($u_name);  // this works
print ($p_word);  // this works
print (session_is_registered('u_name'));  // this won't work
print (session_is_registered('p_word'));   // this isnt working either
<a href="edit.php">edit more pages</a>
--- page to see if variables are being passed to edit page ---
$_session['u_name'] = $u_name; //should be registering username
$_session['p_word'] = $p_word; //should be registering password
<body bgcolor="#FFFFFF" text="#000000">
print ($_SESSION['u_name']); //does not print the variables
print ($_SESSION['p_word']); //this doesn't either
print (session_is_registered('u_name')); //this says variables are set
print (session_is_registered('p_word')); //this also says variables are set

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to