This is the whole page: The only problem is connecting to the actual database
<?php
//LOAD THE HEADER
$filename = "includes/header.inc";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
$menu = ("
<a href='index.php'>Home</a> |
<a href='index.php?opt=schedule'>Scores and Schedules</a> |
<a href='index.php?opt=login'>Login</a>\n\r
");
$contents = ereg_replace("<!--%CC_MENU%-->",$menu,$contents);
echo $contents;
switch($opt) {
//SQL ADMINISTRATOR FUNCTION
case "ahomecomplete":
include("announcement.php");
echo ahomecomplete();
break;
//VIEW SCHEDULE AND SCORES
case "schedule":
include("standings.php");
if(!$divname) $divname = "none";
listteams($divname);
break;
//LOGIN FORM
case "login":
include("login.php");
login();
break;
//LOGIN CHECK
case "admincheck":
include("logincheck.php");
logincheck($fusername,$fpassword);
break;
//CREATE AN ADMINISTRATOR
case "createadmin":
include("createadmin.php");
createadmin();
break;
//SQL ADMINISTRATOR FUNCTION
case "createadmin2":
include("createadmin.php");
createadmin2($adminpassword);
break;
//HOME
default:
admincheck();
}
//ADMIN CHECK
function admincheck() {
include("conextion.php");
//connect to database server
$dataconx = @mysql_connect($dbHost, $dbUser, $dbPass, $dbDatabase);
if (!$dataconx) {
die( '<P>Unable to connect to the database server at this time.</P>' );
}
//connect to the database
if (! @mysql_select_db("$dbDatabase",$dataconx) ) {
die( '<P>Unable to locate the database at this time.</P>' );
}
$result = mysql("$dbDatabase","SELECT * FROM teams WHERE username = 'admin'");
$i = 0;
$total_rows = mysql_numrows($result);
if($total_rows != 1) {
echo "<p align=center class=\"header\">Welcome to League.<br>For security you need to create an
Administrator for your league. <a href=\"index.php?opt=createadmin\">
Do that now</a>.</p>";
$check = "false";
$sql = "INSERT INTO leagueinfo VALUES ('NULL','','',";
$sql .= "'','','',";
$sql .= "'','0','10')";
$done = mysql_query($sql);
} else home();
}
//MANAGE LEAGUE
function home() {
include 'conextion.php';
//connect to database server
$dataconx = @mysql_connect($dbHost, $dbUser, $dbPass, $dbDatabase);
if (!$dataconx) {
die( '<P>Unable to connect to the database server at this time.</>' );
}
//connect to the database
if (!@mysql_select_db('$dbDatabase') ) {
die( '<P>Unable to locate the database at this time.</P>' );
}
$result = mysql("$dbDatabase","SELECT * FROM leagueinfo");
$rcount = mysql_numrows($result);
$i = 0;
if($rcount != 0) {
$league_name = mysql_result($result,$i,"name");
$description = mysql_result($result,$i,"description");
$contact_name = mysql_result($result,$i,"contact_name");
$phone = mysql_result($result,$i,"contact_phone");
$email = mysql_result($result,$i,"contact_email");
$address = mysql_result($result,$i,"contact_address");
} else {
$league_name = "";
$description = "";
$contact_name = "";
$phone = "";
$email = "";
$address = "";
}
//LEAGUE ANNOUNCEMENTS
$announcements = "
<table border=0 cellpadding=0 cellspacing=0 width=\"100%\" align=left>
<tr><td bgcolor=\"#dfdfdf\">
<table border=0 cellpadding=5 cellspacing=1 width=\"100%\">
<tr><td bgcolor=\"#ffffff\" class=body_text>
<center><b>Announcements</b></center><br>";
include("announcement.php");
$announcements.= ahomelist();
if($email == "") {
$announcements.= "<br><center><b>Request a League User ID:</b></center><br>No contact email
has been entered by this league's administrator.";
} else {
$announcements.= "<br><center><b>Request a League User ID</b></center><br>
To request a League user ID<br> Email <a href=\"mailto:$email\">$contact_name</a>";
}
$announcements.= "
</td></tr></table>
</td></tr></table>";
echo "<table border=0 width=750 align=center cellpadding=10><tr><td colspan=2><br>";
//LEAGUE TITLE
echo "<p class=\"header\" align=center>Welcome to ";
if($league_name == "") {
echo "v.1.0</p>";
} else echo "$league_name</p>";
echo "</td></tr>";
echo "<td width=200 valign=top>$announcements</td><td width=550 valign=top>";
//LEAGUE DESCRIPTION
echo "<p class=\"body_text\">";
if($description == "") {
echo "No description has been entered by this league's
administrator.</p>";
} else {
$description = ereg_replace("\n","<br>",$description);
echo $description."</p>";
}
//OTHER LEAGUE INFORMATION
echo "<p class=\"body_text\">";
if($contact_name == "") {
echo "No contact information has been entered by this league's
administrator.</p>";
} else {
echo "<span class=header>League Contact:</span> $contact_name</p>";
}
if($phone != "") {
echo "<p class=\"body_text\"><span class=header>Phone:</span> $phone</p>";
}
if($address != "") {
$address = ereg_replace("\n","<br>",$address);
echo "<p class=\"body_text\"><span class=header>Address:</span><br>$address</p>";
}
echo "</td></tr></table>";
}
include("includes/footer.inc");
?>
The table is teams
id int(4) UNSIGNED ZEROFILL No auto_increment Change Drop Primary Index Unique Fulltext
name varchar(50) No Change Drop Primary Index Unique Fulltext
contact_name varchar(70) No Change Drop Primary Index Unique Fulltext
contact_email varchar(70) No Change Drop Primary Index Unique Fulltext
contact_phone varchar(15) No Change Drop Primary Index Unique Fulltext
division varchar(50) No Change Drop Primary Index Unique Fulltext
username varchar(50) No Change Drop Primary Index Unique Fulltext
password varchar(50) No Change Drop Primary Index Unique Fulltext
loggedin int(1) No 0 Change Drop Primary Index Unique Fulltext
logtime varchar(50)