|
|
|
|
![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 440 Joined: 22-March 05 Member No.: 4,795 |
Post
#21
Apr 3 2005, 08:22 AM
Hey guys I found a tutorial that fixed my problem...thanks to all that tried to help...I believe the tutorial link I found is under the hosted members area, it is a really easy step by step guide that include improvements to the original php codes, thanks again everyone.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 156 Joined: 14-March 05 From: Washington, USA Member No.: 4,520 |
Post
#22
Apr 6 2005, 07:08 PM
I like that alot! I'm trying to lurn php and mySql, and that help. Two thumbs up!
|
![]() Group: Members
Posts: 1 Joined: 6-March 07 Member No.: 39,605 |
Post
#23
Mar 6 2007, 01:24 AM
Whenever I try this, it always says "ERROR:Not added to the database." [codebox]<?php // dbConfig.php is a file that contains your // database connection information. This // tutorial assumes a connection is made from // this existing file. include ("dbconfig.php"); //Input vaildation and the dbase code if ( $_GET["op"] == "reg" ) { $bInputFlag = false; foreach ( $_POST as $field ) { if ($field == "") { $bInputFlag = false; } else { $bInputFlag = true; } } // If we had problems with the input, exit with error if ($bInputFlag == false) { die( "Problem with your registration info. " ."Please go back and try again."); } // Fields are clear, add user to database // Setup query $q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) " ."VALUES ('".$_POST["username"]."', " ."PASSWORD('".$_POST["password"]."'), " ."'".$_POST["email"]."')"; // Run query $r = mysql_query($q); // Make sure query inserted user successfully if ( !mysql_insert_id() ) { die("Error: User not added to database."); } else { // Redirect to thank you page. Header("Location: register.php?op=thanks"); } } // end if //The thank you page elseif ( $_GET["op"] == "thanks" ) { echo "<h2>Thanks for registering!</h2>"; } //The web form for input ability else { echo "<form action=\"?op=reg\" method=\"POST\">\n"; echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n"; echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n"; echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n"; echo "<input type=\"submit\">\n"; echo "</form>\n"; } // EOF ?>[/codebox] |
![]() Group: Validating
Posts: 1 Joined: 21-March 07 Member No.: 40,440 |
|
![]() Group: Members
Posts: 5 Joined: 21-March 07 Member No.: 40,446 |
Post
#25
Mar 21 2007, 07:50 PM
Here is the MD5 alternative: CODE <?PHP $user_name = $_POST['u_name']; $password = $_POST['pass']; //db connection string $db = mysql_connect("localhost","root","pass"); mysql_select_db("my_database",$db); //replace the above values with your actual database val //We will now retrive the password from the database $sql_query = mysql_query("SELECT password FROM user_data WHERE user_name='$user_name'",$db); $rs = mysql_fetch_row($sql_query); //comparing passwords Note before we can compare the password we use md5() to encrypt the $password becuase the password that we retrive from the database is in the encrypted form. if(md5($password) != $rs[0]) echo "ERROR: Invalid User"; else echo "Congrats, Password is correct!"; ?> ( I pulled this off www.phpbuddy.com ) Although this shows you how fast and easy it is to use MD5 and personally I prefer it over PEAR |
![]() Group: Members
Posts: 4 Joined: 21-March 07 Member No.: 40,461 |
|
![]() Group: Members
Posts: 1 Joined: 2-April 07 Member No.: 40,967 |
|
![]() Group: Members
Posts: 1 Joined: 1-July 07 Member No.: 45,809 |
Post
#28
Jul 1 2007, 05:43 PM
Everything except the login worked for me here. It says "Sorry, could not log you in. Wrong login information." when I try to login, even when I KNOW I'm using the right username/password combo. Any help?
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 127 Joined: 30-June 07 Member No.: 45,710 |
Post
#29
Jul 5 2007, 03:19 AM
Thank you, man. Good tutorial. However, on my site I just use my PHPBB Forum's login as the membership / login system. This still may come in handy if I ever drop that forum, though.
|
![]() Group: Members
Posts: 1 Joined: 5-July 07 Member No.: 46,020 |
Post
#30
Jul 5 2007, 11:11 PM
That's about it!. I used many simple examples hoping that you will learn how the internal systems work so you can expand on them and design a system that's just right for your needs. Have fun! hey dude i have a question. I followed your tutorial. See when i add the code it is previewed before you go back to the the contraol center(using freehostingnow.com). When it previews in shows it all but when i go to http://www.sro-gaming.freehostingnow.com/register/login.php the pages are blank. if you know what's weong email me at sro-gaming@hotmail.com Subject: login trouble thnx [note=jlhaslip]No need to quote the whole Original Posting into your reply[/note] |
![]() ![]() |
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
0 | Albus Dumbledore | 1,133 | 18th June 2006 - 08:28 AM Last post by: Albus Dumbledore |
|||
![]() |
9 | noxit | 871 | 30th July 2004 - 02:57 PM Last post by: templest |
|||
![]() |
32 | ultrasmad | 3,931 | 14th February 2005 - 11:01 AM Last post by: Someone |
|||
![]() |
16 | ultrasmad | 3,094 | 21st May 2005 - 10:04 AM Last post by: alexia |
|||
![]() |
3 | ultrasmad | 781 | 30th July 2004 - 03:27 PM Last post by: templest |
|||
![]() |
12 | BooZker | 936 | 8th July 2006 - 07:50 AM Last post by: BooZker |
|||
![]() |
34 | Bash | 9,070 | 23rd February 2007 - 05:13 AM Last post by: btdesign |
|||
![]() |
2 | zachtk8702 | 497 | 13th August 2004 - 04:26 PM Last post by: zachtk8702 |
|||
![]() |
2 | threepach | 692 | 19th February 2008 - 08:30 PM Last post by: threepach |
|||
![]() |
0 | etycto | 300 | 2nd September 2007 - 09:43 PM Last post by: etycto |
|||
|
Lo-Fi Version | Time is now: 4th December 2008 - 01:48 AM |