<?php
/************************************************************************
- * MXChange v0.2.1 Start: 04/24/2005 *
- * =============== Last change: 05/18/2008 *
+ * M-XChange v0.2.1 Start: 04/24/2005 *
+ * ================ Last change: 05/19/2008 *
* *
* -------------------------------------------------------------------- *
* File : what-del_sponsor.php *
************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
-{
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
require($INC);
}
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-if (!empty($HTTP_GET_VARS['id']))
-{
+if (!empty($_GET['id']))) {
// Check for selected sponsor
- $result = SQL_QUERY_ESC("SELECT email, salut, surname, family FROM "._MYSQL_PREFIX."_sponsor_data WHERE id='%s' LIMIT 1",
- array($HTTP_GET_VARS['id']), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ $result = SQL_QUERY_ESC("SELECT email, gender, surname, family FROM "._MYSQL_PREFIX."_sponsor_data WHERE id='%s' LIMIT 1",
+ array(bigintval($_GET['id'])), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
// Remove sponsor
- if (isset($HTTP_POST_VARS['ok']))
- {
+ if (isset($_POST['ok'])) {
// Load data and remember it in constants
- list($email, $salut, $surname, $family) = SQL_FETCHROW($result);
+ list($email, $gender, $surname, $family) = SQL_FETCHROW($result);
+
+ // Free result
SQL_FREERESULT($result);
+
define('__EMAIL' , $email);
- define('__SALUT' , TRANSLATE_SEX($salut));
+ define('__GENDER' , TRANSLATE_GENDER($gender));
define('__SURNAME', $surname);
define('__FAMILY' , $family);
// Prepare message and send it away
- $msg = LOAD_EMAIL_TEMPLATE("del_sponsor", $HTTP_POST_VARS['reason'], $HTTP_GET_VARS['id']);
+ $msg = LOAD_EMAIL_TEMPLATE("del_sponsor", $_POST['reason'], bigintval($_GET['id']));
SEND_EMAIL($email, SPONSOR_ADMIN_DEL_SUBJECT, $msg);
// Remove account
$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_sponsor_data WHERE id='%s' LIMIT 1",
- array(bigintval($HTTP_GET_VARS['id'])), __FILE__, __LINE__);
+ array(bigintval($_GET['id'])), __FILE__, __LINE__);
// Remove orders
$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_sponsor_orders WHERE sponsorid='%s' LIMIT 1",
- array(bigintval($HTTP_GET_VARS['id'])), __FILE__, __LINE__);
+ array(bigintval($_GET['id'])), __FILE__, __LINE__);
// Output message
- LOAD_TEMPLATE("admin_settings_saved", false, SPONSOR_DELETED_1.$HTTP_GET_VARS['id'].SPONSOR_DELETED_2);
- }
- elseif (!empty($HTTP_POST_VARS['no']))
- {
+ LOAD_TEMPLATE("admin_settings_saved", false, SPONSOR_DELETED_1.bigintval($_GET['id']).SPONSOR_DELETED_2);
+ } elseif (!empty($_POST['no'])) {
// Do not delete him...
- LOAD_URL(URL."/modules.php?module=admin&what=list_sponsor&id=".$HTTP_GET_VARS['id']);
- }
- else
- {
+ LOAD_URL(URL."/modules.php?module=admin&what=list_sponsor&id=".bigintval($_GET['id']));
+ } else {
// Load data
- list ($email, $salut, $sname, $fname) = SQL_FETCHROW($result);
+ list ($email, $gender, $sname, $fname) = SQL_FETCHROW($result);
// Transfer data to constants for the template
define('__EMAIL', $email);
define('__SNAME', $sname);
define('__FNAME', $fname);
- define('__SALUT', TRANSLATE_SEX($salut));
- define('__UID' , $HTTP_GET_VARS['id']);
+ define('__GENDER', TRANSLATE_GENDER($gender));
+ define('__UID' , bigintval($_GET['id']));
// Display form
LOAD_TEMPLATE("admin_del_sponsor");
}
- }
- else
- {
+ } else {
// Sponsor not found!
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SPONSOR_404_1.$HTTP_GET_VARS['id'].ADMIN_SPONSOR_404_2);
+ LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SPONSOR_404_1.bigintval($_GET['id']).ADMIN_SPONSOR_404_2);
}
-}
- else
-{
+} else {
// Not called by what-list_sponsor.php
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_CALL_NOT_DIRECTLY);
}