<?php
$path = $_SERVER['SCRIPT_FILENAME'];
$path = str_replace('index.php', "", $path);
require_once("$path/header.php");
require_once("$path/config.php"); // Include config.php
$log = $_SESSION['log'];
$username = $_SESSION['username'];
if ($_GET['act'] == "add") { ?>
<h2>Add Quotes</h2><form name="quote_add" id="quote_add" method="post" action="process.php">
<table border="0" cellspacing="0" cellpadding="4">
<tr>
<td valign="top">Quote:</td>
<td><textarea name="quote" cols="25" rows="5" id="quote"></textarea></td>
</tr>
<tr>
<td>Person who said the quote: </td>
<td><input name="quoter" type="text" id="quoter" size="25" /></td>
</tr>
<tr>
<td>Page: (If in a book, movie) </td>
<td><input name="page" type="text" id="page" size="25" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="Submit" type="submit" value="Submit" /> <input name="Reset" type="reset" value="Reset" /></td>
</tr>
</table>
</form>
<? }
else if ($_GET['act'] == "adduser") { ?>
<h2>Add Quotes</h2><form name="user_add" id="user_add" method="post" action="adduser.php">
<table border="0" cellspacing="0" cellpadding="4">
<tr>
<td valign="top">Username:</td>
<td><input name="username" type="text" id="username" size="25" /></td>
</tr>
<tr>
<td>Password: </td>
<td><input name="password" type="text" id="password" size="25" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="Submit" type="submit" value="Submit" /> <input name="Reset" type="reset" value="Reset" /></td>
</tr>
</table>
</form>
<? }
else if ($_GET['act'] == "readme") {
include("readme.html");
}
[b]else if ($_GET['act'] == "update") {
$result = mysql_query("SELECT * FROM xld_quotes");
$count = mysql_num_rows($result);
?>
<table width="500" border="0" cellspacing="1" cellpadding="0">
<tr>
<form name="form1" method="post" action="">
<td>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<?
while ($rows = mysql_fetch_array($result)) { ?>
<tr>
<td align="center"><strong>Id</strong><br /><? $id[]=$rows['id']; ?><? echo $rows['id']; ?></td>
<td align="center"><strong>Quote</strong><br /><textarea cols="25" rows="5" name="quote[]" id="quote"><? echo $rows['quote']; ?></textarea></td>
<td align="center"><strong>Quoter</strong><br /><input name="quoter[]" type="text" id="quoter" value="<? echo $rows['quoter']; ?>"><br />
<strong>Page</strong><br /><input name="page[]" type="text" id="page" value="<? echo $rows['page']; ?>"></td>
</tr>
<? } ?>
<tr>
<td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?
// Check if button name "Submit" is active, do this
if ($_POST['Submit']) {
for ($i=0; $i<$count; $i++) {
$sql1 = "UPDATE $table SET quote = '$quote[$i]', quoter = '$quoter[$i]', page = '$page[$i]' WHERE id = '$id[$i]'";
$result1 = mysql_query($sql1);
}
}
if ($result1) { ?>
<meta http-equiv="refresh" content="0;URL=index.php?act=update">[/b]
<? }
} else {
$install = 'installer.php';
if (file_exists($install)) {
echo "<font color=\"#FF0000\"><b>WARNING:</b> Installer.php is still present on the server. For security reasons, please delete this file immediately.</font>";
echo "<br /><br />";
}
$number_quotes = mysql_num_rows(mysql_query("SELECT id FROM xld_quotes"));
$number_admin = mysql_num_rows(mysql_query("SELECT id FROM xld_users"));
?>
<table width="500" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top">
<table width="200" cellpadding="0" cellspacing="0" style="border:thin solid #000000;">
<tr>
<td width="200" height="20" align="center" background="images/bar.gif" style="color:#000000;"><b>Random Quote</b></td>
</tr>
<tr>
<td width="200"><?php include("quotes.php"); ?></td>
</tr>
</table>
</td>
<td align="center" valign="top">
<table width="200" cellpadding="0" cellspacing="0" style="border:thin solid #000000;">
<tr>
<td width="200" height="20" align="center" background="images/bar.gif" style="color:#000000;"><b>Version Check</b></td>
</tr>
<tr>
<td width="200"><strong>Your Version:</strong> <?php include("VERSION"); ?><br />
Latest Version: <?php echo file_get_contents('http://xldstudios.com/scripts/xldq/versionc.php'); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<b>Welcome Back, <? echo $username; ?></b><br /><br />
<b>Welcome</b> to the Admin Control Panel (ACP) of XLD - Quotes. Are you in mood of adding quotes? Then just go to the Add Quotes link in the menue above.
<br /> <br />
We thank you for purchasing XLD - Quotes and we hope you'll have a great time using it. We will answer any of your questions about this script on our site, so just pop over to it via the link above. You can also submit a support ticket in the client center.<br /><br />
<b>Stats</b><br />
Number of Quotes: <? echo $number_quotes; ?><br />
Number of Users:<? echo $number_admin; ?></b>
</td>
</tr>
</table>
<? }
include("footer.php");
?>
I am very thankful for replies!
