Jump to content


Photo

User Creates Multiple Characters

binding user characters mysql

  • Please log in to reply
1 reply to this topic

#1 woj56k

woj56k

    Newbie

  • New Members
  • Pip
  • 4 posts

Posted 31 December 2012 - 10:29 AM

Hello, I'm not sure if this is in the right area but if it's not please feel free to move it.

I'm in the process of creating a game where a user from the users table will be allowed to create and select characters that are binded to that users profile. Allowing users to have up to two characters that can be selected to "Play As" after login in with the user account. My problem is since while I am not extremely new to php, this approach has me a bit stumped. How could I bind characters created by a userid to that userid?

Is it something simple that I missed and just am over thinking? For example sake, we'll use 'users' table and 'characters' table. Any help or suggestions?

Much appreciated!

#2 Muddy_Funster

Muddy_Funster

    Advanced Member

  • Members
  • PipPipPip
  • 2,993 posts

Posted 31 December 2012 - 10:33 AM

have a userid field in the characters table and use an INNER JOIN to link the tables together.
A simple password hash :

function makePass($word=''){
  $dbSalt = '$2a$07$'.substr(hash('whirlpool',$word),0,22);
  $dbPass = crypt($word, $dbSalt);
 return substr($dbPass,12);
}



My SQL/PHP Blog




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com