| Server IP : 74.208.236.52 / Your IP : 216.73.217.98 Web Server : Apache System : Linux infong527 4.4.400-icpu-115 #2 SMP Mon Jul 6 08:15:05 UTC 2026 x86_64 User : u44043973 ( 5404757) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /homepages/18/d194259149/htdocs/bonus1/admin/ |
Upload File : |
<?php
session_start();
include "../config.php";
include "../header.php";
include "../style.php";
if( session_is_registered("alogin") ) {
?><table>
<tr>
<td width="15%" valign=top><br>
<? include("adminnavigation.php"); ?>
</td>
<td valign="top" align="center"><br><br> <?
echo "<font size=2 face='$fonttype' color='$fontcolour'><p><center>";
echo "<center><H2>Edit Promo codes</H2></center>";
if($_POST['action'] == "update") {
mysql_query("UPDATE promo_codes SET name = '".$_POST['name']."', max = '".$_POST['max']."', code = '".$_POST['code']."', upgrade = '".$_POST['upgrade']."' WHERE id='".$_POST['id']."'");
echo "<font color=red>The promo code has been updated.</font><br><br>";
} else if($_POST['action'] == "add") {
mysql_query("INSERT INTO promo_codes SET name = '".$_POST['name']."', max = '".$_POST['max']."', code = '".$_POST['code']."', upgrade = '".$_POST['upgrade']."'");
echo "<font color=red>The promo code has been added.</font><br><br>";
} else if($_POST['action'] == "delete") {
mysql_query("DELETE FROM promo_codes WHERE id='".$_POST['id']."'");
mysql_query("DELETE FROM promo_used WHERE promoid='".$_POST['id']."'");
echo "<font color=red>The promo code has been deleted.</font><br><br>";
}
$sql = mysql_query("SELECT * FROM promo_codes");
if(@mysql_num_rows($sql)) {
echo "<table width=\"80%\" border=\"1\" cellpadding=\"5\"><tr><th>Name</th><th>Code</th><th>Redemptions</th><th>Max</th><th>Action</th></tr>";
while($each = mysql_fetch_array($sql)) {
echo "<tr><td>".$each['name']."</td><td>".$each['code']."</td><td>".$each['count']."</td><td>".$each['max']."</td><td><form method=\"post\"><input type=\"hidden\" name=\"id\" value=\"".$each['id']."\"><input type=\"hidden\" name=\"action\" value=\"edit\"><input type=\"submit\" value=\"Edit\"></form><form method=\"post\"><input type=\"hidden\" name=\"id\" value=\"".$each['id']."\"><input type=\"hidden\" name=\"action\" value=\"delete\"><input type=\"submit\" value=\"Delete\"></form></td></tr>";
}
echo "</table>";
}
if($_POST['action'] == "edit") {
$sql = mysql_query("SELECT * FROM promo_codes WHERE id='".$_POST['id']."' LIMIT 1");
if(@mysql_num_rows($sql)) {
$offer = mysql_fetch_array($sql);
?>
<h2>Edit</h2>
<form method="POST" action="editpromo.php">
<input type="hidden" name="action" value="update">
<input type="hidden" name="id" value="<? echo $offer['id']; ?>">
<table>
<tr><td>Name:</td><td><input type="text" name="name" value="<? echo $offer['name']; ?>"></td></tr>
<tr><td>Code:</td><td><input type="text" name="code" value="<? echo $offer['code']; ?>"></td></tr>
<tr><td>Max:</td><td><input type="text" name="max" value="<? echo $offer['max']; ?>"></td></tr>
<tr><td>Upgrade:</td><td><input type="radio" name="upgrade" value="1"<? if($offer['upgrade'] == 1) echo " CHECKED"; ?>> 1st level <input type="radio" name="upgrade" value="2"<? if($offer['upgrade'] == 2) echo " CHECKED"; ?>> 2nd level <input type="radio" name="upgrade" value="0"<? if($offer['upgrade'] == 0) echo " CHECKED"; ?>> no</td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Update"></td></tr>
</table>
</form>
<?
} else echo "<font color=red>That promo code doesn't exist anymore.</font><br><br>";
} else {
?>
<h2>Add</h2>
<form method="POST" action="editpromo.php">
<input type="hidden" name="action" value="add">
<table>
<tr><td>Name:</td><td><input type="text" name="name" value=""></td></tr>
<tr><td>Code:</td><td><input type="text" name="code" value=""></td></tr>
<tr><td>Max:</td><td><input type="text" name="max" value=""></td></tr>
<tr><td>Upgrade:</td><td><input type="radio" name="upgrade" value="1"> 1st level <input type="radio" name="upgrade" value="2"> 2nd level <input type="radio" name="upgrade" value="0" CHECKED> no</td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Update"></td></tr>
</table>
</form>
<?
}
echo "</td></tr></table>";
}
else
echo "Unauthorised Access!";
include "../footer.php";
?>