Jump to content

PHP connection string


dguilloryjr

Recommended Posts

I am setting up a dev site on our server, this is my 1st time working with linux, so i got the cpanel control panel put on our server.

 

I setup the website (www.live8081.com) and i get a error, but when i go to MySQL Database my php connection string looks like this...

 

PHP

 

$dbh=mysql_connect ("localhost", "live8081_simmysq", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());

mysql_select_db ("live8081_directory"); 

 

so any idea when this is and how i can fix it...

YOu have to fill in your password, unless your password is <PASSWORD HERE>. I like to set mine up with variables just so it is easy to see what they are quickly. many ways you can do it.

 

 

<?php
$db_host = "localhost";
$db_username = "user1";
$db_password = "pass1";
$database = "database1";


$db = mysql_connect($db_host, $db_username, $db_password)
           or die('Could not connect: ' . mysql_error());

mysql_select_db($database) or die('Could not select database');
?>

 

Snowdog

please bear with me i am NO php expert like most of the people here

 

Below is the code that is in that file

 

# DATABASE CONNECTION PARAMETERS

# ----------------------------------------------------------------------------------------------------

define(DEFAULT_DB,         "DIRECTORYDB");

define(_DIRECTORYDB_HOST,  "localhost");

define(_DIRECTORYDB_USER,  "live8081_simmysq");

define(_DIRECTORYDB_PASS,  "q13cz2");

define(_DIRECTORYDB_NAME,  "live8081_directory");

define(_DIRECTORYDB_EMAIL, "[email protected]");

define(_DIRECTORYDB_DEBUG, "display");

 

allso attached is a pic of my MySQL Section of my cPanel

 

[attachment deleted by admin]

I don't know if anyone else noticed this, but having that access info for your database posted in a public forum is not a good idea. I'd change that asap. Am I wrong?

And is 'localhost' for the database server possible? I guess if it was local, oh, sorry. I'm thinking it's on a website.

Hop

All you have to do is put your password (I marked it out in red) into your code. I would recommend that you change your usernam/password since you just posted it into a public forum. I would hope none of the fine people here would do anything !!

 

$dbh=mysql_connect ("localhost", "live8081_simmysq", "[color=red]q13cz2[/color]") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("live8081_directory");  

 

 

Snowdog

what file would this be in because its NOT on this file config.inc.php

 

here is the complete code for that file:

 

\*==================================================================*/

 

# ----------------------------------------------------------------------------------------------------

# * FILE: /conf/config.inc.php

# ----------------------------------------------------------------------------------------------------

 

# ----------------------------------------------------------------------------------------------------

# define EDIRECTORY_ROOT to set things in motion.

# ----------------------------------------------------------------------------------------------------

define(EDIRECTORY_ROOT, $_SERVER["DOCUMENT_ROOT"]);

 

# ----------------------------------------------------------------------------------------------------

# DEFAULT URL

# ----------------------------------------------------------------------------------------------------

define(DEFAULT_URL, "http://".$_SERVER["HTTP_HOST"]."/");

 

# ----------------------------------------------------------------------------------------------------

# DIRECTORY PATH DEFINITIONS

# ----------------------------------------------------------------------------------------------------

define(ADMIN_EDIRECTORY_ROOT, EDIRECTORY_ROOT."/admin");

define(SM_EDIRECTORY_ROOT, EDIRECTORY_ROOT."/sitemgr");

 

# ----------------------------------------------------------------------------------------------------

# DATABASE CONNECTION PARAMETERS

# ----------------------------------------------------------------------------------------------------

define(DEFAULT_DB,        "DIRECTORYDB");

define(_DIRECTORYDB_HOST,  "localhost");

define(_DIRECTORYDB_USER,  "live8081_wwwmysi");

define(_DIRECTORYDB_PASS,  "arca7");

define(_DIRECTORYDB_NAME,  "wwwmysi_directory");

define(_DIRECTORYDB_EMAIL, "[email protected]");

define(_DIRECTORYDB_DEBUG, "display");

 

# ----------------------------------------------------------------------------------------------------

# SITE MANAGER CONSTANTS

# ----------------------------------------------------------------------------------------------------

define(SM_LOGIN_PAGE,  DEFAULT_URL."sitemgr/login.php");

define(SM_LOGOUT_PAGE, DEFAULT_URL."sitemgr/logout.php");

define(PERSONAL_EDIRECTORY_ROOT, EDIRECTORY_ROOT."/personal");

# ----------------------------------------------------------------------------------------------------

# ADMIN CONSTANTS

# ----------------------------------------------------------------------------------------------------

define(ADMIN_LOGIN_PAGE,  DEFAULT_URL."admin/login.php");

define(ADMIN_LOGOUT_PAGE, DEFAULT_URL."admin/logout.php");

 

