Portal Home > Knowledgebase > Articles Database > iTop10 Script


iTop10 Script




Posted by xdonald, 08-22-2007, 09:45 AM
I'm not that good at installing scripts so please bare with me. I uploaded all of the files, edited the "config.php" file, etc. And am getting these errors in my Administration panel. Warning: mysql_list_tables(): Access denied for user 'truedrea'@'localhost' (using password: NO) in /home/truedrea/public_html/topsites/admin/check.php on line 10 Warning: mysql_list_tables(): A link to the server could not be established in /home/truedrea/public_html/topsites/admin/check.php on line 10 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/truedrea/public_html/topsites/admin/check.php on line 13 And this on the index: Fatal error: Call to undefined function: reset_list() in /home/truedrea/public_html/topsites/index.php on line 16 Can someone please help me

Posted by the_pm, 08-22-2007, 09:51 AM
First of all, WAY too much info in that first post! I hope you edited out the password, and it's not really 'NO'! Otherwise, if someone knows the IP address of the site in question, they may be able to compromise your database remotely It looks like you may have misspelled something in your config file. Are you particular your username is just 'truedrea' and not something like 'truedrea_truedrea'? Typically, when a server shares MySQL across multiple accounts, there's some sort of mechanism (like underscoring) to separate databases AND usernames by account name.

Posted by Steve_Arm, 08-22-2007, 10:14 AM
Uhm... that's not the password. It means that he tried to connect without supplying a password. Pass the password for user 'truedrea' in order to connect. Besides that I wonder why the script continues execution since it couldn't connect. Bad coding. The fatal error means that it cannot find the page the has the function's code. What I suspect is that you haven't created the user that will have privileges on the script's database. Last edited by Steve_Arm; 08-22-2007 at 10:19 AM.

Posted by xdonald, 08-22-2007, 10:16 AM
I checked. nothing's misspelled and tried taking out the truedrea_xblahblah and put it in. Got the same errors.

Posted by the_pm, 08-22-2007, 10:31 AM
You know, I've never actually seen that as part of an error before, because I don't think in I've ever accidentally left out a password or even supplied an invalid one. Thanks for the correction! xdonald, what Steve said. Either you didn't create a user for the database or you forgot to connect the user to it from within your control panel (I'm assuming you're using a control panel and not command line).

Posted by Steve_Arm, 08-22-2007, 10:34 AM
It's cool.

Posted by xdonald, 08-22-2007, 10:40 AM
yes, I am using a control panel.. would a copy of my config.php file help? Last edited by xdonald; 08-22-2007 at 10:46 AM.

Posted by the_pm, 08-22-2007, 10:46 AM
Well, go into your control panel and into the MySQL part. Have you created a user, and have you tied that user to your database with full access permissions?

Posted by xdonald, 08-22-2007, 10:53 AM
Yes to both questions. Would a copy of my config.php file help?

Posted by the_pm, 08-22-2007, 10:56 AM
Ok, posting your config file would almost certainly mean posting information you shouldn't post Are you particular you put the user password in the config file? According to Steve_Arm's assessment, it doesn't look like the file isn't sending a password to establish a database connection.

Posted by xdonald, 08-22-2007, 10:59 AM
Yes, I'm sure. $user = "xxxx_xxx"; $pass = "xxxxxxx"; $dbname = "xxxx_xxxxx"; $dbhost = "localhost";

Posted by the_pm, 08-22-2007, 11:07 AM
Ok, I've pushed this over to the Programming Discussion forum. It appears you have everything set up properly (assuming the values under the xxxxes are correct). Perhaps a programmer can give more insight from here

Posted by xdonald, 08-22-2007, 01:47 PM
it's not a program like photoshop or something. It's just a regular old php script. oh well...

Posted by the_pm, 08-22-2007, 01:57 PM
Yes, this is the forum where PHP scripters answer questions

Posted by xdonald, 08-22-2007, 03:50 PM
Okee doke. So does anyone have ideas,concerns, questions or answers for me?? I really want to use the script.

Posted by Steve_Arm, 08-22-2007, 04:09 PM
Do u have a link to the script's download page, to run a test installation?

Posted by xdonald, 08-22-2007, 05:21 PM
yes, it's: http://itop10.net/ and no it doesnt have a test installation...

Posted by killapix, 08-22-2007, 06:11 PM
This is a process of elimination so bare with us.. So you have created a database and added a user to that database with ALL privilages in MySQL.? You edited the 'config.php' file correctly.? $user = "xxxx_username"; $pass = "yourpassword"; $dbname = "xxxx_phptop"; $dbhost = "localhost"; Its important you have them between the "Quotes" and the ;semi-colon; is left at the end of each line. All names are exactly as they should be i.e. spellings and capitals.? Last edited by killapix; 08-22-2007 at 06:16 PM.

