Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2010
    Posts
    28
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Access denied problem

    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 Code:
    <?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 Code:
    <?php
    session_id
    ();
    session_start();
    ob_start();
    $con mysql_connect("localhost","socialbo_admin","lol123");
    mysql_select_db("socialbo_all");
    Does anyone know the problem?

  • #2
    New Coder
    Join Date
    Sep 2011
    Posts
    80
    Thanks
    0
    Thanked 13 Times in 12 Posts
    Are you sure $con = mysql_connect("localhost","socialbo_admin","lol123"); connects properly?

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

    PHP Code:

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


  • #3
    New Coder
    Join Date
    Apr 2010
    Posts
    28
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I created a test page put the code in and it went blank and didnàt say Could not connect.

    So it works...

  • #4
    New Coder
    Join Date
    Apr 2010
    Posts
    28
    Thanks
    3
    Thanked 0 Times in 0 Posts
    If you want to check
    http://socialbot.co.uk/UKTEST.PHP

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    These errors do not match the code you have provided:
    Code:
    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
    PHP Code:
    $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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •