Jump to content

fairyfan

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://pixie-bob.us
  • Yahoo
    motorcitypixies

Profile Information

  • Gender
    Not Telling
  • Location
    Somewhere out there

fairyfan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here is the code from ad_config.php / ad_installer.php ad_config.php <?php /* ******************************************** */ /* ******** JMK Advertisement Rotator ********* */ /* ******************************************** */ /* Released under the GPL license: */ /* http://www.gnu.org/copyleft/gpl.html */ /* ad_config.php: Configuration file */ // MySQL Information $hostname = \"localhost\"; $username = \"xxxxxx_xxxxxx\"; $password = \"xxxxxx\"; $database = \"xxxxxx_jmkads\"; $banner_table = \"jmk_ads_xxxxxx\"; // Table where all info will be stored. $client_table = \"jmk_ads_xxxxxx\"; // The owners of banners and their login info $pos_table = \"jmk_ads_xxxxxx\"; // Small table with positions for // circular rotation // Administration password $admin_password = \"xxxxxxxxxxxxxx\"; // The path where the JMK Advertisement Rotator images are found. Remember // the trailing slash at the end. $img_dir = \"images/\"; // Location of ad_click.php in the web $redir = \"http://www.mysite.com/jmkads/ad_click.php\"; // Default banner, to show if error occurs (e.g. no banners in database) // This could be sth saying \"Advertise on our site\" for example $default_banner = \"http://www.mysite.com/banner.gif\"; $default_url = \"http://www.mysite.com/\"; // Webmaster, in case of error: $webmaster = \"webmaster@mysite.com\"; // Redir site in case of error: $redir_site = \"http://www.mysite.com/\"; // Message to put under advertisement. leave blank for no message $message = \"\"; /* ########################################################## * The config section has ended. Common functions used by all * programs follow. You don\'t need to change them * ########################################################## */ $dbh=mysql_connect(\"localhost\",\"xxxxxx_xxxxxx\",\"xxxxxxxx\") or die (\'cannot connect to the database because: \'.mysql_error()); mysql_select_db (\"xxxxxxx_jmkads\"); ?> ad_installer.php <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"> <?php require \"ad_config.php\" ?> <HTML> <HEAD> <TITLE>JMK Advertisement Rotator Installation</TITLE> <META NAME=\"GENERATOR\" CONTENT=\"Bluefish - bluefish.openoffice.nl\"> <META NAME=\"AUTHOR\" CONTENT=\"Dimitris Batis\"> </HEAD> <BODY BACKGROUND=\"<? echo $img_dir; ?>background.gif\" TEXT=\"#000000\" LINK=\"#007bff\" VLINK=\"#007bff\" ALINK=\"#007bff\" TOPMARGIN=\"0\" LEFTMARGIN=\"0\" MARGINHEIGHT=\"0\" MARGINWIDTH=\"0\"> <BR> <IMG SRC=\"<? echo $img_dir; ?>logo.gif\" ALT=\"JMK Advertisement Rotator\"> <TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" WIDTH=\"700\"> <TR> <TD WIDTH=\"10\"><IMG SRC=\"<? echo $img_dir; ?>empty.gif\" HEIGHT=\"20\" WIDTH=\"1\"></TD> <TD WIDTH=\"140\" COLSPAN=\"2\"><IMG SRC=\"<? echo $img_dir; ?>empty.gif\"></TD> <TD ALIGN=\"LEFT\" VALIGN=\"TOP\" WIDTH=\"550\"> <H1><FONT FACE=\"Times New Roman, Helvetica\" COLOR=\"#005DFF\">Installation</FONT></H1> </TD> <TR> <TD WIDTH=\"5\"><IMG SRC=\"<? echo $img_dir; ?>empty.gif\"></TD> <TD WIDTH=\"125\" ALIGN=\"LEFT\" VALIGN=\"TOP\"> <?php if($QUERY_STRING == \"\"): ?> <FONT SIZE=\"2\"><B>First step:</B><BR> Configuring the script\'s settings and preferences </FONT></TD> <TD WIDTH=\"20\"><IMG SRC=\"<? echo $img_dir; ?>empty.gif\"></TD> <TD ALIGN=\"LEFT\" VALIGN=\"TOP\" WIDTH=\"550\"> Thank you for trying out JMK Advertisement Rotator. This script will guide you through the installation procedure. Most of the job is done by the script itself, so you need not worry. I\'ve made this script easy enough so that you only need to know a few basic PHP stuff and nothing more. <P>The first thing you need to do is change the variable values of <I>ad_config.php</I>. This file contains all the variables that are nessecary to be set for the script to function correctly. These variables concern the communication with the MySQL database, as well as how the script will display the banners. So, let\'s have a look at the variables and their usage. <P><FONT SIZE=\"+1\"><B>ad_config.php</B> variables:</FONT> <P><I>$hostname, $username, $password, $database</I>:<BR> These variables are used when connecting with the MySQL database server. The <I>$username</I> and <I>$password</I> variables are your username and password for the MySQL database (and they don\'t have to do with your login info). If you haven\'t set a password for MySQL, you can set $password to \"\". You don\'t have to worry about passwords stored in the database, since they are automaticly encrypted. <I>$hostname</I> is usually \"localhost\" and in case you don\'t know what its value should be, just leave it \"localhost\", it will usually work. The database in which <I>$database</I> points <B>must already exist</B>. <P><I>$banner_table, $client_table, $pos_table</I>:<BR> These are the names of the tables used by JMK Advertisement Rotator. Unless the default tables already exist (most unlikely), you can change their name. Under normal circumstances, you can just leave these variables as they are. <P><I>$admin_password</I>:<BR> This is the password you need to enter in order to gain access to the administration menu. <P><I>$img_dir</I>:<BR> The path where the script\'s images are found. Remember to add the trailing slash at the end. Example: \"images/\". <P><I>$redir</I>:<BR> This variable should always point to the URL of ad_click.php. It is important to notice that we need the URL (i.e. its place on the web), not its local path. <P><I>$default_banner, $default_url</I>:<BR> This should point to a banner that would appear in case an error occurs. This way, your site won\'t look ugly with an error message, instead a banner (which could say, for example, \"Advertise in our site\") appears. The URL is where the client goes when he clicks the default banner. <P><I>$webmaster</I>:<BR> This should be changed to your e-mail adress. In case of an error, an e-mail will be sent to you. <P><I>$redir_site</I>:<BR> In case there is an error in ad_click.php (i.e. when the user clicks the banner), this site appears. <P><I>$message</I>:<BR> Unless blank, this message appears just below the ad banner. <P>You need not change anything that follows in ad_config.php. If you\'ve done these changes, you can process with installation by clicking the link below, and the script will check the validity of the first pack of variables that deal with the database. <P><A HREF=\"<?php echo $PHP_SELF; ?>?step2\">Done with ad_config.php, go to step 2</A>. </TD></TR> <?php elseif($QUERY_STRING == \"step2\"): ?> <FONT SIZE=\"2\"><B>Second step:</B><BR> Checking validity of data and creating tables. </FONT></TD> <TD WIDTH=\"20\"><IMG SRC=\"<? echo $img_dir; ?>empty.gif\"></TD> <TD ALIGN=\"LEFT\" VALIGN=\"TOP\" WIDTH=\"550\"> <?php // First, let\'s test if the settings are OK and communication with MySQL is achievable. $db = connect_to_db(); <--------im sure this is the problem if($db == 0) { echo \"The script tried to connect to the MySQL database, <B>however</B> it was impossible to establish connection.n\"; echo \"There are two cases why this happened. The first is that the MySQL server is not open. The second\"; echo \" case is that you haven\'t set ad_config.php variables correctly. Please, check the variables again.n\"; echo \"<P><A HREF=\"\",$PHP_SELF,\"?step2\">Re-check MySQL connection.</A>n\"; echo \"<P><A HREF=\"\",$PHP_SELF,\"\">Go back to step 1.</A>n\"; } else { echo \"The script tried to connect to the MySQL database and the attemp was successful!n\"; echo \"<P>You can now head to the final step of the installation, which will create the nessecary tables in MySQL database.n\"; echo \"<P><A HREF=\"\",$PHP_SELF,\"?step3\">Process with table creation and finish.</A>n\"; } ?> </TD></TR> <?php elseif($QUERY_STRING == \"step3\"): ?> <FONT SIZE=\"2\"><B>Final step:</B><BR> Creation of tables. </FONT></TD> <TD WIDTH=\"20\"><IMG SRC=\"<? echo $img_dir; ?>empty.gif\"></TD> <TD ALIGN=\"LEFT\" VALIGN=\"TOP\" WIDTH=\"550\"> <?php $db = connect_to_db(); $query = mysql_query(\"CREATE TABLE $client_table (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(80), email VARCHAR(80), login CHAR(10), passwd CHAR(16), info TEXT);\"); if(!$query) { echo \"Unable to create $client_table table. Table may already exist. Installation has stopped.n\"; echo \"</TD></TR></TABLE></BODY></HTML>n\"; exit; } $query = mysql_query(\"CREATE TABLE $banner_table (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), status ENUM(\'ok\', \'expired\'), title VARCHAR(80), url VARCHAR(160) NOT NULL, image_url VARCHAR(160) NOT NULL, alt_text TEXT, banner_group VARCHAR(80), client_id INT NOT NULL, width CHAR(5), height CHAR(5), expiration_date DATE, expiration_displays INT UNSIGNED, expiration_clicks INT UNSIGNED, displays_life BIGINT UNSIGNED NOT NULL, displays_day INT UNSIGNED NOT NULL, clicks_life BIGINT UNSIGNED NOT NULL, clicks_day INT UNSIGNED NOT NULL);\"); if(!$query) { echo \"Unable to create $banner_table table. Table may already exist. Installation has stopped.n\"; echo \"</TD></TR></TABLE></BODY></HTML>n\"; exit; } $query = mysql_query(\"CREATE TABLE $pos_table (title CHAR(80) NOT NULL DEFAULT \'\', PRIMARY KEY(title), position INT NOT NULL DEFAULT 0);\"); if(!$query) { echo \"Unable to create $pos_table table. Table may already exist. Installation has stopped.n\"; echo \"</TD></TR></TABLE></BODY></HTML>n\"; exit; } ?> The installation has been successfully finished! <P>You can now start the administration of the banner system using <A HREF=\"ad_admin.php\">ad_admin.php</A> file. The login password was set in variable $admin_password in ad_config.php. You can also delete this file, ad_installer.php, if you like, but it cannot create any damage to you or your banner database, so you need not worry. <P>Thank you for using JMK Advertisement Rotator and hope you are satisfied. Enjoy! </TD></TR> <?php endif; ?> </TABLE> <P><CENTER><FONT SIZE=\"-1\">Copyright © 2001, Dimitris Batis</FONT></CENTER> </BODY> </HTML> Sorry for the post being so long just wanted you to see the original code and the code I have. Thanks so much, I am trying like heck to get at least one database to work in hopes I can get some other programs that require it to work.
  2. First Shiv <bowing to your greatness> Thanks! I am going nuts. I havent been able to connect to a DB for 2 months!. I dont think its me either??? I didnt write that function my sorry webhost \"support\" dude wrote it. The fact that he wrote it there and no where else would so not surprise me. Here goes my best possible explanation of what I have; script consists of: ad.php ad_admin.php ad_installer.php ad_click.php ad_config.php ad_client.php ad_installer.php is where the error is occurring when trying to connect because it doesnt understand the function my \"host support\" put in there. Here is a link to the \"original\" script (*NOTE - all the changes to the script were done via my \"host support person\". They first said the script was trying to connect to the wrong .sock. Now this) http://www.ravencrypt.com/scripts/scripts.html Scroll down to the Banner rotator script. Ps. If you know of another good banner script that allows client to view stats on thier banner and wont be a huge pain in my arse like this one, please send me there cuz this is rediculous. Though I think its my host not the script since this is the 5th banner script I have tried and failed :evil:
  3. I keep getting a fatal error : Fatal error: Call to undefined function: connect_to_db() in /home/user/public_html/script/scripts.php on line 96 Starting at line 96 this is the code: $db = connect_to_db(); if($db == 0) { echo \"The script tried to connect to the MySQL database, <B>however</B> it was impossible to establish connection.n\"; echo \"There are two cases why this happened. The first is that the MySQL server is not open. The second\"; echo \" case is that you haven\'t set ad_config.php variables correctly. Please, check the variables again.n\"; echo \"<P><A HREF=\"\",$PHP_SELF,\"?step2\">Re-check MySQL connection.</A>n\"; echo \"<P><A HREF=\"\",$PHP_SELF,\"\">Go back to step 1.</A>n\"; } So if its not connect_to_db() what would it be?
  4. This is the command line on line 55 if(!($mysql = mysql_connect($hostname, $username, $password)) maybe that will shed some extra light? :?
  5. I cannot connect to ANY database I make in the CPanel. Here is all the info: hostname - Localhost user - xxxxx_xxxxxx pass - xxxxxx db name - xxxxx_dbname error message via the script (auto table set up script -the script is trying to creat tables using the above user/pass) This is a php script that auto installs tables in the db for you. Now I do everything via my Control Panel on Linux. I dont think I need to give privilages (there is no spot on the Cpanel to do so either) as they are there if I try to create tables by hand via phpmyadmin. ::Installation :: Second step: Checking validity of data and creating tables. Warning: mysql_connect() [function.mysql-connect]: Can\'t connect to local MySQL server through socket \'/var/tmp/mysql.sock\' (2) in /home/username/public_html/script/scriptcall.php on line 55 The script tried to connect to the MySQL database, however it was impossible to establish connection. There are two cases why this happened. The first is that the MySQL server is not open. The second case is that you haven\'t set scriptcall.php variables correctly. Please, check the variables again Now I know the above variables are correct Now if I change the variables to the following: hostname - www.my-site.com user - xxxxx_xxxxx pass - xxxxx db name - xxxxx_dbname This is the error I get: Installation Second step: Checking validity of data and creating tables. Warning: mysql_connect() [function.mysql-connect]: Access denied for user: \'xxxxx-xx_xxxxx@ip address\' (Using password: YES) in /home/username/public_html/script/scriptcall.php on line 55 The script tried to connect to the MySQL database, however it was impossible to establish connection. There are two cases why this happened. The first is that the MySQL server is not open. The second case is that you haven\'t set scriptcall.php variables correctly. Please, check the variables again. Without giving out all my info here I hope I have given some of you sql gurus enough to go on as to why this is happening. Also, I dont think my hosting company is allowing me \"root\" access to the sql server. I am on a reseller acct. with WHM and can restart sql server but I dont know that I can do much more than that. Thanks you guys Kerr
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.