DeathDream Posted November 15, 2008 Share Posted November 15, 2008 I have my PHP Script fine, the form to register fine, MySQL seems fine, but I'm getting this error: Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in /home/www/l2enigma.freehostia.com/acc.php on line 8 Could not connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client Is there something i have to edit in MySQL or the script? I'm Using this to have users create accounts on my users through a web page, and the last hard step for the website is getting the account registration to work. I would very much appreciate it if anyone could help me. Account Page is Here: http://l2enigma.freehostia.com/account.php My PHP Script is this: (All Classified Info is Hidden with xxx) <?php //set host, username and password for MySQL $dbhost = "xx.xxx.xx.xxx"; $dbuser = "xxxxxxx"; $dbpass = "xxxxxxxxxx"; //connect to MySQL or return an error $conn = mysql_connect("$dbhost", "$dbuser", "$dbpass") or die('Could not connect: ' . mysql_error()); //set database name $dbname = "xxxxx"; //select database or return an error $dbselect = mysql_select_db("$dbname") or die ('Could not select database'); //get username and password info from the form, protecting against SQL injection $pass = mysql_real_escape_string($_POST["pass"]); $confirm = mysql_real_escape_string($_POST["confirm"]); $user = mysql_real_escape_string($_POST["name"]); //validate user input if(!preg_match('/^[a-zA-Z0-9]{5,20}$/',$user)) { die ('Error: Usernames can only contain alphanumeric characters and must be between 5 and 20 characters in length.'); } if(!preg_match('/^[a-zA-Z0-9]{5,20}$/',$pass)) { die ('Error: Passwords can only contain alphanumeric characters and must be between 5 and 20 characters in length.'); } if($pass != $confirm) { die ('Error: Passwords do not match.'); } //make sure user doesn't already exist and if it doesn't, add new record to the database $result = mysql_query("SELECT login FROM accounts WHERE login='$user'"); if(mysql_num_rows($result)>0) { die ('Error: Username already exists.'); }else{ mysql_query("INSERT INTO accounts (login, password, access_level) VALUES ('".$_POST['name']."', '".base64_encode(pack('H*', sha1($_POST['pass'])))."', 0)") or die ('Error: ' . mysql_error()); } //report successful registration echo "Account created successfully."; //close MySQL connection mysql_close(); ?> Quote Link to comment Share on other sites More sharing options...
ratcateme Posted November 15, 2008 Share Posted November 15, 2008 where is the mysql server you are connecting to? is it with free hostia or your own? when looking over the free hostia website i can't see what version they use. do you know the version of server you are connecting to? do you know the version of the client connection mysql library is being used? Scott. Quote Link to comment Share on other sites More sharing options...
n3ightjay Posted November 15, 2008 Share Posted November 15, 2008 try simply setting your $dbhost variable to localhost; i check out the site and they mentioned not allowing outside connections so this leads me down this path $dbhost = "localhost"; Quote Link to comment Share on other sites More sharing options...
DeathDream Posted November 15, 2008 Author Share Posted November 15, 2008 Oh oops. i thought i had made it clear by the "Classified" Lol. Its on my computer, and I'm using MySQL server 5.0 I run a Lineage 2 Game server, and the script is for creating the accounts on the same database. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted November 15, 2008 Share Posted November 15, 2008 run this script <?php phpinfo(); ?> look for mysql and see what number is under "Client API version" Scott. Quote Link to comment Share on other sites More sharing options...
DeathDream Posted November 15, 2008 Author Share Posted November 15, 2008 Server API: CGI No Client API though.... Is it probably a problem with freehostia? UPDATE!!!!! Client API version 3.23.56 Quote Link to comment Share on other sites More sharing options...
ratcateme Posted November 15, 2008 Share Posted November 15, 2008 my understanding is that the Client API version must match or be higher than the mysql server. you should talk to freehostia they seem to be using a very outdated mysql version. Scott. Quote Link to comment Share on other sites More sharing options...
xcoderx Posted November 15, 2008 Share Posted November 15, 2008 freehostia is one of the crappiest hosting site i ever used. Quote Link to comment Share on other sites More sharing options...
DeathDream Posted November 15, 2008 Author Share Posted November 15, 2008 Any suggestions then for a free hosting? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.