|
Posted by Vince Morgan on 12/14/06 03:47
"Dave Nash" <kabooby2004@yahoo.com> wrote in message
news:09d1o2du54l5fh9813evr2htr02udsrj8l@4ax.com...
> I have a login form setup. When a person logs in it verified the user
> name and password and logs them in if the information is correct.
> This script is called auth.php as in included in all of the pages I
> want to secure.
> My problem is how do I get info on that particular logged in user.
> example say Welcome $fullname when the only two fields ive currently
> go are u_name and p_word.
> See auth script below.
>
> And
>
> How to get info from another table?
>
> Example SELECT * FROM messages WHERE userid = $userid ORDER by
> messageid
>
> -------------------------------
> Auth.php
>
> session_start();
> if($_POST){
> $_SESSION['u_name']=$_POST["u_name"];
> $_SESSION['p_word']=$_POST["p_word"];
> }
> $result=mysql_query("select * from users
> where u_name='" . $_SESSION['u_name'] . "' and p_word='" .
> $_SESSION['p_word'] . "'");
> $num=mysql_num_rows($result);
> if($num < 1){
> echo "show login form";
> exit;
> }
> End auth.php
> -------------------------------
> Tables are as follows.
> Users table.
> userid
> u_name
> p_word
> fullname
> PRIMARY KEY (`userid`)
The above looks like one table named "Users", with five fields.
If so,
"SELECT fullname FROM Users WHERE userid = '".$userid.'"';
If not, I'm lost :)
Vince Morgan
[Back to original message]
|