Posted by xdonald, 08-22-2007, 07:27 PM
Yep, I created the database and username successfully and tied them together. And I added the config.php file correctly, I just checked.

Posted by Steve_Arm, 08-23-2007, 02:43 AM
I've just set it up on my server and it is working. If you follow the installation instructions on the readme.txt you won't have any problems.

Posted by killapix, 08-23-2007, 10:58 AM
I was sceptical whether to try it myself as I somehow knew it would work, but I am glad you've done it to prove the point. So @ the OP you need to double check that you have done everthing correctly. To create a database: Go to Cpanel > MySQL Databases : 3 Steps 1. create the database. Press Confirm 2. create username with password. Press Confirm. 3. Add that Username to the created database with ALL privilages. Press Confirm. Add all the info word for word to your config file and connect to your admin panel through the browser. As this previous poster has confirmed, it should work correctly.

Posted by Steve_Arm, 08-23-2007, 12:15 PM
Just to note something. This script/site has an admin area which from there you can install the database (4 tables only). I created the database and a user for this database from phpMyAdmin. Then went to the admin area to create the database. What happens is that it runs the command and returns to the same page with no errors, so you assume that the tables have been created. I checked from phpMyAdmin and no tables had been added. Strange. But I created them manually. Maybe that's where OP fails. Besides the login data there is some paths that have to be changed in config.php for the app to work.

Posted by killapix, 08-23-2007, 01:36 PM
Yes sure I understand the scripts install instructions are not that clear. I did help another user of this script who had a path problem. Albiet the error the OP is getting is only a connection to MySQL error.? I notice in admin directory there is a install.php so I am assuming that after creating the database you run the install.php from the browser to connect and create the required tables i.e. www.yoursite.com/yourdirectory/admin/install.php (yourdirectory is optional if it is not installed at root). Also there is a file called install_doc.php with more directory names and chmod instructions.

