...

View Full Version : Access denied problem



buildblocks
08-15-2012, 11:54 AM
I am getting theese errors on a login I have built


Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'socialbo'@'localhost' (using password: NO) in /home/socialbo/public_html/Login.php on line 6

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/socialbo/public_html/Login.php on line 6

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'socialbo'@'localhost' (using password: NO) in /home/socialbo/public_html/Login.php on line 7

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/socialbo/public_html/Login.php on line 7

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'socialbo'@'localhost' (using password: NO) in /home/socialbo/public_html/Login.php on line 8

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/socialbo/public_html/Login.php on line 8

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'socialbo'@'localhost' (using password: NO) in /home/socialbo/public_html/Login.php on line 10

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/socialbo/public_html/Login.php on line 10

Here is my coding, Line 1-10



<?php
include "Includes/Header.php";

if (!$User) {

$Username = mysql_real_escape_string(strip_tags(stripslashes($_POST['Username'])));
$Password = mysql_real_escape_string(strip_tags(stripslashes($_POST['Password'])));
$Submit = mysql_real_escape_string(strip_tags(stripslashes($_POST['Submit'])));

$return = mysql_real_escape_string(strip_tags(stripslashes($_GET['return'])));


And here is my login to server part included in Header.php



<?php
session_id();
session_start();
ob_start();
$con = mysql_connect("localhost","socialbo_admin","lol123");
mysql_select_db("socialbo_all");


Does anyone know the problem?

MarkR
08-15-2012, 12:08 PM
Are you sure $con = mysql_connect("localhost","socialbo_admin","lol123"); connects properly?

try this to see if a problem opening a connection has occured:




$con = mysql_connect("localhost","socialbo_admin","lol123");
if (!$con) {
die('Could not connect: ' . mysql_error());
}

buildblocks
08-15-2012, 12:18 PM
I created a test page put the code in and it went blank and didnąt say Could not connect.

So it works...

buildblocks
08-15-2012, 12:19 PM
If you want to check
http://socialbot.co.uk/UKTEST.PHP

Fou-Lu
08-15-2012, 02:50 PM
These errors do not match the code you have provided:


Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'socialbo'@'localhost' (using password: NO) in /home/socialbo/public_html/Login.php on line 6




$con = mysql_connect("localhost","socialbo_admin","lol123");


Notice in that error string the user part: denied for user 'socialbo'@'localhost' (using password: NO). According to your connection string, it has been established with a user called "socialbo_admin" with a password "lol123". The error specifies the user is "socialbo" with no password. The password itself is irrelevant (as I don't expect that it would be posted), but with a different user specifying no password, this indicates that the connection string used is different than the one you expect.

I can come close to it if I issue a mysql_close() on the connection. I then receive an error of denied for user ''@'localhost' (using password: NO). Since it clears the username (which makes sense), then that indicates the problem is not with a closed connection, rather with an alternative connection being established after your original connection.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum