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.
Whenever I try this, it always says "ERROR:Not added to the database."
CODE
<?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>"; }
//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
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?
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.
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! [/quote] 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
Notice from jlhaslip:
No need to quote the whole Original Posting into your reply
Hello. This is my first web tutorial ever. This is basically a simple register and login script.
Yes, I know it’s a bit rubbish but I’m quite new to PHP/MySQL. Here’s the register form. This can
be any file extension you like. I’d recommend calling it register.html . CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
xmlns="http://www.w3.org/1999/xhtml"> <head> <meta
http-equiv="Content-Type" content="text/ht....
Ever wanted to just turn on our computer and when you get back it's already on the desktop?
(Rather then having to login at the welcome screen) Now some computer have this feature by default,
but what if it gets broken, try this. On an Administrator account goto start >> Run, and type
"control userpasswords2" (without the quotes) Uncheck the box that "Users must enter a Username and
Password to use this computer", then press Ok. You will be prompted to enter a default user and
their pasword, then next time you restart the computer it will automaticaly login to that....
First of all, I am NOT a programmer, this is something my friend taught me. It describes basic
interaction with the user, while showing basic functionality of this simple programm. So, without
further ado, we're off to the tutorial: First of all, start your visual basic, when prompted
for new project, select Standard Exe . Next, we need to open code window, so we can start typing
the program. This can be done in two ways, one is double clicking on the form, or selecting Code
from View menu. If you double clicked on the form, you will see following text: CODE ....
I have included my coded file with this... Ok here is the code. CODE // //Create login area,
replace the phpBB2 in /phpBB2/login.php with your forum's //directory // <form
action="/phpBB2/login.php" method="post" target="_top"> <table
width="25%" cellspacing="2" cellpadding="2" border="0"
align="center"> <tr> <td align="left"
class="nav"><a href="/phpBB2/index.php" class="nav">Prank Place
Forum Index</a></td>....
kLogin 0.1 QUOTE(readme.txt) Readme file to kLogin 0.1 To use the internet explorer fix:
download the latest IE7 ZIP file
(http://sourceforge.net/project/showfiles.php?group_id=109983&package_id=119707) Extract the ie7
zip file to the root directory of your web server. Example, if you are using a unix/linux server,
it's on "public_html/" or "home/public_html" Open kLogin.php file with your editor and edit the
$info_text or $info_txt variable. Then, extract the kLogin.php file in to the root
directory of your web server also. Just run kShoutBo....
Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
are tryn to learn PHP. First, let's make register.php: CODE <?
include("conn.php"); // create a file with all the database connections
if($do_register){ // if the submit button were clicked if((!$name)
|| (!$email) || (!$age) || (!$login) ||
(!$password) || (!$password2)){ print "You can't let
any fields in blank....
Looking for php, simple, login, learn, make, simple, login
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for php, simple, login, learn, make, simple, login
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.