Posted by xdonald, 08-23-2007, 02:47 PM
Ok, this is what I did: [removed] (that's a screenshot) Then I clicked: Add user to database and got this: [removed](another screenshot) And then entered this into my config.php (those spaces between the "? >" & "< ?" aren't really there. And I've reentered the information over and over, I even copied and pasted the database name and username from my CPanel. And I still get the errors Last edited by xdonald; 08-23-2007 at 02:57 PM.

Posted by Steve_Arm, 08-23-2007, 02:50 PM
Your actions are correct. In config.php some variables should be file system paths - not urls. I see a potential problem that the user name is cut off at the underscore. Anyway if you want I can take a look at it. By the way remove all the domain links from your above post. Last edited by Steve_Arm; 08-23-2007 at 02:54 PM.

Posted by xdonald, 08-23-2007, 02:57 PM
So what parts should be paths and could you give me an example of one?

Posted by Steve_Arm, 08-23-2007, 02:59 PM
reset_log_file = "/usr/home/usrname/public_html/topsites/reset.txt"; $count_log_file = "/usr/home/usrname/public_html/topsites/count.txt"; AND $full_path Last edited by Steve_Arm; 08-23-2007 at 03:03 PM.

Posted by xdonald, 08-23-2007, 03:14 PM
now I'm getting these errors. Warning: main(/home/xxx/public_html/connect.php): failed to open stream: No such file or directory in /home/xxxx/public_html/topsites/config.php on line 51 Warning: main(): Failed opening '/home/xxxx/public_html/connect.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxx/public_html/topsites/config.php on line 51 But I'm also getting this in my FTP: "550: cant check for file existence"

Posted by Steve_Arm, 08-23-2007, 03:15 PM
usr/home/.... add /usr

Posted by xdonald, 08-23-2007, 03:16 PM
Changed it, now this: "Table 'truedrea_topsite.top_user' doesn't exist"

Posted by Steve_Arm, 08-23-2007, 03:18 PM
OK, this is good, now it means that the tables in the database doesn't exist, you should go to the 'create tables' link.

Posted by xdonald, 08-23-2007, 03:21 PM
Tried it twice, didn't work. Is there any way I could install the tables myself?

Posted by Steve_Arm, 08-23-2007, 03:23 PM
Yes, the file install.php holds the database queries. Also don't forget to password protect the admin dir.

Posted by xdonald, 08-23-2007, 03:27 PM
That's what I tried at first, like is there anyway I could up set them up manually?

Posted by Steve_Arm, 08-23-2007, 03:30 PM
From phpMyAdmin.

Posted by Steve_Arm, 08-23-2007, 03:31 PM
CREATE TABLE top_cats ( cid int(11) NOT NULL auto_increment, catname varchar(255) default 'Main' Not Null, PRIMARY KEY (cid), UNIQUE catname (catname) ); INSERT INTO top_cats (cid,catname) VALUES (1,'Animals'); INSERT INTO top_cats (cid,catname) VALUES (2,'Arts'); INSERT INTO top_cats (cid,catname) VALUES (3,'Books'); INSERT INTO top_cats (cid,catname) VALUES (4,'Business'); INSERT INTO top_cats (cid,catname) VALUES (5,'Cars'); INSERT INTO top_cats (cid,catname) VALUES (6,'Celebrities'); INSERT INTO top_cats (cid,catname) VALUES (7,'Chat'); INSERT INTO top_cats (cid,catname) VALUES (8,'Clipart'); INSERT INTO top_cats (cid,catname) VALUES (9,'Collectibles'); INSERT INTO top_cats (cid,catname) VALUES (10,'Communities'); INSERT INTO top_cats (cid,catname) VALUES (11,'Computers'); INSERT INTO top_cats (cid,catname) VALUES (12,'Contests'); INSERT INTO top_cats (cid,catname) VALUES (13,'Cool sites'); INSERT INTO top_cats (cid,catname) VALUES (14,'Crafts'); INSERT INTO top_cats (cid,catname) VALUES (15,'Desktop Themes'); INSERT INTO top_cats (cid,catname) VALUES (16,'Dogs'); INSERT INTO top_cats (cid,catname) VALUES (17,'Education'); INSERT INTO top_cats (cid,catname) VALUES (18,'Entertainment'); INSERT INTO top_cats (cid,catname) VALUES (19,'Essays'); INSERT INTO top_cats (cid,catname) VALUES (20,'Finance'); INSERT INTO top_cats (cid,catname) VALUES (21,'Fonts'); INSERT INTO top_cats (cid,catname) VALUES (22,'Free Cash'); INSERT INTO top_cats (cid,catname) VALUES (23,'Free Mail'); INSERT INTO top_cats (cid,catname) VALUES (24,'Freestuff'); INSERT INTO top_cats (cid,catname) VALUES (25,'Freeware'); INSERT INTO top_cats (cid,catname) VALUES (26,'Genealogy'); INSERT INTO top_cats (cid,catname) VALUES (27,'Graphics'); INSERT INTO top_cats (cid,catname) VALUES (28,'GSM'); INSERT INTO top_cats (cid,catname) VALUES (29,'Greetingcards'); INSERT INTO top_cats (cid,catname) VALUES (30,'Health'); INSERT INTO top_cats (cid,catname) VALUES (31,'Hobbies'); INSERT INTO top_cats (cid,catname) VALUES (32,'Horoscopes') INSERT INTO top_cats (cid,catname) VALUES (33,'Hotels'); INSERT INTO top_cats (cid,catname) VALUES (34,'Internet'); INSERT INTO top_cats (cid,catname) VALUES (35,'Jobs'); INSERT INTO top_cats (cid,catname) VALUES (36,'Jokes'); INSERT INTO top_cats (cid,catname) VALUES (37,'Lyrics'); INSERT INTO top_cats (cid,catname) VALUES (38,'Magazines'); INSERT INTO top_cats (cid,catname) VALUES (39,'Maps'); INSERT INTO top_cats (cid,catname) VALUES (40,'Marketing'); INSERT INTO top_cats (cid,catname) VALUES (41,'Midi'); INSERT INTO top_cats (cid,catname) VALUES (42,'Movies'); INSERT INTO top_cats (cid,catname) VALUES (43,'MP3'); INSERT INTO top_cats (cid,catname) VALUES (44,'Music'); INSERT INTO top_cats (cid,catname) VALUES (45,'News'); INSERT INTO top_cats (cid,catname) VALUES (46,'Newsletters'); INSERT INTO top_cats (cid,catname) VALUES (47,'Personal homepages'); INSERT INTO top_cats (cid,catname) VALUES (48,'Pets'); INSERT INTO top_cats (cid,catname) VALUES (49,'Pokemon'); INSERT INTO top_cats (cid,catname) VALUES (50,'Portals'); INSERT INTO top_cats (cid,catname) VALUES (51,'Radiostations'); INSERT INTO top_cats (cid,catname) VALUES (52,'Real estate'); INSERT INTO top_cats (cid,catname) VALUES (53,'Recipes'); INSERT INTO top_cats (cid,catname) VALUES (54,'Reference'); INSERT INTO top_cats (cid,catname) VALUES (55,'Religion'); INSERT INTO top_cats (cid,catname) VALUES (56,'Romantic'); INSERT INTO top_cats (cid,catname) VALUES (57,'Screensavers'); INSERT INTO top_cats (cid,catname) VALUES (58,'Search engines'); INSERT INTO top_cats (cid,catname) VALUES (59,'Shopping'); INSERT INTO top_cats (cid,catname) VALUES (60,'Software'); INSERT INTO top_cats (cid,catname) VALUES (61,'Sports'); INSERT INTO top_cats (cid,catname) VALUES (62,'Star Trek'); INSERT INTO top_cats (cid,catname) VALUES (63,'Star Wars'); INSERT INTO top_cats (cid,catname) VALUES (64,'Sweepstakes'); INSERT INTO top_cats (cid,catname) VALUES (65,'Telecom'); INSERT INTO top_cats (cid,catname) VALUES (66,'Top Websites'); INSERT INTO top_cats (cid,catname) VALUES (67,'Travel'); INSERT INTO top_cats (cid,catname) VALUES (68,'Videogames'); INSERT INTO top_cats (cid,catname) VALUES (69,'Wallpapers'); INSERT INTO top_cats (cid,catname) VALUES (70,'Web Promotion'); INSERT INTO top_cats (cid,catname) VALUES (71,'Webcams'); INSERT INTO top_cats (cid,catname) VALUES (72,'Webdesign'); INSERT INTO top_cats (cid,catname) VALUES (73,'Webdevelopment'); INSERT INTO top_cats (cid,catname) VALUES (74,'Webhosting'); INSERT INTO top_cats (cid,catname) VALUES (75,'Webmasters'); INSERT INTO top_cats (cid,catname) VALUES (76,'Women') ; CREATE TABLE top_hits ( sid int(11), ip varchar(20), cdate timestamp(8) ); CREATE TABLE top_user ( sid int(11) NOT NULL auto_increment, banner varchar(255), bannerw int(11), bannerh int(11), title varchar(255), description varchar(255), rank int(11) DEFAULT '0' NOT NULL, votes int(11) DEFAULT '0' NOT NULL, status enum('Y','N') DEFAULT 'N' NOT NULL, name varchar(255), email varchar(255), password varchar(255), url varchar(255), linkback varchar(255), thin int(11) DEFAULT '0' NOT NULL, thout int(11) DEFAULT '0' NOT NULL, category int(11), stars enum('0','1','2','3','4','5') DEFAULT '0' NOT NULL, country varchar(100), PRIMARY KEY (sid) ); CREATE TABLE top_review ( rid int(11) NOT NULL auto_increment, name varchar(20), email varchar(40), review text, sid int DEFAULT 0 NOT NULL, rating tinyint DEFAULT 0 NOT NULL, postdate timestamp(8), postip varchar(16), PRIMARY KEY (rid) );

Posted by xdonald, 08-23-2007, 03:35 PM
Okay... SO where do I enter all of that into? I'm not good at using, so I need details.

Posted by Steve_Arm, 08-23-2007, 03:36 PM
Log in to phpMyAdmin from control panel, select the topsite database click the SQL tab and copy paste the queries.

Posted by xdonald, 08-23-2007, 03:43 PM
I got this: SQL query: INSERT INTO top_cats( cid, catname ) VALUES ( 32, 'Horoscopes' ) INSERT INTO top_cats( cid, catname ) VALUES ( 33, 'Hotels' ) ; MySQL said: http://www.webhostingtalk.com/./them...img/b_help.png #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO top_cats (cid,catname) VALUES (33,'Hotels')' at line 2

Posted by Steve_Arm, 08-23-2007, 03:48 PM
Yes missing semi-colon INSERT INTO top_cats (cid,catname) VALUES (33,'Hotels');

Posted by xdonald, 08-23-2007, 03:54 PM
Okay, now it works! Thanks So MUCH!

Posted by Steve_Arm, 08-23-2007, 03:56 PM
Great. Good luck!

Posted by killapix, 08-23-2007, 04:04 PM
Great congratulations...

Posted by xdonald, 08-23-2007, 05:17 PM
Now I have another problem, if you try to submit a site, it doesn't go through. I don't get an email nor does anything appear in the validation of the admin area. Plus I didn't want to show the categories, so I deleted it from the submittion page. Does that effect anything? http://www.truedreamz.net/topsites/add.php



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Lightbox code with css (Views: 727)
Virpus Networks (Views: 757)


Language: