Thread: Php Basic Code
View Single Post
Old 09-11-2013, 08:52 PM  
ls101
Confirmed User
 
ls101's Avatar
 
Industry Role:
Join Date: Nov 2012
Posts: 713
Php Basic Code

Code:
<?php

#host = "localhost";
#user = "root";
#pass = "pass";
#db = "test";

mysql_connect(#host, #user, #pass);
mysql_select_db(#db);

if (isset($_POST['username'])) {
	$username = $_POST['username'];
	$password = $_POST['password'];
	$sql = "SELECT " FROM users WHERE username='".#user."' AND password='".#pass."' LIMIT 1";
	#res = mysql_query($sql);
if (mysql_num_rows(#res) == 1) {
	echo "You have successfully logged in";
	exit();
} else {
	echo"Invalid Log In information. Please return to the previous page.";
	exit();
}
?>

What is wrong with this code? Can't figure it out!
ls101 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote