Page 1 of 1

db.php problem, please help ^-^

Posted: Sun Aug 24, 2003 1:17 am
by Hoshi
This is my db.php, I'm not sure if all the things are rite, please correct me, if I'm wrong.
<?
/* Database Information - Required!! */
/* -- Configure the Variables Below --*/
$dbhost = '69.57.142.60';
$dbusername = 'abna@abna.ca';
$dbpasswd = '***********';
$database_name = 'abna_ca';

/* Database Stuff, do not modify below this line */

$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
or die ("Couldn't connect to server.");

$db = mysql_select_db("$database_name", $connection)
or die("Couldn't select database.");
?>
but when i try to get into the database it gives me this
Warning: mysql_pconnect(): Access denied for user: 'abna@abna.ca@ensim.com' (Using password: YES) in /home/virtual/site82/fst/var/www/html/Vilky/Login/db.php on line 11
Couldn't connect to server.

Posted: Sun Aug 24, 2003 6:55 am
by volka
looks like either your login/password combination is wrong or you're trying to access a database you're not allowed to.

btw. there's no need to quote your string-variables when used as parameters.
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")

Code: Select all

$connection = mysql_pconnect($dbhost, $dbusername, $dbpasswd)

^-^

Posted: Sun Aug 24, 2003 8:43 pm
by Hoshi
That might be it, but can you tell me why does "@ensim.com" always comes up, when I try to login in?

I haven't typed that in my db.php, yet it always come on.

http://www.abna.ca/VC/Login/login_form.html

Posted: Sun Aug 24, 2003 8:58 pm
by volka
that's the origin of the request (where the client is located; in this case the php-script) as seen by the mysql-server.
If you were on the same host it would print something like abna@abna.ca@localhost. Permissions can be granted (and denied) by the origin.
You should ask your provider how to connect to the server or -if you run this system- take a look at http://www.mysql.com/doc/en/Adding_users.html
in either case http://www.mysql.com/doc/en/Access_denied.html might shed up some light on this

Posted: Sun Aug 24, 2003 9:22 pm
by Hoshi
First, use the mysql program to connect to the server as the MySQL root user:

shell> mysql --user=root mysql
Then you can add new users by issuing GRANT statements:

mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@'%'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO admin@localhost;
mysql> GRANT USAGE ON *.* TO dummy@localhost;
Ok, I follow the direction, but than it tells me to add users, yet it doesn't tell me where, just that connect as the root user.

P.S: I'm using PhpMyAdmin program.

Oh, and I'm wondering

Image

What would be the database name?
abna_ca
or
users?

Posted: Sun Aug 24, 2003 10:34 pm
by trollll
Database name of "abna_ca" and it has a table named "users" in it.

Posted: Tue Aug 26, 2003 6:49 pm
by Hoshi
I think that if a person that register on the website, the file automatic adds the user on to my database, so I don't have to add users manually, right?

I was wondering if you could tell me what i should be checking here.
// check if the user info validates the db
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND

password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
Please, and Thank You

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/virtual/site82/fst/var/www/html/VC/Login/checkuser.php on line 21