Does this look alright?

Status
Not open for further replies.

Integers

Soon to be Developer!
Sep 22, 2012
119
7
PHP:
<?php
include 'core/init.php';
 
if (user_exists('James') === true) {
echo 'This exists';
}
die();
 
if (empty($_POST) === false) {
$username = $_POST['username'];
$password = $_POST['password'];
 
if (empty($username) === true || empty($password) === true) {
$errors[] = 'Please enter a username and password';
} else if (user_exists($username) === false) {
$errors[] = 'Username/Password not found!';
}
}
?>

Does this look alright
 

Integers

Soon to be Developer!
Sep 22, 2012
119
7
Still doesn't work :/

Edit: maybe its this?

PHP:
<?php
function user_exists($username) {
$username = sanitize($username);
$query = mysql_query("SELECT COUNT (`id`) FROM `users` WHERE `username` = '$username'");
return (mysql_result($query, 0) == 1) ? true : false;
}
?>
 

Gajeel

Well-Known Member
Oct 4, 2011
2,411
413
<?phpinclude 'core/init.php';

if (
user_exists('James') === true) {
echo
'This exists';
};

if (empty(
$_POST) === false) {$username = $_POST['username'];$password = $_POST['password'];

if (empty(
$username) === true || empty($password) === true) {$errors[] = 'Please enter a username and password';
} else if (
user_exists($username) === false) {$errors[] = 'Username/Password not found!';
}
die()}
?>

I think he mean you must execute die at the end instead of the first, since it won't execute the next statements if the die goes after the first if statement?justtryingtohelp.
 
Status
Not open for further replies.

Users who are viewing this thread

Top