# ----------------------------------------------------------------------------------------------------

        # PERSONAL CONSTANTS

        # ----------------------------------------------------------------------------------------------------

        define(PERSONAL_LOGIN_PAGE,  DEFAULT_URL."personal/login.php");

        define(PERSONAL_LOGOUT_PAGE, DEFAULT_URL."personal/logout.php");

 

 

# ----------------------------------------------------------------------------------------------------

# CONSTANTS

# ----------------------------------------------------------------------------------------------------

define(VERSION, "v.4.1");

define(INCLUDES_DIR, EDIRECTORY_ROOT."/includes");

define(CLASSES_DIR, EDIRECTORY_ROOT."/classes"); 

define(FUNCTIONS_DIR, EDIRECTORY_ROOT."/functions");

define(DEFAULT_DAYS_TO_EXPIRE, 60);

define(IMAGE_DIR, EDIRECTORY_ROOT."/upload/image_files");

define(IMAGE_URL, "/upload/image_files");

define(EDIRECTORY_TITLE, "MySimBook.com");

define(MAX_KEYWORDS, 10);

 

 

//--------------------------------------------------------------------------------------

//sitemgr email support

//--------------------------------------------------------------------------------------

$host = _DIRECTORYDB_HOST;

$db = _DIRECTORYDB_NAME;

$user = _DIRECTORYDB_USER;

$pass = _DIRECTORYDB_PASS;

$link = mysql_connect($host, $user, $pass);

mysql_select_db($db);

$sql_setting = "SELECT * FROM Setting";

$result_setting = mysql_query($sql_setting, $link);

while($row_setting = mysql_fetch_assoc($result_setting)){

$name_setting = $row_setting["name"];

if ($name_setting == "sitemgr_support_email") {

$sitemgr_support_email = $row_setting["value"];

}

}

define(EDIRECTORY_EMAIL, $sitemgr_support_email);

//--------------------------------------------------------------------------------------

 

# ----------------------------------------------------------------------------------------------------

# FLAGS - on/off

# ----------------------------------------------------------------------------------------------------

define(ZIPCODE_PROXIMITY, "on");

define(EVENT_FEATURE, "off");

define(BANNER_FEATURE, "on");

define(CLASSIFIED_FEATURE, "off");

 

# ----------------------------------------------------------------------------------------------------

# USER ATRIBUTES

# ----------------------------------------------------------------------------------------------------

define(USERNAME_MAX_LEN, 20); // don't forget to verify the field in DB

define(PASSWORD_MAX_LEN, 50); // don't forget to verify the field in DB

 

# ----------------------------------------------------------------------------------------------------

# MOD REWRITE CONSTANTS

# ----------------------------------------------------------------------------------------------------

define(MR_COUNTRY_PLACEHOLDER, "International");

define(MR_STATE_PLACEHOLDER, "Local");

define(MR_CITY_PLACEHOLDER, "Online");

define(MR_CATEGORY_PLACEHOLDER, "Eletronic");

define(MR_SUBCATEGORY_PLACEHOLDER, "Directory");

 

# ----------------------------------------------------------------------------------------------------

# PAYPAL AND PAYMENT CONSTANTS

# ----------------------------------------------------------------------------------------------------

//define(PAYPAL_URL_FOLDER, "/cgi-bin/webscr");

//define(PAYPAL_URL, "www.sandbox.paypal.com");

//define(PAYPAL_URL, "www.paypal.com");

//define(PAYPAL_ACCOUNT, "[email protected]");

//define(PAYPAL_ACCOUNT, "[email protected]");

//define(PAYPAL_CURRENCY, "USD");

//define(PAYPAL_LC, "US");

 

define(FREE_CATEGORIES, 1);

define(FREE_CATEGORIES_LABEL, "One");

 

# ----------------------------------------------------------------------------------------------------

  # LINKPOINT PAYMENT CONSTANTS

  # ----------------------------------------------------------------------------------------------------

  /* arquivo encriptado para testes da arca */

  //define(LINKPT_KEYFILE, "./1909740134.pem");

  /* arquivo encriptado do cliente */

  define(LINKPT_KEYFILE, "./1028062.pem");

  /* chave de testes da arca */

  //define(LINKPT_CONFIGFILE, "1909740134");

  /* chave do cliente */

  define(LINKPT_CONFIGFILE, "1028062");

  /* link de testes */

  //define(LINKPT_HOST, "staging.linkpt.net");

  /* link definitivo - usar somente no live */

  define(LINKPT_HOST, "secure.linkpt.net");

  /* numero da porta */

  define(LINKPT_PORT, "1129"); // all

# ----------------------------------------------------------------------------------------------------

# REPORTS CONSTANTS

