happyhippy Posted March 22, 2012 Share Posted March 22, 2012 This is what I have all it does is come up with blank page I've been working on this for 8 hours with no change looked everywhere no idea what to do. <?php // Connects to your Database mysql_connect("localhost", "name", "password") or die('Error: '.mysql_error()); mysql_select_db("database") or die(mysql_error()); if(isset($_COOKIE['ID_my_site'])) { //$username of login user $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //fname is the first name of login user Print "<b>Name:</b> ".$info['fname'] . " "; }} ?> my database is all on one table id | username | password | fname | lname 1 | unsernam1 | **** | John | Doe 2 | unsernam2 | **** | Amy | Jane 3 | unsernam3 | **** | Doug | Smith I want it so that when the new page upons it finds the username (Like usernam2) in database and prints out the users first name etc in. Help? Quote Link to comment https://forums.phpfreaks.com/topic/259520-this-is-retarded/ Share on other sites More sharing options...
jcbones Posted March 22, 2012 Share Posted March 22, 2012 If this outputs anything, copy/paste the output here. <?php error_reporting(-1); ini_set('display_errors',1); // Connects to your Database mysql_connect("localhost", "name", "password") or die('Error: '.mysql_error()); mysql_select_db("database") or die(mysql_error()); if(isset($_COOKIE['ID_my_site'])) { //$username of login user $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //fname is the first name of login user Print "<b>Name:</b> ".$info['fname'] . " "; }} ?> Quote Link to comment https://forums.phpfreaks.com/topic/259520-this-is-retarded/#findComment-1330325 Share on other sites More sharing options...
smerny Posted March 22, 2012 Share Posted March 22, 2012 try using more descriptive subjects in the future... Quote Link to comment https://forums.phpfreaks.com/topic/259520-this-is-retarded/#findComment-1330326 Share on other sites More sharing options...
happyhippy Posted March 22, 2012 Author Share Posted March 22, 2012 Solved What an idiot I never realized my cookie had expired. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/259520-this-is-retarded/#findComment-1330331 Share on other sites More sharing options...
Adam Posted March 22, 2012 Share Posted March 22, 2012 Hmm.. Is your login detection just checking if a cookie is set? What's to stop me setting a "ID_my_site" cookie to your username? Quote Link to comment https://forums.phpfreaks.com/topic/259520-this-is-retarded/#findComment-1330339 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.