Follow me on Twitter @ http://twitter.com/tktutorials Check out my website @ http://www.timkipptutorials.com This is part one of this tutorial series. In part one we …
source
Follow me on Twitter @ http://twitter.com/tktutorials Check out my website @ http://www.timkipptutorials.com This is part one of this tutorial series. In part one we …
source
37 responses to “PHP Series – Building A PHP MySQL Forum Tutorial Series Part 1 – User Login”
mine said "no database selected"
WHY WONT IT FUCKING CONNECT GOD DAMN IT WHAT THE FUCK AM I DOING WRONG WHAT THE FUCK AM I DOING WRONG
Why the fuck didnt you fucking include HOW THE FUCK to connect to a LIVE FUCKING SERVER instead of that piece of shit VIRTUAL
Nobody needs to be following this it doesnt work you cannot connect to a live server so that means this guy is a fucking idiot
THIS DOESNT FUCKING WORK Access denied for user 'root'@'localhost' (using password: NO) THAT IS WHAT THE FUCK IT GIVES ME WHEN I TRY THE FUCKING LOGIN SYSTEM NOW GODDAMN IT WHAT THE FUCK IS WRONG EITHER TELL ME OR TAKE DOWN THIS SHITTY FUCKING SERIES
WHAT THE HELL DO I DO I AM FUCKING READY TO JUST DELETE THIS PIECE OF SHIT SINCE IT REFUSES TO CONNECT TO MY GODDAMN SERVER
Connect.php wont connect to my live server, did everything you did in this video, keeps giving me a you do not have access message, so why cant i get connected
The login script would be vulnerable to SQLi though, not recommended.
Good tutorial, just outdated approaches.
I just want to learn how to code a forum myself using notepad++ is it possible? Im just doing it for learning expeirance
I know its a bit late, but i have a problem:
if i try to log in with my information from within the database i keep getting Invalid login information…
this is my code:
if(isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username = ' " .$username . " ' AND password = ' " . $password . " ' LIMIT 1";
$res = mysqli_query($conn, $sql);
$rowcount = mysqli_num_rows($res);
if($rowcount == 1) {
$row = mysqli_fetch_assoc($res);
$_SESSION['uid'] = $row['id'];
$_SESSION['username'] = $row['username'];
header("Location: index.php");
exit();
} else {
echo "Invalid login information.";
exit();
}
}
Someone here to help?
would appreciate 🙂
Please update this.mysql_connect_db and everything else using ext/mysql is deprecated.
+TimKippTutorials I keep getting error 500 from my server even when I have tried your code from my site
It's better practice just to have a session of the users id. You then should make a few functions that get user data from the data
when i log in it says:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'(my ip is censored)' (using password: NO) in /home/korvasie/public_html/connect.php on line 7
Access denied for user 'root'@'(my ip is censored)' (using password: NO)
Logging in just refreshes the page. I've done this 2 times. What's happened?
tnks brooo
I'm guessing all of these people who've got errors didn't run wamp server lmao.
Thank you for this. Just one question, how do you create the logout button?
I copied the code at 4:58 exactly, and for some reason when I run the code, I get ""; }else{ echo "
You are logged in as ".$_SESSION['username']." • Logout"; } ?>" appearing on the website
why is my "echo" is written in green :/ you got your echo in blue wtf :/ i'm also using dreamweaver
this is my code:
<?php
if (!isset($_SESSION['uid0'])){
echo"<form action='login_parse.php' method='post'>
Username:<input type='text' name='username' />
Password:<input type='password' name='password' />
<input type='submit' name='submit' value='Log In' />";
}else{
echo "<p>You are logged is as ".$_SESSION['username']."•<a href='logout_parse.php'>Logout</a>";
}
?>
Code:<?php
if (!isset($_SESSION['uid'])){
echo "<form action='login_parse.php' method='post'>
name:<input type='text' name='username'/>
password:<input type='password' name='password' />
<input type='submit' name='submit' value='Log in'/>
";
}
else {
echo "<p> you are logged in as ".$_SESSION ['username']. "$bull; <a href='logout_parse.php'>Logout <a/>";
}
?>
OUTPUT:
"; } else { echo "
you are logged in as ".$_SESSION ['username']. "$bull; Logout "; } ?>
the result
Username and password is working fine
I dont know what's wrong with my code I cant get . Please help.
i really want to knw how you and where you create that formseries
hey man you should have do a complete tutorial but its a grate video but if u don it with every ting it wud be even more better not every one knw about phpmysql admin as yet and so fast ok but grate video
Thank you TimKipp.. these help me a lot!
will be making a school project, forum for our school. and I will be watching your tutorials. Subscribed (y)
+TimKippTutorials This is a snipet of my code…
$res = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($res) == 1) {
$row = mysql_fetch_assoc($res);
$_SESSION['uid'] = $row['id'];
$_SESSION['username'] = $row['username'];
header("Location: index.php");
exit();
And when pressing login on the page I got this error…
Parse error: syntax error, unexpected 'uid' (T_STRING) in A:xampphtdocsnewlogin_parse.php on line 13
I'm using MySql and Apache and everything (don't really think that matters). I did everything like it was said in the video 🙁
Any help? 🙂
If you wanna test it out, go to here : panel.alzdoesmc.com/new <– EDIT: this is broken too 🙁 Sigh
How to make the sign up form?
when i click the log in button it dosent happens anything. How can i link my username and password to the database
line 13 – $_SESSION['uid'] = $row['id'];
line 14 – $_SESSION['username'] = $row['username'];
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:xampphtdocsnew_forumlogin_parse.php on line 13
help me
How do u run?
Hi, I have got a database with godaddy and it sends me to the php my admin site. What do I put in the host part I tried local host and it does not work could you please help me out thanks!
your paste is no longer there…head over to my website and post your problem in the forum. timkipptutorialsDOTcom
I can't help you if I do not see any code…
important please help ! pastebin .com/ ZvP86dEt
Dude can u help me? My dreamweaver fucks up, same as my php, and I did exactly the same thing as you -.-
Thank you! 🙂
Nice easy and short, i like this because you make it simple, without unimportent information.. TY:)