# ----------------------------------------------------------------------------------------------------

define(REPORTS_SUMMARY_VIEW, 1);

define(REPORTS_DETAIL_VIEW,  2);

define(REPORTS_CLICK_THRU,  3);

define(REPORTS_EMAIL_SENT,  4);

 

# ----------------------------------------------------------------------------------------------------

# EMAIL NOTIFICATIONS CONSTANTS

# ----------------------------------------------------------------------------------------------------

define(RENEWAL_30, 1);

define(RENEWAL_7,  2);

define(RENEWAL_1,  3);

define(RENEWAL_15, 4);

define(SYSTEM_ACCOUNT_SIGNUP,  5);

define(SYSTEM_ACCOUNT_UPDATE,  6);

define(SYSTEM_FORGOTTEN_PASS,  7);

define(SYSTEM_NEW_ACCOUNT,    8);

define(SYSTEM_NEW_LISTING,    9);

define(SYSTEM_NEW_EVENT,      10);

 

# ----------------------------------------------------------------------------------------------------

# BANNER CONSTANTS

# ----------------------------------------------------------------------------------------------------

define(BANNER_REPORT_CLICKTHRU, 1);

define(BANNER_REPORT_VIEW,      2);

 

# ----------------------------------------------------------------------------------------------------

# CONFIG EXTENSIONS OR MODULES (IN CASE OF PROBLEMS CHECK FOR VARIABLES CONFLIT)

# ----------------------------------------------------------------------------------------------------

include_once(INCLUDES_DIR."/editor/config.php"); // html editor

 

# ----------------------------------------------------------------------------------------------------

# IMAGE PARAMETERS (keep the ratio)

# ----------------------------------------------------------------------------------------------------

# LISTING

define(IMAGE_LISTING_FULL_WIDTH,  240);

define(IMAGE_LISTING_FULL_HEIGHT,  200);

define(IMAGE_LISTING_THUMB_WIDTH,  150);

define(IMAGE_LISTING_THUMB_HEIGHT, 120);

# PROMOTION

define(IMAGE_PROMOTION_FULL_WIDTH,  500);

define(IMAGE_PROMOTION_FULL_HEIGHT,  700);

define(IMAGE_PROMOTION_THUMB_WIDTH,  200);

define(IMAGE_PROMOTION_THUMB_HEIGHT, 280);

# EVENT

define(IMAGE_EVENT_FULL_WIDTH,  180);

define(IMAGE_EVENT_FULL_HEIGHT,  150);

define(IMAGE_EVENT_THUMB_WIDTH,  120);

define(IMAGE_EVENT_THUMB_HEIGHT, 100);

# GALLERY

define(IMAGE_GALLERY_FULL_WIDTH,  500);

define(IMAGE_GALLERY_FULL_HEIGHT,  380);

define(IMAGE_GALLERY_THUMB_WIDTH,  132);

define(IMAGE_GALLERY_THUMB_HEIGHT, 100);

# CLASSIFIED

define(IMAGE_CLASSIFIED_CATEGORY_WIDTH,  80);

define(IMAGE_CLASSIFIED_CATEGORY_HEIGHT,  80);

define(IMAGE_CLASSIFIED_LARGE_WIDTH,    500);

define(IMAGE_CLASSIFIED_LARGE_HEIGHT,    500);

define(IMAGE_CLASSIFIED_MEDIUM_WIDTH,    250);

define(IMAGE_CLASSIFIED_MEDIUM_HEIGHT,  250);

define(IMAGE_CLASSIFIED_SMALL_WIDTH,    100);

define(IMAGE_CLASSIFIED_SMALL_HEIGHT,    100);

 

# ----------------------------------------------------------------------------------------------------

# INCLUDE GLOBAL CLASSES

# ----------------------------------------------------------------------------------------------------

include_once(CLASSES_DIR."/class_mysql.php");

include_once(CLASSES_DIR."/class_handle.php");

include_once(CLASSES_DIR."/class_status.php");

include_once(CLASSES_DIR."/class_level.php");

include_once(CLASSES_DIR."/class_approved.php");

include_once(CLASSES_DIR."/class_account.php");

include_once(CLASSES_DIR."/class_contact.php");

include_once(CLASSES_DIR."/class_editorChoice.php");

include_once(CLASSES_DIR."/class_emailNotification.php");

include_once(CLASSES_DIR."/class_listing.php");

include_once(CLASSES_DIR."/class_image.php");

include_once(CLASSES_DIR."/class_gallery.php");

include_once(CLASSES_DIR."/class_promotion.php");

include_once(CLASSES_DIR."/class_category.php");

include_once(CLASSES_DIR."/class_reports.php");

include_once(CLASSES_DIR."/class_listingChoice.php");

