Jump to content

Archived

This topic is now archived and is closed to further replies.

asdfghjkl

registering users

Recommended Posts

hello there , i am a novice programer . I want to make a web page wich is subscribing the users after they've registered them selfs in mysql . ! If noone is understanding the one above then i want to tell to
mysql to remember who was registered by signing him automatically in database table like "users" . But i don't know how to do it . Please tell me "how to" do it . [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Share this post


Link to post
Share on other sites
You will need to write a Cookie to the user's browser to hold thier information. And then the next time they come to your site, check for the correct information, and log them in.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

Share this post


Link to post
Share on other sites
To log them in make a form that asks for username and password then take the posted data and make a query string something like this:

"SELECT * FROM users_table WHERE username=$username AND password=ENCRYPT($password)"

then if you have a database connection already you can just @mysql_query($query) and take the return value and, after breaking it apart into something useful, set it to a cookie.

Share this post


Link to post
Share on other sites
"To log them in make a form that asks for username and password then take the posted data and make a query string something like this:"
this is with the "select" wich i know already , what about insert into table values can you tell me about that
?

Share this post


Link to post
Share on other sites
Well I think it'd help if you elaborated on what exactly you wanted, but to insert user data freshly gathered from a form I would do the following:

1. Check that you have what you want (ie it's set and preg matched)
2. Strip slash it
3. create a query string like: INSERT INTO table_name (row1, row2, row3) VALUES ('val1', 'val2', 'val3');
4. run query and then you're finished

hope that helps

Share this post


Link to post
Share on other sites
i've just tryed that and nothing happened , i don't know why i receive only a blank page . are the slashes
allways neccesary ?

Share this post


Link to post
Share on other sites
Stripping slashes is important because it will protect you from SQL injection. Inserting data to the database shouldn't print anything on screen unless you tell it to, can you use phpMyAdmin or something like that to check and see if the data was entered? If it wasn't then you'll have to give us some more information in order to get further help.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.