Jump to content


Photo

registering users


  • Please log in to reply
7 replies to this topic

#1 asdfghjkl

asdfghjkl
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 02 June 2006 - 08:02 PM

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\" /]


#2 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 03 June 2006 - 04:41 AM

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--]

#3 asdfghjkl

asdfghjkl
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 03 June 2006 - 09:10 AM

yeah , but "how to" do it ?

#4 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 03 June 2006 - 07:19 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#5 asdfghjkl

asdfghjkl
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 03 June 2006 - 09:17 PM

"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
?


#6 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 03 June 2006 - 09:29 PM

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
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#7 asdfghjkl

asdfghjkl
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 03 June 2006 - 09:57 PM

i've just tryed that and nothing happened , i don't know why i receive only a blank page . are the slashes
allways neccesary ?

#8 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 03 June 2006 - 10:48 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users