+ Reply to Thread
Results 1 to 5 of 5

Thread: Access denied using mysql_real_escape_string()

  1. #1
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Access denied using mysql_real_escape_string()

    Hello

    I've this message on x10hosting, that I havn't on my two personnal computers and I don't understand why!

    It's just at the begining of my script :

    This is the begining of index.php :
    PHP Code:
    <?php session_start(); 
    include (
    'functions.php');
    ?>
    <html><head><title>Fomalhaut</title>
    <SCRIPT language=JavaScript src="fomalhaut.js"></script>
    <link rel=stylesheet href="Fomalhaut.css" type="text/css">
    </head>
    <body text="#999999" link="00cccc" bgcolor="#060f14">
    <div class="bkflot"><img src="19970405_19h45_C1995_O1_HaleBopp_JYC76_1A.jpg" width="100%" /></div>
    <div class="flot"><center>
    <form action="index.php" method="post">
    Identifiant  :<br /><input type="text" name="utilisateur" id="utilisateur" /><br />
    Mot de Passe :<br /><input type="password" name="upass" /><br />
    <input type="submit" name="submit" id="submit" /><br />
    <input type="submit" name="dcnx" value="d&eacute;connexion" id="dcnx" /><br />
    <div id="TArea" ></div>
    </form></center>
    </div>
    and that is the functions.php file :
    PHP Code:
    <?php
    // ce fichier est un include php
    function safe($var) {
    return 
    mysql_real_escape_string($var);
    }
    ?>
    following is the messages :
    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'user'@'chopin.x10hosting.com' (using password: NO) in /home/user/public_html/functions.php on line 4

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/user/public_html/functions.php on line 4
    Does that mean I really must establish a connection with the database first ? but why not on my computers ?
    Or are authorizations not sufficiant for the user ? why not on my computers ?
    Or does this function (i.e. mysql_real_escape_string()) not exist on x10hosting ? so which can I use instead of it ?

    Thinks for your help.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Access denied using mysql_real_escape_string()

    1. Why are you using that function if you are not going to use the data in a mySQL operation?

    2. You either have to establish a connection first, or your default settings must be sufficient to make the connection. On x10 the default settings are not sufficient.
    Nothing is always absolutely so.

  3. #3
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Re: Access denied using mysql_real_escape_string()

    Hello

    OK, thank you very much, Descalzo, I'll add a DB connect first. I'll try to do that with PDO (if I can).

    your default settings must be sufficient to make the connection.
    So, on my computers, the DB connection is implicite when I call this mysql function !


    Thank you again.

  4. #4
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: Access denied using mysql_real_escape_string()

    Quote Originally Posted by fomalhaut View Post
    OK, thank you very much, Descalzo, I'll add a DB connect first. I'll try to do that with PDO (if I can).

    So, on my computers, the DB connection is implicite when I call this mysql function !
    First, if you use pdo, you'll have to change the mysql_real_escape function to the pdo escape function.
    Second, it means your personal PHP settings were either setup for your mysql installation, or your mysql installation is not properly secured.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  5. #5
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Re: Access denied using mysql_real_escape_string()

    Hello

    Quote Originally Posted by xav0989
    First, if you use pdo, you'll have to change the mysql_real_escape function to the pdo escape function.
    Of course I'll change it !

    Quote Originally Posted by xav0989
    Second, it means your personal PHP settings were either setup for your mysql installation, or your mysql installation is not properly secured.
    On my cmputers, the only one that is not secure is php :
    PHP is NOT running in "safe mode" ---- unsecure
    If do you want to offer PHP executions for outside persons, please think about a "safe mode" configuration. But for standalone developer we recommend NOT the "safe mode" configuration because some important functions will not working then.
    My PHP computer is not open for the outside, only for development. So I think it's not necessary to work it in safe mode !

    Thank you.

+ Reply to Thread

Similar Threads

  1. Access denied for database user
    By vivek noronha in forum Free Hosting
    Replies: 3
    Last Post: 10-29-2009, 12:37 PM
  2. 'Access denied' when uploading via FTP
    By jamiek in forum Free Hosting
    Replies: 0
    Last Post: 11-25-2008, 07:14 AM
  3. mySql Access Denied Error
    By shaneiadt in forum Programming Help
    Replies: 4
    Last Post: 02-06-2008, 06:24 PM
  4. Website is down
    By JeffreyWalters in forum Free Hosting
    Replies: 17
    Last Post: 11-28-2007, 12:16 PM
  5. INSERT command denied??
    By 1337scape in forum Free Hosting
    Replies: 6
    Last Post: 11-14-2007, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers