|
|
|
|
![]() ![]() |
Apr 8 2006, 06:45 AM
Post
#1
|
|
|
Premium Member Group: [HOSTED] Posts: 318 Joined: 1-March 06 Member No.: 11,638 |
Hello everyone,
Im currently having a problem with mySQL, I wrote a PHP login script that doesnt seem to be working for some reason. I created a database and everything looks correct, is this a server issue or is the issue related to my script? But anyway this is my error, hope someone can help Ive tried to search forum for answer but none of the posts seems to answer my question: QUOTE Warning: mysql_connect(): Host 'gamma.xisto.com' is not allowed to connect to this MySQL server in /home/hp2001/public_html/ucscKGD/checklogin.php on line 10 cannot connect I set the $host=astahost.com, would it be $host=gamma, which is the server my site is at. I tried both and still recieve error...Hope someone can help me... |
|
|
|
Apr 8 2006, 06:52 AM
Post
#2
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 |
Nope - your host should be yoursubdomain.astahost.com. Maybe that's where it's going wrong - it's trying to connect to the MySQL DB's of the main astahost.com domain.
Try adding in your own subdomain before that and write back if it works. |
|
|
|
Apr 8 2006, 07:03 AM
Post
#3
|
|
|
Premium Member Group: [HOSTED] Posts: 318 Joined: 1-March 06 Member No.: 11,638 |
Nope doesnt look like its working...hmmm cant be my code, cause its the same code I used at another free hosting server, just that I have to modify the correct hosting variable...hmmm...but this is wut i get when I change the $host="hp2001.astahost.com"
QUOTE Warning: mysql_connect(): Host 'gamma.xisto.com' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home/hp2001/public_html/ucscKGD/checklogin.php on line 10 cannot connect from the search results I checked on the forum people talked about overloads of the mySQL server, could that be it...the error doesnt seem to make sense if its a mySWL server overload problem... |
|
|
|
Apr 8 2006, 07:10 AM
Post
#4
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 |
I don't think it's an overload problem - coz my site (Antilost) is loading fine, and it's hosted on Gamma. Can you paste the connection part of your script here ? That might give me an idea..
However - on second thoughts, Host 'gamma.xisto.com' is blocked because of many connection errors. - that statement does indicate a temporary lockup owing to too many persistent connections. Lets wait up for sometime and see if it gets fixed. Usually such overloads are auto-resolved within 15 minutes or maybe a bit more sometimes. |
|
|
|
Apr 8 2006, 07:12 AM
Post
#5
|
|
|
Premium Member Group: [HOSTED] Posts: 318 Joined: 1-March 06 Member No.: 11,638 |
Hmm...wonder whats wrong, well heres my script:
CODE <?php
ob_start(); $host="hp2001.astahost.com"; // Host name $username="hp2001"; // Mysql username $password="********"; // Mysql password $db_name="hp2001_ucscKGD"; // Database name $tbl_name="members"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername and redirect to file "members.php" session_register("myusername"); header("location:members.php"); } else { header("location:incorrectUP.php"); } ob_end_flush(); ?> |
|
|
|
Apr 8 2006, 07:29 AM
Post
#6
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 |
The code seems absolutely fine except for one little mistake..
CODE $host="hp2001.astahost.com"; // Host name $username="hp2001"; // Mysql username $password="********"; // Mysql password $db_name="hp2001_ucscKGD"; // Database name $tbl_name="members"; // Table name Notice that for $db_name - you've prefixed the database name with hp2001 - which is your cPanel username. Similarly, for $username - you'll have to prefix your MySQL DB username, with another hp2001. So it should be $username = "hp2001_hp2001" By default whenever you create a new MySQL DB and a username for it, they're both prefixed with your cPanel username. Try that and let me know - although, if it was a problem with the username, the error message should have said so. Seems like it's not connecting in the first place. Still give it a try and let me know. |
|
|
|
Apr 8 2006, 09:26 AM
Post
#7
|
|
|
Premium Member Group: [HOSTED] Posts: 318 Joined: 1-March 06 Member No.: 11,638 |
I tried wut u suggested and it still has the same problem, and is there a way to unblock? I can seem to find the phpadmin to flush the block...I guess Ill just retry tomrrow when its free from the block...
|
|
|
|
Apr 8 2006, 05:18 PM
Post
#8
|
|
|
Super Member Group: Members Posts: 572 Joined: 25-April 05 From: Nashville Tennessee Member No.: 4,340 |
Try "localhost" for the host name it works fine for me
QUOTE $host="hp2001.astahost.com"; // Host name change it to$username="hp2001"; // Mysql username $password="********"; // Mysql password $db_name="hp2001_ucscKGD"; // Database name $tbl_name="members"; // Table name CODE $host="localhost"; // Host name
$username="hp2001"; // Mysql username (make this your username that you login to cPanel with) $password="********"; // Mysql password(make this the password you login to astahost cPanel with) $db_name="hp2001_ucscKGD"; // Database name $tbl_name="members"; // Table name |
|
|
|
Apr 8 2006, 05:59 PM
Post
#9
|
|
|
Premium Member Group: [HOSTED] Posts: 318 Joined: 1-March 06 Member No.: 11,638 |
but would localhost...be if you are hosting it privately on your machine with a setup apache server, cause I use localhost as the value when I am testing php scripts on my computer. For webhosts it should be the hostname of the server...I cant seem to get it working, I can get this script working successfully at another freehosting site but how come Im gettin problems here? I will try put localhost, im up to try anything right now...haha...
EDIT>>WOW...HOUDINI...YOU ARE THE MAN!!! Haha, it worked...odd tho, how the hostname would be localhost, I would think the name be the servers hostname... This post has been edited by kgd2006: Apr 8 2006, 05:59 PM |
|
|
|
Apr 8 2006, 08:39 PM
Post
#10
|
|
|
Super Member Group: Members Posts: 572 Joined: 25-April 05 From: Nashville Tennessee Member No.: 4,340 |
That is because normally MySQL runs as localhost, there is one host that I must connect to as mysql not localhost. Most of the time localhost is fine it is the username and password that matter to the MySQL server.
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 30th August 2008 - 03:21 PM |