Help with script.

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
Hello I have recived a script from a friend of mine to set up for him and was wondering how to get it working on his site.
The script he has is for a PTC (Pay to click) site.

The readme file includes
- create the table with the database.txt dump info
- modify the config.php and /admin/config.php files
- Upload all the files
- Configure Paypal email and sitename from administration
- Default account for admin section is
user: admin
pass: ******


The config files say.
<?php
// Database configuration
$bd_host = "localhost";
$bd_usuario = "username";
$bd_password = "pass";
$bd_base = "database";
$url = "http://www.yoursitehere.com";
$con = mysql_connect($bd_host, $bd_usuario, $bd_password); mysql_select_db($bd_base, $con);
?>


If any one could help me and tell me how to create this and get it working the help would be appreciated.

THank you.
 

garrettroyce

Community Support
Community Support
Messages
5,611
Reaction score
249
Points
63
Using CPanel go to MySQL Database Wizard.

Create database using whatever name you want. It will be named like username_dbname where username is your CPanel login and dbname is what you typed in the box. Next, create a user with whatever name you want. Again, it will be like username_user. Set the password. Give the user all privileges on the next section.

Then, add the information you just created to the php file.
 

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
For the database you can't use under scores and what box are you talking about exactly.
 

garrettroyce

Community Support
Community Support
Messages
5,611
Reaction score
249
Points
63
the underscores are automatic. For example, if you type in: database, your database name is username_database where "username" is your cpanel user name. The box is the one that says "new database" Make sure you use the MySQL wizard and not MySQL databases tool. They have the same icon.
 

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
sorry never mind about that last bit
but what do i do after i create the database where do i put the information from the php file
 
Last edited:

garrettroyce

Community Support
Community Support
Messages
5,611
Reaction score
249
Points
63
edit the php file like this:
Code:
<?php
// Database configuration
$bd_host = "localhost"; // [B]leave this the same[/B]
$bd_usuario = "username"; // [B]change this to the database name, example: username_user[/B]
$bd_password = "pass"; // [B]password for username_user[/B]
$bd_base = "database"; // [B]database you created, example: username_database[/B]
$url = "http://www.yoursitehere.com"; // [B]this is the url of your site, example: http://site.x10hosting.com[/B]
$con = mysql_connect($bd_host, $bd_usuario, $bd_password);
mysql_select_db($bd_base, $con);
?>
 
Last edited:

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
where do i upload what do i upload all of the files to public_html
is it ok if .php files are in here
 

batman1

New Member
Messages
92
Reaction score
0
Points
0
upload all the files but the config file.

Login you server control panel.

Use the database panel to Create a MYSQL:

1. database - example "mysite_accounts"
2. username - example "mysite_john"
3. password - example "VcggTf23"

add the user to the database

edit the config files info

$bd_host = "localhost";
$bd_usuario = "mysite_john";
$bd_password = "VcggTf23";
$bd_base = "mysite_accounts";

save and upload the config file. Done
 
Last edited:

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
thank you both for the help.
now i have a new problem if you look at my site it is all full of errors like this Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/stuart10/public_html/index.php on line 12

do i need to change all the php files to work with the database ?
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
...

The readme file includes
- create the table with the database.txt dump info

