Keeping a user logged in

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
Lordcyris
Posts: 2
Joined: Sun Oct 04, 2009 4:57 am

Keeping a user logged in

Post by Lordcyris »

hello! i must say i find your tutorials very useful and what helped me out a lot was to read a php book before hand. Much like any language you need to practice before you can get the hang of it so thank you for your videos.

now to my request
I'm having a difficult time keeping my user logged in
i would like to change the player1 part in the code to reflect the user who is logged in in your attack.php code

Code: Select all

    $playerinfo="SELECT * from players where name='player1'";
    $playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
    $playerinfo3=mysql_fetch_array($playerinfo2);
once again thanks for time and efforts they are much appreciated
Lordcyris
Posts: 2
Joined: Sun Oct 04, 2009 4:57 am

Re: Keeping a user logged in

Post by Lordcyris »

sorry for double posting but i figured it out!!

Code: Select all

session_start();
$user = $_SESSION['name'];
include 'connect.php';
	



   $playerinfo="SELECT id,name,resource1,resource2,resource3 from players where name='$user'";
    $playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
    $playerinfo3=mysql_fetch_array($playerinfo2);
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: Keeping a user logged in

Post by Falken »

Great!

Move this thread to help/support mayby? :)
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Keeping a user logged in

Post by hallsofvallhalla »

will do, glad you figured it out, nice work
Post Reply

Return to “Advanced Help and Support”