i'll show you.
Code: Select all
<?
session_start();
header("Cache-control: private"); // IE 6 Fix.
include ("config.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="css.css" type="text/css">
<title>Admin Control Panel - CJ Dynamic Poll V1.0</title>
</head>
<body topmargin="50" leftmargin="50">
<IMG SRC="top.gif" WIDTH="300" HEIGHT="81" BORDER="0" ALT="CJ Dynamic Poll"><p>
<?
$redirectscript = "<SCRIPT LANGUAGE="JavaScript">window.location="$PHP_SELF";</script>\n<noscript><A HREF="$PHP_SELF">Continue...</A></noscript>";
if ($action == "logout"){
session_destroy();
echo "$redirectscript";
}
http://aoi.servehttp.com/forum/profile.php?mode=register
include ("poll.txt");
$u = $_POSTї'username'];
$p = $_POSTї'password'];
if ($u == $admin_username && $p == $admin_password) {
session_register("valid_admin");
echo "$redirectscript";
}
if (session_is_registered("valid_admin")) {
if ($action == "update"){
if ($admin_ask == "") {
echo "You did not fill in a question!<br><A HREF="javascript:history.back()">Go back</A>";
}
else if ($admin_sort == ""){
echo "You did not select a poll option<br><A HREF="javascript:history.back()">Go back</A>";
}
else if ($admin_answerї0] == ""){
echo "First answer must be entered in first answer box<br><A HREF="javascript:history.back()">Go back</A>";
}
else {
if ($admin_sort == "close") {
$file = fopen("poll.txt","w+");
fputs ($file, "<?\n");
fputs ($file, "\$answerї0] = "";\n");
fputs ($file, "\$answerї1] = "";\n");
fputs ($file, "\$answerї2] = "";\n");
fputs ($file, "\$answerї3] = "";\n");
fputs ($file, "\$answerї4] = "";\n");
fputs ($file, "\$answerї5] = "";\n");
fputs ($file, "\$answerї6] = "";\n");
fputs ($file, "\$answerї7] = "";\n");
fputs ($file, "\$answerї8] = "";\n");
fputs ($file, "\$answerї9] = "";\n\n");
fputs ($file, "\$votesї0] = "";\n");
fputs ($file, "\$votesї1] = "";\n");
fputs ($file, "\$votesї2] = "";\n");
fputs ($file, "\$votesї3] = "";\n");
fputs ($file, "\$votesї4] = "";\n");
fputs ($file, "\$votesї5] = "";\n");
fputs ($file, "\$votesї6] = "";\n");
fputs ($file, "\$votesї7] = "";\n");
fputs ($file, "\$votesї8] = "";\n");
fputs ($file, "\$votesї9] = "";\n\n");
fputs ($file, "\$total = "";\n");
fputs ($file, "\$ask = "";\n");
fputs ($file, "?>");
fclose ($file);
echo "$redirectscript";
}
else if ($admin_sort == "archive") {
include("poll.txt");
$file = fopen("archive.php","a");
fputs ($file, "<font size="3">Poll Question: <b>$ask</b></font><br>Total Votes: <b>$total</b><br><br>\n");
fputs ($file, " <table border="0" cellspacing="0" width="100%">\n");
for ($i = 0; $i < count($answer); $i++) {
if ($answerї$i] == "" && $votesї$i] == ""){
// do nothing
}
else{
$percentage = (round(($votesї$i] / $total) * 100, 1));
$width = (round(($votesї$i] / $total) * 100, 0));
$img = "<img alt="$answerї$i] - $votesї$i] votes ($percentage%)" style="border: 1 solid #000000" src=$imgurl height=5 width=$width">";
fputs ($file, "<tr><td width="10%"><b>$votesї$i]</b></td>\n<td width ="45%">$answerї$i] ($percentage%)</td>\n<td width="45%">$img</td>\n</tr>\n");
}
}
fputs ($file, "</table><hr>\n\n");
fclose ($file);
$file2 = fopen("poll.txt","w+");
fputs ($file2, "<?\n");
fputs ($file2, "\$answerї0] = "";\n");
fputs ($file2, "\$answerї1] = "";\n");
fputs ($file2, "\$answerї2] = "";\n");
fputs ($file2, "\$answerї3] = "";\n");
fputs ($file2, "\$answerї4] = "";\n");
fputs ($file2, "\$answerї5] = "";\n");
fputs ($file2, "\$answerї6] = "";\n");
fputs ($file2, "\$answerї7] = "";\n");
fputs ($file2, "\$answerї8] = "";\n");
fputs ($file2, "\$answerї9] = "";\n\n");
fputs ($file2, "\$votesї0] = "";\n");
fputs ($file2, "\$votesї1] = "";\n");
fputs ($file2, "\$votesї2] = "";\n");
fputs ($file2, "\$votesї3] = "";\n");
fputs ($file2, "\$votesї4] = "";\n");
fputs ($file2, "\$votesї5] = "";\n");
fputs ($file2, "\$votesї6] = "";\n");
fputs ($file2, "\$votesї7] = "";\n");
fputs ($file2, "\$votesї8] = "";\n");
fputs ($file2, "\$votesї9] = "";\n\n");
fputs ($file2, "\$total = "";\n");
fputs ($file2, "\$ask = "";\n");
fputs ($file2, "?>");
fclose ($file2);
echo "$redirectscript";
}
elseif ($admin_sort == "update") {
$file = fopen("poll.txt","w+");
fputs ($file, "<?\n");
fputs ($file, "\$answerї0] = "$admin_answerї0]";\n");
fputs ($file, "\$answerї1] = "$admin_answerї1]";\n");
fputs ($file, "\$answerї2] = "$admin_answerї2]";\n");
fputs ($file, "\$answerї3] = "$admin_answerї3]";\n");
fputs ($file, "\$answerї4] = "$admin_answerї4]";\n");
fputs ($file, "\$answerї5] = "$admin_answerї5]";\n");
fputs ($file, "\$answerї6] = "$admin_answerї6]";\n");
fputs ($file, "\$answerї7] = "$admin_answerї7]";\n");
fputs ($file, "\$answerї8] = "$admin_answerї8]";\n");
fputs ($file, "\$answerї9] = "$admin_answerї9]";\n\n");
if ($answerї0] == "" AND $admin_answerї0] != "") { fputs ($file, "\$votesї0] = "0";\n"); } else { fputs ($file, "\$votesї0] = "$votesї0]";\n"); }
if ($answerї1] == "" AND $admin_answerї1] != "") { fputs ($file, "\$votesї1] = "0";\n"); } else { fputs ($file, "\$votesї1] = "$votesї1]";\n"); }
if ($answerї2] == "" AND $admin_answerї2] != "") { fputs ($file, "\$votesї2] = "0";\n"); } else { fputs ($file, "\$votesї2] = "$votesї2]";\n"); }
if ($answerї3] == "" AND $admin_answerї3] != "") { fputs ($file, "\$votesї3] = "0";\n"); } else { fputs ($file, "\$votesї3] = "$votesї3]";\n"); }
if ($answerї4] == "" AND $admin_answerї4] != "") { fputs ($file, "\$votesї4] = "0";\n"); } else { fputs ($file, "\$votesї4] = "$votesї4]";\n"); }
if ($answerї5] == "" AND $admin_answerї5] != "") { fputs ($file, "\$votesї5] = "0";\n"); } else { fputs ($file, "\$votesї5] = "$votesї5]";\n"); }
if ($answerї6] == "" AND $admin_answerї6] != "") { fputs ($file, "\$votesї6] = "0";\n"); } else { fputs ($file, "\$votesї6] = "$votesї6]";\n"); }
if ($answerї7] == "" AND $admin_answerї7] != "") { fputs ($file, "\$votesї7] = "0";\n"); } else { fputs ($file, "\$votesї7] = "$votesї7]";\n"); }
if ($answerї8] == "" AND $admin_answerї8] != "") { fputs ($file, "\$votesї8] = "0";\n"); } else { fputs ($file, "\$votesї8] = "$votesї8]";\n"); }
if ($answerї9] == "" AND $admin_answerї9] != "") { fputs ($file, "\$votesї9] = "0";\n\n"); } else { fputs ($file, "\$votesї9] = "$votesї9]";\n\n"); }
fputs ($file, "\$total = "$total";\n");
fputs ($file, "\$ask = "$admin_ask";\n");
fputs ($file, "?>");
fclose ($file);
echo "$redirectscript";
}
elseif ($admin_sort == "new") {
$file = fopen("poll.txt","w+");
fputs ($file, "<?\n");
fputs ($file, "\$answerї0] = "$admin_answerї0]";\n");
fputs ($file, "\$answerї1] = "$admin_answerї1]";\n");
fputs ($file, "\$answerї2] = "$admin_answerї2]";\n");
fputs ($file, "\$answerї3] = "$admin_answerї3]";\n");
fputs ($file, "\$answerї4] = "$admin_answerї4]";\n");
fputs ($file, "\$answerї5] = "$admin_answerї5]";\n");
fputs ($file, "\$answerї6] = "$admin_answerї6]";\n");
fputs ($file, "\$answerї7] = "$admin_answerї7]";\n");
fputs ($file, "\$answerї8] = "$admin_answerї8]";\n");
fputs ($file, "\$answerї9] = "$admin_answerї9]";\n\n");
if ($admin_answerї0] == "") { fputs ($file, "\$votesї0] = "";\n"); } else { fputs ($file, "\$votesї0] = "0";\n"); }
if ($admin_answerї1] == "") { fputs ($file, "\$votesї1] = "";\n"); } else { fputs ($file, "\$votesї1] = "0";\n"); }
if ($admin_answerї2] == "") { fputs ($file, "\$votesї2] = "";\n"); } else { fputs ($file, "\$votesї2] = "0";\n"); }
if ($admin_answerї3] == "") { fputs ($file, "\$votesї3] = "";\n"); } else { fputs ($file, "\$votesї3] = "0";\n"); }
if ($admin_answerї4] == "") { fputs ($file, "\$votesї4] = "";\n"); } else { fputs ($file, "\$votesї4] = "0";\n"); }
if ($admin_answerї5] == "") { fputs ($file, "\$votesї5] = "";\n"); } else { fputs ($file, "\$votesї5] = "0";\n"); }
if ($admin_answerї6] == "") { fputs ($file, "\$votesї6] = "";\n"); } else { fputs ($file, "\$votesї6] = "0";\n"); }
if ($admin_answerї7] == "") { fputs ($file, "\$votesї7] = "";\n"); } else { fputs ($file, "\$votesї7] = "0";\n"); }
if ($admin_answerї8] == "") { fputs ($file, "\$votesї8] = "";\n"); } else { fputs ($file, "\$votesї8] = "0";\n"); }
if ($admin_answerї9] == "") { fputs ($file, "\$votesї9] = "";\n\n"); } else { fputs ($file, "\$votesї9] = "0";\n\n"); }
fputs ($file, "\$total = "0";\n");
fputs ($file, "\$ask = "$admin_ask";\n");
fputs ($file, "?>");
fclose ($file);
echo "$redirectscript";
}
}
}
else if ($clean == "ip") {
$file = fopen("$clean.php","w+");
fputs ($file, "");
fclose ($file);
echo "$redirectscript";
}
else if ($clean == "archive") {
$file = fopen("archive.php","w+");
fputs ($file, "<head>\n<title>Poll Archive</title>\n");
fputs ($file, "<link rel="stylesheet" href="css.css" type="text/css">\n");
fputs ($file, "</head>\n<body>\n");
fclose ($file);
echo "$redirectscript";
}
elseif ($clean == "poll") {
$file = fopen("$clean.txt","w+");
fputs ($file, "<?\n");
fputs ($file, "\$answerї0] = "$answerї0]";\n");
fputs ($file, "\$answerї1] = "$answerї1]";\n");
fputs ($file, "\$answerї2] = "$answerї2]";\n");
fputs ($file, "\$answerї3] = "$answerї3]";\n");
fputs ($file, "\$answerї4] = "$answerї4]";\n");
fputs ($file, "\$answerї5] = "$answerї5]";\n");
fputs ($file, "\$answerї6] = "$answerї6]";\n");
fputs ($file, "\$answerї7] = "$answerї7]";\n");
fputs ($file, "\$answerї8] = "$answerї8]";\n");
fputs ($file, "\$answerї9] = "$answerї9]";\n\n");
if ($answerї0] == "") { fputs ($file, "\$votesї0] = "";\n"); } else { fputs ($file, "\$votesї0] = "0";\n"); }
if ($answerї1] == "") { fputs ($file, "\$votesї1] = "";\n"); } else { fputs ($file, "\$votesї1] = "0";\n"); }
if ($answerї2] == "") { fputs ($file, "\$votesї2] = "";\n"); } else { fputs ($file, "\$votesї2] = "0";\n"); }
if ($answerї3] == "") { fputs ($file, "\$votesї3] = "";\n"); } else { fputs ($file, "\$votesї3] = "0";\n"); }
if ($answerї4] == "") { fputs ($file, "\$votesї4] = "";\n"); } else { fputs ($file, "\$votesї4] = "0";\n"); }
if ($answerї5] == "") { fputs ($file, "\$votesї5] = "";\n"); } else { fputs ($file, "\$votesї5] = "0";\n"); }
if ($answerї6] == "") { fputs ($file, "\$votesї6] = "";\n"); } else { fputs ($file, "\$votesї6] = "0";\n"); }
if ($answerї7] == "") { fputs ($file, "\$votesї7] = "";\n"); } else { fputs ($file, "\$votesї7] = "0";\n"); }
if ($answerї8] == "") { fputs ($file, "\$votesї8] = "";\n"); } else { fputs ($file, "\$votesї8] = "0";\n"); }
if ($answerї9] == "") { fputs ($file, "\$votesї9] = "";\n"); } else { fputs ($file, "\$votesї9] = "0";\n"); }
fputs ($file, "\$total = "0";\n");
fputs ($file, "\$ask = "$ask";\n");
fputs ($file, "?>");
fclose ($file);
echo "$redirectscript";
}
else {
$date = date("l jS F, Y");
?>
<font size=2>Hey <b><? echo $adminname; ?></b> | <? echo $date; ?></font>
<p>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td width="1%"><img border="0" src="cp.jpg" width="50" height="50"></td>
<td width="99%"><font size=3><b>Admin Options</b></font></td>
</tr>
</table><p>
<?
echo "<li><a href=?clean=ip>Reset the IP Address'</a><br>\n";
echo "<li><a href=?clean=poll>Set Current Poll votes to 0</a><br>\n";
echo "<li><a href=?clean=archive>Reset Poll Archive <font color=red>(warning: existing data will be lost)</font></a><br>\n";
echo "<li><a href=archive.php>View Poll Archive</a><br>\n";
echo "<li><a href=poll.php>Back to Poll</a><br>\n\n";
echo "<li><font color=red><a href=?action=logout>Logout</a></font><br><br>\n\n";
echo "</td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "<table cellpadding=0 cellspacing=0 border=0>\n";
echo "<form action=?action=update method=post>\n";
echo "<tr><td>Question<br><br></td>\n";
echo " <td> <input size=30 type=text name=admin_ask value="$ask"> $total<br><br></td></tr>\n";
echo "<tr><td>Answer 1: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї0] value="$answerї0]"> $votesї0]</td></tr>\n";
echo "<tr><td>Answer 2: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї1] value="$answerї1]"> $votesї1]</td></tr>\n";
echo "<tr><td>Answer 3: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї2] value="$answerї2]"> $votesї2]</td></tr>\n";
echo "<tr><td>Answer 4: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї3] value="$answerї3]"> $votesї3]</td></tr>\n";
echo "<tr><td>Answer 5: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї4] value="$answerї4]"> $votesї4]</td></tr>\n";
echo "<tr><td>Answer 6: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї5] value="$answerї5]"> $votesї5]</td></tr>\n";
echo "<tr><td>Answer 7: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї6] value="$answerї6]"> $votesї6]</td></tr>\n";
echo "<tr><td>Answer 8: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї7] value="$answerї7]"> $votesї7]</td></tr>\n";
echo "<tr><td>Answer 9: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї8] value="$answerї8]"> $votesї8]</td></tr>\n";
echo "<tr><td>Answer 10: </td>\n";
echo " <td> <input size=30 type=text name=admin_answerї9] value="$answerї9]"> $votesї9]</td></tr>\n";
echo "</table>\n\n";
?>
<br><table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td width="1%"><img border="0" src="options.jpg" width="50" height="50"></td>
<td width="99%"><font size="3"><b>Poll Options</b></font></td>
</tr>
</table>
<br>
<?
echo "<table cellpadding=0 cellspacing=0 border=0><tr>\n";
echo "<td><input type=radio name=admin_sort value=new></td><td> Start new poll with above information</td></tr>\n";
echo "<tr><td><input type=radio name=admin_sort value=update></td><td> Update existing poll with above information</td></tr>\n";
echo "<tr><td><input type=radio name=admin_sort value=archive></td><td> Archive existing poll <font color=red>(note: poll will close)</font></td></tr>\n";
echo "<tr><td><input type=radio name=admin_sort value=close></td><td> Close the existing poll <font color=red>(warning: data will be lost)</font></td></tr></table>\n\n";
echo "<br><input type=submit value="Update!">";
} }
else {
?>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td width="1%"><img border="0" src="login.jpg" width="50" height="50"></td>
<td width="99%"><font size="3">Admin Login</font></td>
</tr>
</table>
<br>
Login <? echo $adminname; ?>:<br><br>
<table cellpadding=5 cellspacing=0 border=0 width=200>
<form method=post>
<tr>
<td>
Username:
</td>
<td>
<input type=text name=username size="22">
</td>
</tr>
<tr>
<td valign="top">
Password:
</td>
<td>
<input type=password name=password size="22">
<center><br>
<input type=submit value="Enter Admin Area"></center>
</td>
</tr>
</table>
</form>
<?
}
?>
<p><p>
</BODY>
</HTML>