include_once(CLASSES_DIR."/class_locationCountry.php");

include_once(CLASSES_DIR."/class_locationState.php");

include_once(CLASSES_DIR."/class_locationRegion.php");

include_once(CLASSES_DIR."/class_locationCity.php");

include_once(CLASSES_DIR."/class_locationArea.php");

include_once(CLASSES_DIR."/class_urlQueryGenerator.php");

include_once(CLASSES_DIR."/class_thumbGenerator.php");

include_once(CLASSES_DIR."/class_xlsGenerator.php");

include_once(CLASSES_DIR."/class_formValidator.php");

include_once(CLASSES_DIR."/class_paymentLog.php");

include_once(CLASSES_DIR."/class_paymentListingLog.php");

include_once(CLASSES_DIR."/class_forgotPassword.php");

include_once(CLASSES_DIR."/class_pageBrowsing.php");

include_once(CLASSES_DIR."/class_content.php");

include_once(CLASSES_DIR."/class_tip.php");

include_once(CLASSES_DIR."/class_invoice.php");

include_once(CLASSES_DIR."/class_invoiceListing.php");

include_once(CLASSES_DIR."/class_invoiceStatus.php");

include_once(CLASSES_DIR."/class_banner.php");

include_once(CLASSES_DIR."/class_bannerReports.php");

include_once(CLASSES_DIR."/class_uploadFiles.php");

include_once(CLASSES_DIR."/class_rating.php");

include_once(CLASSES_DIR."/class_discountCodeStatus.php");

include_once(CLASSES_DIR."/class_discountCode.php");

include_once(CLASSES_DIR."/class_event.php");

include_once(CLASSES_DIR."/class_evCategory.php");

include_once(INCLUDES_DIR."/editor/editor_class.php"); // html editor

include_once(CLASSES_DIR."/class_classifiedCategory.php");

include_once(CLASSES_DIR."/class_classifiedLevel.php");

include_once(CLASSES_DIR."/class_classifiedListing.php");

include_once(CLASSES_DIR."/class_classifiedStatus.php");

        include_once(CLASSES_DIR."/class_carriers.php");

include_once(CLASSES_DIR."/class_listingCategory.php");

        include_once(CLASSES_DIR."/class_phonecontact.php");

        include_once(CLASSES_DIR."/class_messages.php");

        include_once(CLASSES_DIR."/class_simbooks.php");     

        include_once(CLASSES_DIR."/class_LogMessages.php");

include_once(CLASSES_DIR."/class_messagesadmin.php");

include_once(CLASSES_DIR."/class_preferred.php");

        include_once(CLASSES_DIR."/class_LogMessagesAdmin.php");

include_once(CLASSES_DIR."/class_PersonalAccount.php");

        include_once(CLASSES_DIR."/class_MessagesFriends.php");

        include_once(CLASSES_DIR."/class_Friends.php");

        include_once(CLASSES_DIR."/class_LogMessagesFriends.php");

        include_once(CLASSES_DIR."/class_FriendsGroup.php");

 

# ----------------------------------------------------------------------------------------------------

# INCLUDE GLOBAL FUNCTIONS

# ----------------------------------------------------------------------------------------------------

include_once(FUNCTIONS_DIR.'/db_funct.php');

include_once(FUNCTIONS_DIR.'/html_funct.php');

include_once(FUNCTIONS_DIR.'/validate_funct.php');

include_once(FUNCTIONS_DIR.'/search_funct.php');

include_once(FUNCTIONS_DIR.'/format_funct.php');

include_once(FUNCTIONS_DIR.'/image_funct.php');

include_once(FUNCTIONS_DIR.'/system_funct.php');

include_once(FUNCTIONS_DIR.'/sess_funct.php');

include_once(FUNCTIONS_DIR.'/setting_funct.php');

include_once(FUNCTIONS_DIR.'/report_funct.php');

include_once(INCLUDES_DIR."/editor/editor_functions.php"); // html editor

if (ZIPCODE_PROXIMITY == "on") include_once(FUNCTIONS_DIR.'/zipproximity_funct.php');

 

 

?>

 

ok, i have downloaded the site on my PC and using Dreamweaver to edit, how would i go about finding where this code is? also i have taken all the code out of the index.php file and in the www directory, the only thin in that file on the server is coming soon...

 

and still when i navagate to the www.live8081.com.index.php i get the same error...

1st of all please change ur password for ur mysql.

And please dont post ur real password or user name in forums.

 

Now to ur problem.

 

Ur code is ok just change ur password in the script u mention before or ur 1st

post at the top.

 

Or simply try this one:

$dbh=mysql_connect ("localhost", "live8081_simmysq", "q13cz2") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("live8081_directory");  

 

Hope this help u.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.