Thread: Php Basic Code
View Single Post
Old 09-11-2013, 09:25 PM  
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
Quote:
Originally Posted by ls101 View Post
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!
shitloads of corrections/improvements can be made....

ref: http://www.w3schools.com/php/func_my...ape_string.asp
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote