bigfatme2000 0 Report post Posted December 22, 2005 Thanks! I was searching for such a script in hotscripts.com for a long time! Maybe you could even submit the script... 214798[/snapback] Yeah - thanks very very very much - This is well needed, and will go to great use on the next version of my website - thanks! Share this post Link to post Share on other sites
sammaye 0 Report post Posted December 22, 2005 hmm klind of strange to miss out conn.php its like a vital part of the login system. I am wondering whether this person actually coded it him self or stole it from some one else cos if he coded it him self he woluld not have left out conn.php. Just a thought thats all.Yeah good script for beginners could have doen without the errors cos I got conn.php errors too . good base for a login script thou, at least now I wont forget any of the code requiired... Share this post Link to post Share on other sites
sxyloverboy 0 Report post Posted December 23, 2005 someone this dosent work for me. has anybody actualy tried this thing out and gotten it to work? someone other than the guy who posted it? Share this post Link to post Share on other sites
bucksta 0 Report post Posted January 4, 2006 i know lots of php login systems. i tried this one. pretty decent... Share this post Link to post Share on other sites
Dooga 0 Report post Posted January 6, 2006 I think I know why it's missing conn.php and that it doesn't work. Perhaps a copied article? Even if it is wrapped in quotes, please avoid using other people's articles. Thanks Share this post Link to post Share on other sites
ernad 0 Report post Posted January 6, 2006 Huh i dont know... Do i need to insert some table in db ?? Where will be stored accounts i know i need to have user name for db, and to have database but i need to have in database and table for accounts to store it?? Share this post Link to post Share on other sites
sammaye 0 Report post Posted January 6, 2006 You see this is why programming newbs should not copy articles cos information is misleading...And by the looks of it this script requires only one talbe...the collums would benameageloginemailpasswordpassword2I would not be sure about the setting of these collums as I would need to test the script which I dunno if I really want to cos this script looks very...well...whatg more can I say if conn.php was missed outsorry to reply to my own post but I forgot to add:ernad this table will be put within a db which will store your users accounts...it is better if you just go to hotscripts.com and search for a login script cos im not too sure if this tutorial should have been accepted... Notice from jlhaslip: merged two posts Share this post Link to post Share on other sites
ernad 0 Report post Posted January 6, 2006 here is sql: CREATE TABLE `members` ( `name` varchar(60) character set utf8 default NULL, `email` varchar(255) character set utf8 NOT NULL, `age` varchar(3) character set utf8 default NULL, `login` varchar(50) character set utf8 NOT NULL, `password` varchar(40) character set utf8 NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; and i`m edited page:register:<?include("conn.php"); // create a file with all the database connectionsif($do_register){ // if the submit button were clickedif((!$name) || (!$email) || (!$age) || (!$login) || (!$password) || (!$password2)){print "You can't let any fields in blank.\n"; // if the user did not put some fieldexit;}$name = stripslashes($name);$email = stripslashes($email);$age = stripslashes($age);$login = stripslashes($login);$password = stripslashes($password);$password2 = stripslashes($password2);// this is for security reasonsif($password != $password2){ // if passwords didn't matchprint "The password and the confirmation are not the same!\n";exit;}$password = md5($password);mysql_query("INSERT INTO members (name,email,age,login,password) VALUES ('$name','$email',$age,'$login','$password')") or die (mysql_error());header("Location: login.php"); exit;} // close the first "if"?><form action="register.php" method="post">Name: <input type="text" name="name"><br>Email: <input type="text" name="email"><br>Age: <input type="text" name="age"><br>Login: <input type="text" name="login"><br>Password: <input type="password" name="password"><br>Password Again: <input type="password" name="password2"><br><input type="submit" name="do_register" value="Sumbit"></form>login.php:<?include("conn.php");if($do_login){$login = stripslashes($login); // VERY IMPORTANT FOR SECURITY OF YOUR DATABASE DON'T ERASE IT$passwd = stripslashes($passwd); // VERY IMPORTANT FOR SECURITY OF YOUR DATABASE DON'T ERASE IT$check = mysql_query("SELECT * FROM members WHERE login='$login' LIMIT 1;");$user = mysql_fetch_array($check);if($user[password] == md5($passwd)){ // if the writed password and the db password are the same...setcookie("login","$login",time()+360000);setcookie("pass","$passwd",time()+360000);// ...set the cookies...header("Location: userspage.php"); // ...and redirect to restrict page}else{print "Login or password incorrects!\n";exit;}}?><form action="login.php" method="post">Login: <input type="text" name="login"><br>Passwd: <input type="password" name="passwd"><input type="submit" name="do_login" value="Log-in!"></form>verify.php :<?include("conn.php"); // include page with the database connection$cookie = $HTTP_COOKIE_VARS; // to reduce the var's name )if($cookie[login] && $cookie[pass]){$login = $cookie[login];$pass = $cookie[pass];$usrquery = mysql_query("SELECT * FROM members WHERE nick='$login' AND password='$pass';") or die (mysql_error()); // search for the user$user = mysql_fetch_array($usrquery);if($user[level] != 'Admin') header("Location: notfound.htm"); // if the user is not an admin, redirect to an error page}?>Now will work Share this post Link to post Share on other sites
Albus Dumbledore 0 Report post Posted January 22, 2006 i can never get codes like these to work >_< it kinda sucks, it keeps teling me-$host = 'localhost'; $user = 'albus_chris'; $pass = 'dontuwish'; $db = 'albus_login'; mysql_connect($host,$user,$pass) or die ("Database is unavaiable. Please try again later."); mysql_select_db($db) or die ("Database is unavaiable. Please try again later.");at the top of evey page..ne clue whats going on? the conn.php file should look exactly like this right? $host = 'localhost';$user = 'albus_albus';$pass = 'PWHERE;$db = 'albus_login';mysql_connect($host,$user,$pass) or die ("Database is unavaiable. Please try again later.");mysql_select_db($db) or die ("Database is unavaiable. Please try again later."); or is it supposed to look different? i copied it from the origional post here and it didn't work..please help! maybe i have the code wrong, i hope that is the problem >_< Share this post Link to post Share on other sites
Dawiss 0 Report post Posted January 28, 2006 I edited this scripts after ernads post.. here is what problems now I have:admin.phpprofiles.phpverify.phpwhen open these page sit shows Unknown column 'nick' in 'where clause' and when user fills register form it is redirected to login page.. but when it trys to login it always says incorrecty login or password..what should I do? Share this post Link to post Share on other sites
final_fantasy 0 Report post Posted January 29, 2006 (edited) merci bouceup Notice from jlhaslip: Added some garlic, but this is still SPAM, and you have previously been warned about short, one line answers being unacceptable. Read the Xisto readme file and remind yourself what these Forums require for Content.Warn issued.Bonjour. Edited January 29, 2006 by jlhaslip (see edit history) Share this post Link to post Share on other sites
Jesse 0 Report post Posted August 24, 2006 How do you create the SQL database fields that are needed for this file? Share this post Link to post Share on other sites
masterio 0 Report post Posted August 25, 2006 (edited) I think it's better to use PHP SESSION than COOKIE. coz some user may disabled it. something like this: if ($do_login) {$query = mysql_query("SELECT * FROM members WHERE login='$login' AND password='$password');if (mysql_num_rows($query) > 0) { $_SESSION['logged'] = $login; // some code here} else { print 'Username or password did not match'; exit;}} So, in every members page we can use:if (!isset($_SESSION['logged']) { // if not logged in} else { // member page goes here} Just an advice! Edited August 25, 2006 by masterio (see edit history) Share this post Link to post Share on other sites
premracer 0 Report post Posted August 25, 2006 nice, if i understood mysql better i would try this out but my understanding of that is at like a 1st grade reading level. Share this post Link to post Share on other sites
blackhawk838 0 Report post Posted August 26, 2006 Hmm thanks But im not to sure how to work it im new to this stuff sorry if i have upset anyone could someone email me how to use it pleasedying_in_your_arms8@hotmail.comOr just reply thanks! Share this post Link to post Share on other sites