After creating the database / user /pass and giving privileges, did you create the table with the database.txt dump?
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
Please post the first 10 ~ 15 lines of database.txt file.
 

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
-- phpMyAdmin SQL Dump
-- version 2.8.1
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 18-01-2008 a las 07:01:20
-- Versión del servidor: 5.0.21
-- Versión de PHP: 5.1.4
--
-- Base de datos: `22`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tb_ads`
--
CREATE TABLE `tb_ads` (
`id` int(11) NOT NULL auto_increment,
`user` varchar(150) collate latin1_general_ci NOT NULL,
`ip` varchar(15) collate latin1_general_ci NOT NULL,
`tipo` varchar(150) collate latin1_general_ci NOT NULL,
`visitime` varchar(150) collate latin1_general_ci NOT NULL,
`ident` varchar(150) collate latin1_general_ci NOT NULL,
`fechainicia` varchar(150) collate latin1_general_ci NOT NULL,
`paypalname` varchar(150) collate latin1_general_ci NOT NULL,
`paypalemail` varchar(150) collate latin1_general_ci NOT NULL,
`plan` varchar(150) collate latin1_general_ci NOT NULL,
`bold` varchar(150) collate latin1_general_ci NOT NULL,
`highlight` varchar(150) collate latin1_general_ci NOT NULL,
`url` varchar(150) collate latin1_general_ci NOT NULL,
`description` varchar(150) collate latin1_general_ci NOT NULL,
`category` varchar(150) collate latin1_general_ci NOT NULL,
`members` varchar(150) collate latin1_general_ci NOT NULL default '0',
`outside` varchar(150) collate latin1_general_ci NOT NULL default '0',
`total` varchar(150) collate latin1_general_ci NOT NULL default '0',
KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=29 ;
--
-- Volcar la base de datos para la tabla `tb_ads`
--
INSERT INTO `tb_ads` VALUES (1, '', '', 'ads', '', '', '1195231256', '', 'lizaaard@gmail.com', '10000', '1', '1', 'http://www.yourownbux.info', 'Categoria 1', '1', '5', '0', '0');
INSERT INTO `tb_ads` VALUES (3, '', '', 'ads', '', '', '1195231395', '', 'nico@nico.com', '1000', '1', '1', 'http://hola.com', 'Categoria 2', '2', '1', '0', '0');
INSERT INTO `tb_ads` VALUES (6, '', '', 'ads', '', '', '1195493883', '', 'admin', '1000', '', '', 'http://wwwwwww.asdasdasd.comasdasdada', 'Categoria 3', '3', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (7, '', '', 'ads', '', '', '1195494307', '', 'admin', '1000', '', '', 'http://wwwwwww.asdasdasd.comasdasdada', 'Categoria 4', '4', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (8, '', '', 'ads', '', '', '1195494452', '', 'admin', '1000', '', '', 'http://wwwwwww.asdasdasd.comasdasdada', 'Categoria 5', '5', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (9, '', '', 'ads', '', '', '1195499546', '', '1', '30000', '1', '', '1', 'Categoria 6', '6', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (10, '', '', 'ads', '', '', '1195499547', '', '1', '30000', '1', '', '1', 'Categoria 7', '7', '1', '0', '0');
INSERT INTO `tb_ads` VALUES (11, '', '', 'ads', '', '', '1195499548', '', '1', '500', '', '', 'http://wwwwwwwwwwwwwwwwwwwwwww.comomo', 'Categoria 8', '8', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (12, '', '', 'ads', '', '', '1195499621', '', 'admin', '1000', '', '', '9', 'Categoria 9', '9', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (13, '', '', 'ads', '', '', '1195499622', '', 'admin', '1000', '', '', '10', 'Categoria 10', '10', '1', '1', '0');
INSERT INTO `tb_ads` VALUES (22, 'sol', '', 'visit', '1195673371', '21', '', '', '', '', '', '', '', '', '', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (23, 'admin', '', 'visit', '1196562956', '1', '', '', '', '', '', '', '', '', '', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (24, 'admin', '', 'ads', '', '', '', '', '', '1000', '1', '1', 'http://www.psiscofxp.com', 'PsicoFxp', '1', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (25, 'sol', '', 'visit', '1197057471', '1', '', '', '', '', '', '', '', '', '', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (26, '', '', 'ads', '', '', '1197057485', '', 'lizaaard@gmail.com', '30000', '1', '', 'http://www.www.com', 'asdaaa', '7', '0', '0', '0');
INSERT INTO `tb_ads` VALUES (27, '', '', 'ads', '', '', '1197057540', '', 'hola@qweqwe.com', '100000', '', '', 'http://www.lolaa.com', 'lolaaa', '1', '2', '1', '0');
INSERT INTO `tb_ads` VALUES (28, 'admin', '', 'visit', '1200639022', '27', '', '', '', '', '', '', '', '', '', '0', '0', '0');
-- --------------------------------------------------------
 

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
attached is the databasefile that came with the scripts
 

Attachments

  • database.txt.txt
    16.1 KB · Views: 105

gomarc

Member
Messages
516
Reaction score
18
Points
18
Go to cPanel > phpMyAdmin , select your database. At the top click on the Import tab.

In the Location of the text file browse to database.txt and then click on Go.

Wait a few seconds and see if your table was created.
 

stuart1010

New Member
Messages
32
Reaction score
0
Points
0
i get
Error

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Invalid Identifer @ 167STR: 5.0.SQL: the database files txt
 

garrettroyce

Community Support
Community Support
Messages
5,611
Reaction score
249
Points
63
I think you can delete everything after this line:

--
-- Volcar la base de datos para la tabla `tb_ads`
--

To me, all this data looks like you don't need it.
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
Just tested the Import in an empty database and got no errors.

This import dump will try to create 15 new tables and will give you an error if any of the tables it’s trying to create already exist.

Try again in a new empty database.
 

supermix

New Member
Messages
30
Reaction score
0
Points
0
you used 'admin' as a mysql connect argument. try using yourcpanelname_admin.

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: YES) in /home/stuart10/public_html/dbconnect.php on line 1

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'stuart10'@'localhost' (using password: NO) in /home/stuart10/public_html/dbconnect.php on line 1

Try to fix this error maybe this is the only problem.

If you created the database manually from phpMyAdmin then use what ever username you created to login not the stuart10 or the admin.
 
Last edited:
Top