Lilith Posted January 14, 2011 Posted January 14, 2011 I have noticed something about mcc based games that differed greatly from the larger more popular games .... when you create an account, you are automatically logged in, or you have to verify your e-mail addy. Not redirected back to the login screen just to type in more information. In order to get players into a game faster without them loosing interest, Id like to see a register page that takes them right into the game, beginner tutorial or another place IN GAME already logged in... (there are mods for e-mail already.) Ive heard theres lots of ways to do it, but never actually seen one that worked.This could be a paid or a free mod. Budget: $20 USD Quote
Dayo Posted January 14, 2011 Posted January 14, 2011 Don't pay $25 for 1 line of code find the insert query and add after it. $_SESSION['userid']=mysql_insert_id(); echo 'Play! Quote
rulerofzu Posted January 14, 2011 Posted January 14, 2011 $_SESSION['userid']=$i; // $i is already used for the session id Quote
Dayo Posted January 14, 2011 Posted January 14, 2011 I'm sure it didnt, not sure haven't worked with mc2 for ages :P Quote
Lilith Posted January 14, 2011 Author Posted January 14, 2011 so umm, will that one line of code work? Quote
Djkanna Posted January 14, 2011 Posted January 14, 2011 Add a meta tag if need be to automatically send the user to index.php upon signup completion. Quote
Jordan Palmer Posted January 14, 2011 Posted January 14, 2011 Your budget is $19.99 to much.. As dayo said that should work fine so long as the session is assigned. Quote
Lilith Posted January 14, 2011 Author Posted January 14, 2011 lmao Jordan, you know me, if I've got no clue what it would cost, ill overpay just to make sure ill get it. So When DJK says meta tag, thats referring to the html meta tags right? And how would one send them via a meta tag (Ive read up on it, but it might as well be greek to me) ...so long as the session is assigned ... can you explain that one as well? granted Ive been up for far to long (the sun has come back up already) but I would like to learn why / how this works, not just copy the code and call it good. As most of you are aware, Im a much better artist than coder. Quote
rulerofzu Posted January 14, 2011 Posted January 14, 2011 DJK means a meta tag refresh to index.php so they register and auto redirected to the game. Personally I prefer header location header('Location: index.php'); Quote
Djkanna Posted January 14, 2011 Posted January 14, 2011 DJK means a meta tag refresh to index.php so they register and auto redirected to the game. Personally I prefer header location header('Location: index.php'); I prefer that to however in this case it really wouldn't work unless you had the success message ingame otherwise you'd need the meta tag. Quote
Jordan Palmer Posted January 14, 2011 Posted January 14, 2011 I would personally use the header tag aswell. Now the session assign means basically.. When a user logs in, It simply sets a session to 1 and assigns the usersID to another session, so basically as long as those are assigned right your auto login should work perfect. =) Quote
Paul Evans Posted January 14, 2011 Posted January 14, 2011 I think auto login would be a bad idea (using meta or header) simply add $_SESSION['userid'] = $i; echo 'You have successfully signed up, click [url="index.php"]here[/url] to login.'; Quote
Danny696 Posted January 14, 2011 Posted January 14, 2011 Paul, youve let me down..... i think you mean echo' I personally would do header/meta incase they dont read Quote
Dayo Posted January 14, 2011 Posted January 14, 2011 Agreed, plus look at your echo crimgame ;) Quote
Paul Evans Posted January 14, 2011 Posted January 14, 2011 lol oh i have PHP 60003 no need for a ending ' lol yeah oops im human i forgot the quote but still :P you know what i mean Quote
Lilith Posted January 15, 2011 Author Posted January 15, 2011 the more you tell me, the more confused I get .... header('Location: index.php'); whats that do? just send them to that file ... how and when? ill also look up meta refresh to see if it does that ... cus from what I understand of all this is that I set the session, if I have a meta refresh, after a set time, the page refreshes automatically and it sends the user to loggedin.php (or whatever file I put there) ... that about the gist of it? Quote
Paul Evans Posted January 15, 2011 Posted January 15, 2011 META works on a time yeah header location is instant so when they click register or whatever after filling out the form (obviously) it would direct them to whatever file. Personally i do that on CG lol Quote
Lilith Posted January 15, 2011 Author Posted January 15, 2011 I don't mean to be an ass Paul, but if you spoke in terms I could understand, I might consider your way of doing this. Otherwise, I don't even know what you are talking about, and that lends your "you should do it this way argument" no weight. Quote
Djkanna Posted January 15, 2011 Posted January 15, 2011 Okay take this as an example, $i is the variable assigned to the last id signed up to your game, for example 329. Setting the session of userid ($_SESSION['userid']) to have the value of $i ($_SESSION['userid'] = $i;) will give it 329 which now means that the user with the id of 329 is now logged into your game. Upon completion you have two options to get the desired results header('Location: index.php'); The upside is that this will redirect instantly, the downside is you cannot have any output before it for example a welcome message. The meta tag allows you to refresh after a set amount of time so for example you can have: Welcome to the game after a successful registration, then you can set the meta tag to refresh to index.php after say 2-3 seconds, giving them enough time to read the welcome message. Either way will work, just depends on how you'd like to do it. Quote
Lilith Posted January 16, 2011 Author Posted January 16, 2011 Thanks guys, Ive learned a lot through you and the places you lead me to in Google! Quote
sniko Posted January 16, 2011 Posted January 16, 2011 I did this for Fevi :) Pretty Simple to be honest :) Need any assistance - message me :) Quote
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.