Good morning..
This is my php code :
<?php
ini_set ('display_errors',1);
error_reporting (E_ALL & ~E_NOTICE);
if (isset ($_POST['submit'])){
if ($dbc = @mysql_connect('localhost','web','p@ss'))
{
if (!@mysql_select_db ('web_site'))
{
die('<p> Could not select the database brcause:<b>'. mysql_error() .'</b></p>');
}
}else{
die('<p>Could not connect to MYSQL because:<b>' . mysql_error() . '</b></p>');
}
}
$query = 'select * from users where user_name = "'.$_POST['username'].'" and password = "'.md5($_POST['password'].'"');
$select_user = mysql_query($query);
if (mysql_num_rows($select_user) != 0)
{
session_start();
session_register('authorized');
$_SESSION['authorized'] = true;
header("Location: admin.php");
exit;
}
else
{
header("Location: login_form.php");
exit;
}
?>
Its a part from a login page . When i type password and username and press submit button it returns these tow errors:
Warning: mysql_query() [function.mysql-query]: Access denied for user 'www-data'@'localhost' (using password: NO) in /var/www/login/login.php on line 19
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /var/www/login/login.php on line 19
I search in google for them but they say that occurs from a wrong connection with database through mysql_connect. I don't think that the username and password that i put in mysql_connect function are wrong ..:s Also i have change some things in mysql_query function but nothing happens..
What is your opinion ?