In addition to what Kevin said:
$_SESSION and $_session are not the same variables.
Use quotes in your session_register(), too: session_register("u_name"),
although you don't need session_register() at all, if you are using
$_SESSION['u_name'] = "value"; syntax.
---John Holmes...
> > 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,
> > Jas
> > --- 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">
> > </form>
> > --- checks db to see if user exists ---
> > <?php
> > if ((!$u_name) || (!$p_word)) {
> > header ("Location: index.php");
> > exit;
> > }
> > $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 =
> > password(\"$p_word\")";
> > $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_start();
> > #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');
> > exit;
> > }
> > ?>
> > <body bgcolor="#FFFFFF" text="#000000">
> > <?php
> > 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
> > ?>
> > <br>
> > <a href="edit.php">edit more pages</a>
> > </body>
> > --- page to see if variables are being passed to edit page ---
> > <?php
> > session_start();
> > $_session['u_name'] = $u_name; //should be registering username
> > $_session['p_word'] = $p_word; //should be registering password
> > ?>
> > <body bgcolor="#FFFFFF" text="#000000">
> > success?
> > <?php
> > 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
> > ?>
> > </body>
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php