Security line in all includes changed
[mailer.git] / inc / modules / guest / what-register.php
index c0eeb66f5b82e40a23c8eba0e0f57136b9b06549..f06e9ee66f391b88623d09c432b36ba1501b20c7 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
-}
- elseif ((!EXT_IS_ACTIVE("register")))
-{
+} elseif ((!EXT_IS_ACTIVE("register"))) {
        if (IS_ADMIN()) {
                ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "register"));
        } else {
        if (IS_ADMIN()) {
                ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "register"));
        } else {
@@ -50,7 +47,6 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
 // Add description as navigation point
 ADD_DESCR("guest", basename(__FILE__));
 
 // Add description as navigation point
 ADD_DESCR("guest", basename(__FILE__));
 
-OPEN_TABLE("100%", "guest_content_align", "");
 global $_CONFIG, $DATA;
 
 // Initialize variables
 global $_CONFIG, $DATA;
 
 // Initialize variables
@@ -131,7 +127,7 @@ if (isset($_POST['ok']))
        if (!IS_ADMIN())
        {
                // Do this check only when no admin is logged in
        if (!IS_ADMIN())
        {
                // Do this check only when no admin is logged in
-               foreach ($_POST['cat'] as $id=>$answer)
+               foreach ($_POST['cat'] as $id => $answer)
                {
                        if ($answer == "Y") $cats++;
                }
                {
                        if ($answer == "Y") $cats++;
                }
@@ -161,7 +157,7 @@ if (isset($_POST['ok']))
        }
 
        // Test the refid (because some strange hackers... :-P)
        }
 
        // Test the refid (because some strange hackers... :-P)
-       $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
         array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0)
        {
         array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0)
        {
@@ -234,11 +230,11 @@ if ((isset($_POST['ok'])) && (!$FAILED))
        // Create user's account... //
        //////////////////////////////
        //
        // Create user's account... //
        //////////////////////////////
        //
-       $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_data (sex, surname, family, street_nr, %s, zip, city, email, birth_day, birth_month, birth_year, password, max_mails, receive_mails, refid, status, user_hash, REMOTE_ADDR, joined, last_update".$ADD1.")
-VALUES ('%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', %d, %d, %d, '%s', %d, %d, %d, 'UNCONFIRMED', '%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()".$ADD2.")",
+       $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_data (gender, surname, family, street_nr, %s, zip, city, email, birth_day, birth_month, birth_year, password, max_mails, receive_mails, refid, status, user_hash, REMOTE_ADDR, joined, last_update".$ADD1.")
+VALUES ('%s', '%s', '%s', '%s', '%s', %s, '%s', '%s', %s, %s, %s, '%s', %s, %s, %s, 'UNCONFIRMED', '%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()".$ADD2.")",
 array(
        $countryRow,
 array(
        $countryRow,
-       SQL_ESCAPE(substr($_POST['sex'], 0, 1)),
+       SQL_ESCAPE(substr($_POST['gender'], 0, 1)),
        SQL_ESCAPE($_POST['surname']),
        SQL_ESCAPE($_POST['family_name']),
        SQL_ESCAPE($_POST['street_nr']),
        SQL_ESCAPE($_POST['surname']),
        SQL_ESCAPE($_POST['family_name']),
        SQL_ESCAPE($_POST['street_nr']),
@@ -266,14 +262,14 @@ array(
        $userid = bigintval($userid);
 
        // Write his welcome-points
        $userid = bigintval($userid);
 
        // Write his welcome-points
-       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_points WHERE userid=%d AND ref_depth=0 LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s AND ref_depth=0 LIMIT 1",
         array(bigintval($userid)), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0)
        {
                // Add only when the line was not found (maybe some more secure?)
                $locked = "points";
                if ($_CONFIG['ref_payout'] > 0) $locked = "locked_points"; // Pay him later. First he has to confirm some mails!
         array(bigintval($userid)), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0)
        {
                // Add only when the line was not found (maybe some more secure?)
                $locked = "points";
                if ($_CONFIG['ref_payout'] > 0) $locked = "locked_points"; // Pay him later. First he has to confirm some mails!
-               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid, ref_depth, ".$locked.") VALUES(%d, 0, '%s')",
+               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid, ref_depth, ".$locked.") VALUES(%s, 0, '%s')",
                 array(bigintval($userid), $_CONFIG['points_register']), __FILE__, __LINE__);
 
                // Update mediadata as well
                 array(bigintval($userid), $_CONFIG['points_register']), __FILE__, __LINE__);
 
                // Update mediadata as well
@@ -285,27 +281,27 @@ array(
 
        // Write catgories
        if ((is_array($_POST['cat'])) && (count($_POST['cat']))) {
 
        // Write catgories
        if ((is_array($_POST['cat'])) && (count($_POST['cat']))) {
-               foreach ($_POST['cat'] as $cat=>$joined) {
+               foreach ($_POST['cat'] as $cat => $joined) {
                        if ($joined == "Y") {
                                // Insert category entry
                        if ($joined == "Y") {
                                // Insert category entry
-                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_cats (userid, cat_id) VALUES (%d, %d)",
+                               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_cats (userid, cat_id) VALUES (%s, %s)",
                                 array(bigintval($userid), bigintval($cat)), __FILE__, __LINE__);
                        }
                }
        }
 
                                 array(bigintval($userid), bigintval($cat)), __FILE__, __LINE__);
                        }
                }
        }
 
-       // Rewrite sex
-       $sex = TRANSLATE_SEX($_POST['sex']);
+       // Rewrite gender
+       $gender = TRANSLATE_GENDER($_POST['gender']);
 
        // ... rewrite a zero referral ID to the main title
        if ($_POST['refid'] == "0") $_POST['refid'] = MAIN_TITLE;
 
        // Prepare data array for the email template
 
        // ... rewrite a zero referral ID to the main title
        if ($_POST['refid'] == "0") $_POST['refid'] = MAIN_TITLE;
 
        // Prepare data array for the email template
-       // Start with the salutation...
+       // Start with the gender...
        $DATA = array(
                'hash'    => $hash,
                'uid'     => $userid,
        $DATA = array(
                'hash'    => $hash,
                'uid'     => $userid,
-               'salut'   => $sex,
+               'gender'   => $gender,
                'surname' => SQL_ESCAPE($_POST['surname']),
                'family'  => SQL_ESCAPE($_POST['family_name']),
                'email'   => SQL_ESCAPE($_POST['addy']),
                'surname' => SQL_ESCAPE($_POST['surname']),
                'family'  => SQL_ESCAPE($_POST['family_name']),
                'email'   => SQL_ESCAPE($_POST['addy']),
@@ -471,6 +467,6 @@ array(
        // Display registration form
        LOAD_TEMPLATE("guest_register");
 }
        // Display registration form
        LOAD_TEMPLATE("guest_register");
 }
-CLOSE_TABLE();
+
 //
 ?>
 //
 ?>