Need professional help!
Posted: Thu Mar 23, 2006 2:45 pm
Hi, I have had this problem for many days on here: http://www.codingforums.com/showthread.php?t=82504 Now i need professional help so i came here.
Thx
Thx
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);Code: Select all
<?php
// this is php
$var = 'this';
?>
<h2>Normal html</h2>Code: Select all
<?php
$name = $_POST['name'];
var_dump($name);
// etc
?>Code: Select all
<?php
session_start();
?>
<html>
<head>
<title>validate.php</title>
</head>
<body>
Ok, we are about to start: <?php echo date("m-d-Y g:i A"); ?>.
<?php
if (isset($_POST))
{
$user_name = $_POST['user_name'];
$password = $_POST['password'];
$db_user = 'mysql_username';
$db_pass = 'mysql_password';
//connect to the DB and select the "dictator" database
$connection = mysql_connect('localhost', $db_user, $db_pass) or die(mysql_error());
mysql_select_db('Esgames4ulogin') or die(mysql_error());
//set up the query
$query = "SELECT * FROM users
WHERE user_name='$user_name' AND password='$password'";
// Test output of something
echo $query . "<br />\n";
//run the query and get the number of affected rows
$result = mysql_query($query, $connection) or die('error making query: ' mysql_error());
//if there's exactly one result, the user is validated. Otherwise, he's invalid
if(1 == mysql_num_rows($result)) {
echo 'validated';
}
else {
echo 'not valid';
}
}
else
{
echo 'There was nothing posted...';
}
?>
OK, finishing up: <?php echo date("m-d-Y g:i A"); ?>.
</body>
</html>Code: Select all
<?php
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
$rg = (in_array(strtolower(ini_get('register_globals')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$de = (in_array(strtolower(ini_get('display_errors')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$so = (in_array(strtolower(ini_get('short_open_tag')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$eol = (isset($_SERVER['HTTP_HOST']) ? "<br />\n" : "\n");
$ec = array(
'E_STRICT' => 2048,
'E_ALL' => 2047,
'E_USER_NOTICE' => 1024,
'E_USER_WARNING' => 512,
'E_USER_ERROR' => 256,
'E_COMPILE_WARNING' => 128,
'E_COMPILE_ERROR' => 64,
'E_CORE_WARNING' => 32,
'E_CORE_ERROR' => 16,
'E_NOTICE' => 8,
'E_PARSE' => 4,
'E_WARNING' => 2,
'E_ERROR' => 1,
);
$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
if (($t & $v) == $v)
{
$e[] = $n;
$t ^= $v;
}
}
$er = $er . ' (' . implode(' | ', $e) . ')';
echo 'PHP Version ' . $ve . $eol;
echo 'PHP OS ' . $os . $eol;
echo 'Error Reporting ' . $er . $eol;
echo 'Register Globals ' . $rg . $eol;
echo 'Short Tags ' . $so . $eol;
echo 'Display Errors ' . $de . $eol;
?>Code: Select all
PHP Version 4.4.0
PHP OS Linux
Error Reporting 2047 (E_ALL)
Register Globals Off
Short Tags On
Display Errors OffCode: Select all
php_flag display_errors onCode: Select all
Parse error: parse error, unexpected T_STRING in /var/www/Esgames4uweb/validate.php on line 31Code: Select all
$result = mysql_query($query, $connection) or die('error making query: ' . mysql_error());Code: Select all
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/Esgames4uweb/validate.php on line 36