alex Posted August 19, 2007 Share Posted August 19, 2007 now since i found scroll code i need sign-up and login form for website and looking at member only areas any help? plus i need a "save me" or "log me in every time" thing. the ones i tried getting from google stink big time any help?and a e-mail validation code.... sorry but luckly this one is optional Link to comment Share on other sites More sharing options...
justsomeguy Posted August 20, 2007 Share Posted August 20, 2007 Here's a guide on email validation:http://www.zend.com/zend/spotlight/ev12apr.phpThere are a ton of login tutorials online, you'll probably be best off by reading those until you find one that suits you. With a password-protected website, you need a database to store the users and other content, and the pages to do the login and the password check on every protected page. If you want the website to remember the user then you need to set a cookie when they log in that you can use the next time they come back.Check the tutorials online, and there are several threads here that talk about it also.http://www.google.com/search?client=opera&...-8&oe=utf-8 Link to comment Share on other sites More sharing options...
redwall_hp Posted August 20, 2007 Share Posted August 20, 2007 Make sure you encrypt peoples' passwords! Use MD5 or Sha1.MD5 is real easy to do, just $encrypted_password = md5($plain_password);Sha1 is the same, just use the sha1() function instead. Sha1 is arguably more secure by the way. Link to comment Share on other sites More sharing options...
alex Posted August 21, 2007 Author Share Posted August 21, 2007 arg most make thier own.. but i know nothing about php Link to comment Share on other sites More sharing options...
Kristian_C Posted August 21, 2007 Share Posted August 21, 2007 Just study php on w3schools for a few days and you should be able to make a little login/registrer form ..if you want to just have a small password protected site for you'r friends or something like that you might do it real simple ..just : Register code<?include"yourdbconnect.php";if(isset($_POST['register'])){$username=$_POST['username'];$password=$_POST['password'];$email=$_POST['email'];$check=mysql_query("SELECT * FROM users WHERE username='$username'");$checkuser=mysql_num_rows($check);if($checkuser > "0"){die('Username is taken');}else{mysql_query("INSERT INTO users(id,username,password,email)VALUES('','$username','$password','$email')");echo"The user $username is now registrated you can now login";}}?>Login code<?include"yourdbconnect.php";if(isset($_POST['login'])){$username=$_POST['username'];$password=$_POST['password'];$checkpass=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));if($checkpass->password!=$password){die('The password was incorrect');}else{session_register('$username');header("Location: loggedin.php");}}then you must make a etc funcs.php file which you include""; on all the sites you want to be password protected..?>funcs.php <?session_start();$username=$_SESSION['username'];if(empty($_SESSION['username']){header("Location: sessionout.php");}?>You also need to make a mysql db where contents are :id int 50(etc) auto_inc(something) Primary keyusername varchar 15(depends on how long you want the max limmit of username to be)passoword varchar 15 (depends on how long you want the max limmit of password to be)email varchar 100 Well i think this code will work, havent tested it, becouse i dont have time to set it up right now .. But if it dont work, i think some of the other guys/gals here will help you to correct the code or i might be back later, but hope this helps you and good luck ...-Kristian_C Link to comment Share on other sites More sharing options...
Kristian_C Posted August 21, 2007 Share Posted August 21, 2007 Well tested some off it now, seems like something is wrong with header.. cant figure it out, will try to find the error as fast as possible. Link to comment Share on other sites More sharing options...
Anders Moen Posted August 21, 2007 Share Posted August 21, 2007 Make sure you encrypt peoples' passwords! Use MD5 or Sha1.MD5 is real easy to do, just $encrypted_password = md5($plain_password);Sha1 is the same, just use the sha1() function instead. Sha1 is arguably more secure by the way.Or both $encryptet_password = md5(sha1($plain_password)); Link to comment Share on other sites More sharing options...
Synook Posted August 22, 2007 Share Posted August 22, 2007 Lol! If you use MD5, you can "salt" it to make it harder to decrypt: $encrypted_password = md5($plain_password, "some_random_salt_string"); Link to comment Share on other sites More sharing options...
alex Posted September 3, 2007 Author Share Posted September 3, 2007 i tried code but dowsnt work.... lol downts even show up Link to comment Share on other sites More sharing options...
Synook Posted September 3, 2007 Share Posted September 3, 2007 Do you mean Kristian C's code? Did you create all the files that are included? Are there any error messages that show up or do you just get a blank page? Link to comment Share on other sites More sharing options...
user4fun Posted September 3, 2007 Share Posted September 3, 2007 OKAY,HERE IS AN IDEA,How about one of your great folks, make us a fully functional sign up form with explanations, and comments on how to add or remove a couple of fields. That way when this question comes back up again, all we have to do is send them to the url, heck i will even put it on my server. Link to comment Share on other sites More sharing options...
Kristian_C Posted September 5, 2007 Share Posted September 5, 2007 ehh, it aint supposed to show up .. just coded the php, the html you can do urself... but the code is abit wird anyway..but this should work, but remember to create the html... Added abit of information, feel free to pm me if you dont figure it out.. Register code<?session_start();include"yourdbconnect.php"; //The file where you connect to mysql databaseif(isset($_POST['register'])){ $username=$_POST['username'];$password=$_POST['password'];$email=$_POST['email'];$check=mysql_query("SELECT * FROM users WHERE username='$username'"); //to check if username is allready taken$checkuser=mysql_num_rows($check);if($checkuser > "0"){die('Username is taken');}else{ // if username is not taken :mysql_query("INSERT INTO users(id,username,password,email)VALUES('','$username','$password','$email')"); echo"The user $username is now registrated you can now login";}}?>Login code<?session_start();include"yourdbconnect.php"; //The file where you connect to mysql databaseif(isset($_POST['login'])){$username=$_POST['username'];$password=$_POST['password'];$checkpass=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'")); // Check if password is correctif($checkpass->password!=$password){die('The password was incorrect');}else{$_SESSION['username']=$username; //Register the usernameheader("Location: loggedin.php"); //Send the user to the password member area }}then you must make a etc funcs.php file which you include""; on all the sites you want to be password protected..?>funcs.php <?session_start();$username=$_SESSION['username']; //To get the usernameif(empty($_SESSION['username']){ //Check if session is emptyheader("Location: sessionout.php"); //Send user to your session timeout page, where you can have etc : You have been inactive for to long and you have been logged out.}?> And remember to add the things i told you to add to the MySQL db... To add and remove fields like etc add IP you do like : Just adding the register code since it's an example :<?session_start();include"yourdbconnect.php"; //The file where you connect to mysql databaseif(isset($_POST['register'])){ $username=$_POST['username'];$password=$_POST['password'];$email=$_POST['email'];$ip=$REMOTE_ADDR;$check=mysql_query("SELECT * FROM users WHERE username='$username'"); //to check if username is allready taken$checkuser=mysql_num_rows($check);if($checkuser > "0"){die('Username is taken');}else{ // if username is not taken :mysql_query("INSERT INTO users(id,username,password,email,ip)VALUES('','$username','$password','$email','$ip')"); echo"The user $username is now registrated you can now login";}}?> Link to comment Share on other sites More sharing options...
alex Posted September 11, 2007 Author Share Posted September 11, 2007 ok what i need to clearify about now is what do i do with html file.... and what "files" are you talking about... folders containing the people themselfs? or what Link to comment Share on other sites More sharing options...
Kristian_C Posted September 11, 2007 Share Posted September 11, 2007 If you cant code anything at all yourself you really should study PHP, MySQL and HTML first... Aint no point helping you if you cant do sh*it actually...-Kristian_C. Link to comment Share on other sites More sharing options...
alex Posted September 11, 2007 Author Share Posted September 11, 2007 If you cant code anything at all yourself you really should study PHP, MySQL and HTML first... Aint no point helping you if you cant do sh*it actually...-Kristian_C. big help u were Link to comment Share on other sites More sharing options...
Kristian_C Posted September 11, 2007 Share Posted September 11, 2007 It is a codeing forum for one of the best learning sites on the net, just check out this links and practice...http://w3schools.com/php/php_mysql_insert.asphttp://w3schools.com/php/php_mysql_select.asphttp://w3schools.com/php/php_post.asphttp://w3schools.com/php/php_mysql_update.asphttp://w3schools.com/html/html_forms.aspThere you should have what you need to start... After you have read abit and created a html code to run this script, then i can help you with errors and stuff... This aint a forum for people to get free scripts ready made but help to finish them and answers to their question...-Kristian_C. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.