From 125f182db6094a0421d631d995a3b5f7495c58e3 Mon Sep 17 00:00:00 2001 From: Jason Cleeland Date: Wed, 2 Apr 2003 05:06:07 +0000 Subject: [PATCH] Removed unnecessary conversions from $_GET, $_POST to global. Added htmlfooter to create tokens screens. git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@177 b72ed6b6-b9f8-46b5-92b4-906544132732 --- admin/tokens.php | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/admin/tokens.php b/admin/tokens.php index cc8ca764c54..fd5886fc42f 100644 --- a/admin/tokens.php +++ b/admin/tokens.php @@ -36,11 +36,9 @@ # TOKENS FILE -$sid = $_GET['sid']; -$action = $_GET['action']; -$tid = $_GET['tid']; -$order = $_GET['order']; -$ok = $_GET['ok']; +//Create global $action variable +if ($_GET['action']) {$action = $_GET['action'];} +if ($_POST['action']) {$action = $_POST['action'];} include("config.php"); @@ -69,10 +67,6 @@ if (!$sid) {$sid = $_POST['sid'];} } -//CONVERT POST & GET VARIABLES TO GLOBALS -if ($_GET['action']) {$action = $_GET['action'];} -if ($_POST['action']) {$action = $_POST['action'];} - // MAKE SURE THAT THE SURVEY EXISTS $chquery = "SELECT * FROM surveys WHERE sid=$sid"; if (!$chresult = mysql_query($chquery)) @@ -107,6 +101,7 @@ echo "\t\t\n"; echo "\t\n"; echo "\n"; + echo htmlfooter("instructions.html", "Information about PHPSurveyor Tokens Functions"); echo "\n"; exit; } @@ -130,6 +125,7 @@ echo "\t\t\n"; echo "\t\n"; echo "\n"; + echo htmlfooter("instructions.html", "Information about PHPSurveyor Tokens Functions"); echo "\n"; exit; @@ -198,8 +194,8 @@ echo "\t\t$setfont"."Action\n"; echo "\t\n"; $bquery = "SELECT * FROM tokens_$sid"; - if (!$order) {$bquery .= " ORDER BY tid";} - else {$bquery .= " ORDER BY $order";} + if (!$_GET['order']) {$bquery .= " ORDER BY tid";} + else {$bquery .= " ORDER BY {$_GET['order']}";} $bresult = mysql_query($bquery); while ($brow = mysql_fetch_array($bresult)) { @@ -245,30 +241,30 @@ { $date = date(YmdHi); echo "$setfontDrop/Delete Tokens
\n"; - if (!$ok) + if (!$_GET['ok']) { echo "\n"; echo "Deleting this token table will mean that tokens are no longer
\n"; echo "required for public access to this survey. It will also delete
\n"; echo "all the existing tokens in this survey. A backup of this table
\n"; - echo "will be made, and called \"old_tokens_$sid_$date\". This can be
\n"; + echo "will be made, and called \"old_tokens_{$_GET['sid']}_$date\". This can be
\n"; echo "recovered by a systems administrator.

\n"; - echo "
\n"; - echo "\n"; + echo "
\n"; + echo "\n"; echo "
\n"; } elseif ($_GET['ok'] == "surething") { - $oldtable = "tokens_{$sid}"; - $newtable = "old_tokens_{$sid}_{$date}"; + $oldtable = "tokens_{$_GET['sid']}"; + $newtable = "old_tokens_{$_GET['sid']}_{$date}"; $deactivatequery = "RENAME TABLE $oldtable TO $newtable"; $deactivateresult = mysql_query($deactivatequery) or die ("Couldn't deactivate because:
\n".mysql_error()."

\nAdmin\n"); echo "\n"; echo "The tokens table has now been removed and tokens are no longer
\n"; echo "required for public access to this survey. A backup of this table
\n"; - echo "has been made, and is called \"old_tokens_$sid_$date\". This can be
\n"; + echo "has been made, and is called \"old_tokens_{$_GET['sid']}_$date\". This can be
\n"; echo "recovered by a systems administrator.

\n"; - echo "\n"; + echo "\n"; echo "
\n"; } }