# # PHPQuotes 1.0 # Copyright 2003 Louise. All rights reserved. # Released September 8th 2003 # # PHPQuotes 1.0 is linkware and can be used or modified as long as this note remains # intact and unaltered and you provide a link back to http://codegrrl.com/ in return. You # are forbidden to sell or distribute the code of PHPQuotes 1.0, in whole or part, # without the written consent of Louise. # # By using PHPQuotes 1.0 you agree to indemnify Louise from any liability. # # Please see http://codegrrl.com/ for further information. # function Parse_Form() { $out = array(); $method = $_SERVER['REQUEST_METHOD']; if ($method == "GET") { foreach ($_GET as $key => $value) { $out[$key] = $value; } } elseif ($method == "POST") { foreach ($_POST as $key => $value) { $out[$key] = $value; } } else { $out = ""; } return $out; } $formData = Parse_Form(); foreach ($formData as $key => $value) { $$key = $value; } if (!ini_get("register_globals")) { extract($_GET, EXTR_SKIP); } // include configuration and password protection include("config.php"); include("protection.php"); ?>
![]() add new horse |
EntriesThere are =$numcount?> horses, of which =$numcount2?> are waiting to be approved. // select all unapproved horses $result = mysql_query ("SELECT * FROM $table WHERE apr!='y'"); if ($row = mysql_fetch_array($result)) { do { ?> } while($row = mysql_fetch_array($result)); } else {print "";} } elseif ($action == "approve"){ if ($what == "up"){ if ($sendernotify == "Y"){ $recipient = "$_POST[email]"; $subject = "$sitename: The horse has been successfully added."; $mailheaders = "From: $adminemail\n"; $mailheaders .= "Reply-To: $adminemail\n\n"; mail($recipient, $subject, "Hi $_POST[name], your entry has been added to the database at $sitename ($siteurl). Here's what you submited: \n\n Horse: $_POST[quote] \n Player: $_POST[author] \n Author Complement: $_POST[complem] \n Name: $_POST[name] \n Email: $_POST[email] \n URL: $_POST[url] \n\n Thanks! \n\n $adminname \n $admincollective", "$mailheaders"); } $query = "UPDATE $table SET relCatID='$relCatID', quote='$quote', author='$author', complem='$complem', name='$name', email='$email', url='$url', comments='$comments', apr='y' WHERE quoteID='$quoteID'"; mysql_query($query); } elseif ($what == "del"){ $query = "DELETE from $table WHERE quoteID='$quoteID'"; mysql_query($query); } $result = mysql_query ("SELECT * FROM $table WHERE apr!='y'"); if ($row = mysql_fetch_array($result)) { do { ?> } while($row = mysql_fetch_array($result)); } else {print "No more unapproved horses! Click here to go back to the main Admin Panel. ";} } elseif ($action == "addquote"){ ?>Add Horses} elseif ($action == "addquote2"){ $query = "INSERT INTO $table VALUES ('','$relCatID','$quote','$author','$complem','','','','','y')"; mysql_query($query); print "The entry was successfully added. "; } elseif ($action == "edit"){ ?>Edit an Entry} elseif ($action == "select"){ ?>Edit Horse Informationif ($quoteID == "") {$quoteID = '%';} if ($quote == "") {$quote = '%';} if ($author == "") {$author = '%';} if ($complem == "") {$complem = '%';} if ($name == "") {$name = '%';} if ($email == "") {$email = '%';} if ($url == "") {$url = '%';} $result = mysql_query ("SELECT * FROM $table WHERE quoteID LIKE '$quoteID' AND quote LIKE '%$quote%' AND author LIKE '%$author%' AND complem LIKE '%$complem%' AND name LIKE '%$name%' AND email LIKE '%$email%' AND url LIKE '%$url%'"); if ($row = mysql_fetch_array($result)) { do { $relCatID=$row["relCatID"]; ?> } while($row = mysql_fetch_array($result)); } else {print "Sorry, no records were found! Please try again. This entry was"; if ($what == "up"){ $query = "UPDATE $table SET relCatID='$relCatID', quote='$quote', author='$author', complem='$complem', name='$name', email='$email', url='$url', comments='$comments', apr='y' WHERE quoteID='$quoteID'"; mysql_query($query); echo " updated"; } elseif ($what == "del"){ $query = "DELETE from $table WHERE quoteID='$quoteID'"; mysql_query($query); echo " deleted"; } echo " successfully! "; } elseif ($action == "addcat"){ ?>Add a Category} elseif ($action == "addcat2"){ $query = "INSERT INTO $table_cat VALUES ('','$title')"; mysql_query($query); print "This category has been added! "; } elseif ($action == "cat_mod"){ ?> } elseif ($action == "cat_mod2"){ if ($what == "up"){ $query = "UPDATE $table_cat SET title = '$newtitle' WHERE catID = '$catID'"; mysql_query($query); print ("Category modified. "); } elseif ($what == "del"){ mysql_query("DELETE FROM $table_cat WHERE catID = $catID"); mysql_query("DELETE FROM $table WHERE relCatID = $catID"); print ("Category and all its quotes deleted. "); } } elseif ($what == "invalid"){ ?>Invalid login name or password! |