Login system and user profile
Posted: Fri Oct 14, 2011 11:03 am
Hi guys,
I'm trying to let my login script work with the amazing user profile script made by Jacek.
I'm trying to call the $user_info = fetch_user_info($_GET['uid']); in my login.php to grab data about the user from the init.inc.php. BUT, it says: Notice: Undefined index: uid in D:\Program Files\xampp\htdocs\SCRAPLL\profile.php on line 5.
My login.php:
Where in this script should I add the line to grab the uid data? If I put
Thank in advance!
Regards,
Peter
I'm trying to let my login script work with the amazing user profile script made by Jacek.
I'm trying to call the $user_info = fetch_user_info($_GET['uid']); in my login.php to grab data about the user from the init.inc.php. BUT, it says: Notice: Undefined index: uid in D:\Program Files\xampp\htdocs\SCRAPLL\profile.php on line 5.
My login.php:
<?php session_start (); $username = $_POST["username"]; $password = $_POST["password"]; if ($username&&$password) { $connect = mysql_connect ("localhost","root","erohak") or die ("couldn't connect"); mysql_select_db ("phplogin") or die ("Couldn't find db"); $query = mysql_query ("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows ($query); if ($numrows !=0) { while ($row = mysql_fetch_assoc ($query)) { $dbusername = $row ['username']; $dbpassword = $row ['password']; } //check to see if they match if ($username==$dbusername&&$password==$dbpassword) { header('Refresh: 0; url=profile.php'); $_SESSION['username']=$username; } else header('Refresh: 0; url=login_wrong.php'); } else header('Refresh: 0; url=login_wrong.php'); } else die ("Wrong username/password"); ?>How can I make this script work with the user profile system. When I login, it goes to localhost/scrapll/profile.php, but the rest, so ?uid=... doesn't appear, so I can't login to the right account, or actually the right ID.
Where in this script should I add the line to grab the uid data? If I put
include('core/init.inc.php'); $user_info = fetch_user_info($_GET['uid']);after session_start() it gives the error I've added in this topic.
Thank in advance!
Regards,
Peter