<?php
// Bible SuperSearch Version 1.0.00
// The free, open source, PHP and MySQL web-based
// Bible Reference retrevial and search utility
//
// Copyright (C) 2006 Luke Mounsey
// www.BibleSuperSearch.com
// www.Alive-in-Christ.com
//
// bible_mysql.php
// Contains functions to connect to the MySQL database
// Links to bible_lookup.php, which contains the user's login data
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License included in the file
// "license.txt" for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// file version
$bible_mysql_version=0.4;
// connect
// connects to MySQL database
// @ name connect
// @ param none
// @ return none
// logs into MySQL and
// selects main database for use
require("search_login.php");
function connect(){
require("search_config.php");
// Connecting, selecting database
// ADVANCED USERS ONLY
// ALL OTHERS DO NOT CHANGE THIS SETTING!
// set this to false ONLY if you are using
// an offline local server to develop/ debug
// other than the one you use to host your website.
// otherwise,
$online=false;
if ($online){
// mySQL database logon
// set these values to your hostname, username and password
$link = mysql_connect('localhost','aic2001',"salvfaith")
or die('Could not connect: Please check your hostname, username and password in the file mysql.php' . mysql_error());
// set database name to the name of the database assigned.
mysql_select_db('aliveinchrist_us_-_main')
or die('Database not found. Please check your hostname, username, password, and database name in the file mysql.php');
}
else{
// offline mysql login
// see above
// advanced users ONLY
// set these values to your hostname, username and password
//echo("mysql $host, $user, $password, $db");
if(mysql_connect($host,$user,$password)==false){
echo(mysql_error()."<br>");
return false;
}
// or die('Could not connect: Please check your hostname, username and password in the file mysql.php' . mysql_error());
// set database name to the name of the database assigned.
if (mysql_select_db($db)==false){
// $error=mysql_error();
// echo("$error<br>This means that you either do not have permission to access the database requested, you do not have permission to create databases if you tried to create a database, or your web hosting company has set a specific format for naming databases. Please try a different database name, or contact your web hosting company for details.");
return -1;
}
// or die('Database not found. Please check your hostname, username, password, and database name in the file mysql.php');
return true;
}
return true;
}// end connect
?>