How to create a Member System. Our member system will include user login, registration, email activation, and even a forgot password pages. This video is the …
Original source
How to create a Member System. Our member system will include user login, registration, email activation, and even a forgot password pages. This video is the …
Original source
35 responses to “PHP Tutorial: Make a Member System // User Login (2/3)”
getting an error
uncaught error: call to undefined function mysql_select_db()
can any one help me out.
based on login.php alone. when i put any password it kept me as logged in, any body has the issue? how to solve it? thanks
Plz share the next video of registration page…n how the info will save to database through the sign up page….
my member page don't work.
Thank you, great video!
HELP. I've written as he said/showed. When I run it in safari if shows the if/then statements. Why is this?
your website sucks crusty balls.
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in
putting username='$user' looks vulnerable and SQL injectable.
why does it say the password is invalid when i write the correct password?
thanks
In the member.php page it said that I had to login when I had. HELP!
Do you have all these files availible? Couldn't find anything on the pages you linked to…
great videos….but i cant seem to get the " echo "Welcome <b>$username</b>, <a href='./logout.php>Logout</a>"; in my browser…. can you help? its just saying the latter "else"
Thanks!
SOMEONE PLEASE HELP!!!
I get an error of "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a9708073/public_html/index.php on line 30"
My code so far is:
<?php
error_reporting (E_ALL ^ E_NOTICE);
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Login</title>
</head>
<body>
<?php
$form="<form action="index.php" method="post">
Username:<br>
<input type="text" name="user" required="required"><br>
Password:<br>
<input type="password" name="pass" required="required"><br>
<input type="submit" name="sub" value="Login!"><br>
</form>";
if($_POST["sub"]){
$user = $_POST["user"];
$pass = $_POST["pass"];
require("connect.php");
$password = md5(md5("76200".$pass."KbM"));
$query = mysql_query("SELECT * FROM users WHERE username='$user'");
$numrows = mysql_num_rows($query);
if($numrows == 1){
$row = mysql_fetch_assoc($query);
$dbuser = $row['username'];
$dbid = $row['id'];
$dbpass = $row['password'];
$dbactv = $row['active'];
if($password == $dbpass){
if($dbactv == 1){
$_SESSION['CurUser'] = $dbuser;
$_SESSION['CurId'] = $dbid;
echo "You have logged in as <b>".$_SESSION['CurUser']."</b>";
}else{
echo "This account needs to be activated. $form";
}
}else{
echo "Your username or password is incorrect. $form";
}
}else{
}
mysql_close;
}else{
echo $form;
}
?>
</body>
</html>
mysqli_query() keeps returning NULL for me. Even when I flat out tell it what the username is in the query. I was doing it this way because I am only checking the username and password. It returns NULL (checked with an if($query==NULL), which worked).
When checking the username and password with $query, why not just say:
// check if the entered username is in the database
if ($user == $query){
$querpass = mysql_query ("SELECT * FROM users WHERE password = '$password'"
// check if the entered password is in the database
if ($password == $querpass){
}
}
Work ! not be one that works and the other does not..
The problem is our faults..I have a lot of them but i solving them…if you start it says where the error. Sry for bad English
Help, I keep getting this message.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:AppServwwwHostinglogin.php on line 38
I dont understand server name. Plzz help
best php login iv e seen so far 😀 great work !
Hello everyone my member.php displays "Please login to access this page.Login Here" This are my code:
<?php
if ($username && $userid){
echo "Welcome <b>$username</b>, <a href='./logout.php'>Logout</a>";
}
else
echo "Please login to access this page.<a href='./login.php'>Login Here</a>";
?>
before the Doctype tag
<?php
error_reporting (E_ALL ^ E_NOTICE);
session_start();
$userid = $_SESSION['userid'];
$username = $_SESSION['username'];
?>
please can anyone help diagnose this code with the original? thanks
I was watching this video and it crashed, won't load and i need to see this instruction to continue, dang
Parse error: syntax error, unexpected '"qwertyui"' (T_CONSTANT_ENCAPSED_STRING) in D:xampp-portablehtdocsUserLoginSystemlogin.php on line 40
I got this error help me plzzz
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in N:ftpcompcd10cnProjectlogin1.php on line 51
The username you entered was not found.
I AM GEETTING THIS ERROR SOMEONE PLEASE HELP ME ASAP
I have the same problem…
My login page doesnt seem to check the database for username or password, if i type in a username and password it just says username wasnt found but the details entered are exact same as on database How can i sort out this problem?
I'm working on a server but i a have an error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a9040816/public_html/admin/index.php on line 14
Line 14 is: $numrows = mysql_num_rows($query);
and the query is line is: $query = mysql_query("SELECT * FROM admins WHERE username='$user'");
My table is admins!
Thanks 🙂
Thanks for posting
what is the doctype line of code he's using?
hi, good tutorial, but i have problem in member page each time i go to it it says "Please login to access this page Login here" please help. thank you
If you change this two lines
From …
if($password ==$dbpass){
if($dbactive == 1){
To….
if($password !=$dbpass){
if($dbactive == 0){
All your password/username problems will be solved..
For people having problems with the password thing, what I did is I took out the double encryption md5 to make a single encryption, then regenerated my hashed password using a random website to re-generate it, copy pasted it again in my database, and it worked. I think I missed a step when I output my hashed password through the browser. Hope this helps somebody…
Also, I was told not to use the md5 encryption and use sha256 instead.
answered my own question
Question: Where does the mysql_close(); statement go? I have it after the else of the i($password){ . I'm getting some weird errors and I wanted to make sure they are not being caused by that statement closing the connection to the database too early or too late.
Hey Guys,
Those who are getting the problem at "Incorrect Password thing", Instead of using
row['username'] ….Try row['1']..(Or the order in which you have defined Username in you PHPMYADMIN),Because row variable will be an associative array.