private function check_input()
 {
     if ($this->mode == 1) {
         if ($this->check_dupli() > 0) {
             $this->err_msg[] = "同じアカウントが既に存在します。";
         }
     }
     $this->err_msg[] = indi_check($this->account, "アカウント");
     // hannum_check 半角英数
     // $this->err_msg[] = hannum_check($this->account,"アカウント");
     // 8文字制限
     $this->err_msg[] = max_length_check($this->account, 8, "アカウント");
     $this->err_msg[] = indi_check($this->user_name, "名前");
     $this->err_msg[] = max_length_check($this->user_name, 30, "名前");
     $this->err_msg[] = mail_check($this->mail_address, "E-mail");
     $this->err_msg[] = max_length_check($this->mail_address, 50, "E-mail");
 }
 public function update()
 {
     if (mail_check(POST('mail')) === false) {
         echo 'Votre adresse est invalide';
     } else {
         if (isset($_POST['mail']) && isset($_POST['pwd0'])) {
             $mail = POST('mail');
             $password = POST('pwd0');
             if ($password !== POST('pwd1')) {
                 //do not match
                 return;
             }
             /*if (!mail_check($mail))
               {
                   $_SESSION['INSCRIPTION_FAILURE'] = "Adresse Email Non Valide !";
                   unset($_SESSION['INSCRIPTION_FAILURE']);
                   return;
               }*/
             $name = POST('fName');
             $crypt = true;
             $key = random_string_token(10, $crypt);
             $this->model->select_user_by_mail();
             $this->model->select($mail);
             $this->model->join('PASSWORD');
             $this->model->update();
             if ($this->model->rowCount() === 0) {
                 //user not found -> good case
                 $user = new User('0', $mail, $name, 0);
                 $this->model->create_new_user($user, $password, $key);
                 $destinataire = $mail;
                 $sujet = "Activation de votre compte";
                 $entete = "From: Equipe@aaron-aaron.com";
                 $message = "Bienvenue sur Aaron,\n\n                Pour activer votre compte, veuillez cliquer sur le lien ci-dessous\n                ou copier/coller dans votre navigateur internet.,\n                http://aaron-aaron.alwaysdata.net/confirmation/{$key}\n\n               ---------------\n               Ceci est un mail automatique, Merci de ne pas y répondre.";
                 mail($destinataire, $sujet, $message, $entete);
                 echo "Un mail vous a été envoyé sur votre adresse mail, veuillez suivre les indications pour\n                continuer votre inscription.";
             } else {
                 //mail already exists;
                 //$_SESSION["INSCRIPTION_FAILURE"] = "Cette adresse email existe déjà dans nos bases de données !";
             }
         }
     }
 }
Exemple #3
0
function proc_new_account()
{
    global $standard_scan_radius;
    $name = trim($_POST["username"]);
    $imperium = trim($_POST["imperium"]);
    $email = trim($_POST["email"]);
    $password = trim($_POST["password"]);
    $password2 = trim($_POST["password2"]);
    $error = "";
    if ($name == "") {
        $error = $error . "No name selected!<br>";
    }
    $sth = mysql_query("select * from users where name='{$name}'");
    if (mysql_num_rows($sth) > 0) {
        $error = $error . "Name already selected!<br>";
    }
    if ($imperium == "") {
        $error = $error . "No empire selected!<br>";
    }
    $sth = mysql_query("select imperium from users where imperium='{$imperium}'");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    if (mysql_num_rows($sth) > 0) {
        $error = $error . "empire already selected!<br>";
    }
    if (!mail_check($email)) {
        $error = $error . "You must enter a valid email!<br>";
    }
    $sth = mysql_query("select email from users where email='{$email}'");
    if (mysql_num_rows($sth) > 0) {
        $error = $error . "Email already exists<br>";
    }
    if ($password != $password2) {
        $error = $error . "Passwords don't match!<br>";
    }
    if (strlen($password) < 4) {
        $error = $error . "Your Password must contain at least 4 characters!";
    }
    if (strlen($error) == 0) {
        $sth = mysql_query("insert into users (name,imperium,email,password) values ('{$name}','{$imperium}','{$email}','" . crypt($password) . "')");
        if (!$sth) {
            show_error("Database Failure!");
            return 0;
        }
        $uid = mysql_insert_id();
        $sth = mysql_query("insert into ressources (metal,energy,mopgas,erkunum,gortium,susebloom,colonists,money,uid) values ('1000','1000','0','0','0','0','5','1000000','{$uid}')");
        if (!$sth) {
            show_error("Database Failure!");
            return 0;
        }
        $start = startplanet();
        $sth = mysql_query("update planets set uid='{$uid}',population='1000000' where id='" . $start . "'");
        if (!$sth) {
            show_error("Database Failure!");
            return 0;
        }
        $sth = mysql_query("insert into popgain set pid=" . $start);
        if (!$sth) {
            show_error("ERR::SET POPGAIN");
            return 0;
        }
        $sth = mysql_query("update users set homeworld={$start} where id='" . $uid . "'");
        if (!$sth) {
            show_error("Database Failure!");
            return 0;
        }
        $sth = mysql_query("select p.sid,s.cid from planets p,systems s where p.id=" . $start . " and p.sid=s.id");
        if (!$sth) {
            show_error("ERR::GET SID");
            return 0;
        }
        list($sid, $cid) = mysql_fetch_row($sth);
        $sth1 = mysql_query("replace into __scanranges_" . $cid . " (sid,uid,type,range,last_update) values ('" . $sid . "','" . $uid . "','0','" . $standard_scan_radius . "','" . $time . "')");
        mt_srand((double) microtime() * 1000000);
        $act_code = mt_rand(100000, 99999999);
        $sth = mysql_query("insert into activationcodes (code,uid) values ('" . $act_code . "','{$uid}')");
        // WIIIIIICHTIG!
        $sth = mysql_query("insert into research (uid,t_id) values ('{$uid}','0')");
        $sth = mysql_query("insert into research (uid,t_id) values ('{$uid}','1')");
        $sth = mysql_query("update users set skin=1 where id={$uid}");
        $the_mail = "Welcome to the Pre-Beta-Round Regent!\n\nYour Login: {$name}\nYour Empire: {$imperium}\nYour Pass: {$password}\nYour Activationcode: {$act_code}\n\nTo activate your account click on the following link:\n\nhttp://www.spaceregents.de/spaceregents/login.php?act=activate\n\nPlease not that this is a TEST(!)-Round. That means that SpaceRegents\nmay still be full of bugs and unimplemented features. As a tester you\nare supposed to report any bugs you encounter and report them in\nour forums. You can and (maybe should ;) ) try to hack our scripts\nbut you should (again) report any successfull hacks in the forum.\n\nLast but not least: Good luck and have fun ;)\n\nThe SpaceRegents Team\n";
        mail($email, "Your Spaceregents Activation Code", $the_mail, "From: webmaster@spaceregents.de\nReply-To: webmaster@spaceregents.de\nX-Mailer: PHP/" . phpversion());
        ticker($uid, "*lmail.php*Hi and welcome to SpaceRegents. A mail with quickstart instructions is in your Inbox. Click here to see your Inbox.", "w");
        $quickstart = "Welcome to Spaceregents, the ultimate Space Strategy!\n\nThis is a short quickstart and should give you the\nfirst hints on how to play SpaceRegents.\n\nOn the left you'll find your buddy list and the\nNavgationpanel.\n\nNavigationbuttons (in top-down order):\n\nOverview (the page you saw when logging in)\nCommunication (Communiction, Alliance menus.)\nRanking\nPlanets and Production (Planets, Build menu)\nFleet (Fleetmanagement)\nMap (The SpaceRegents starmap)\nResearch\nCovertops (Espionage and sabotage your enemies)\nTrade (Trading of ressources)\n\nFurthermore you'll see the Preferences and Logout\nbuttons in the lower left corner.\n\nFirst you should start your research and build\nsomething on a planet (Metal mine is recommended).\nThe time is estimated in weeks. 1 week in\nSpaceRegents is equal to 1 hour in reality.\nAfter that you should have a look at the Map (make\nsure you have a supported SVG Viewer on your\nsystem) to get an idea where you are located and\nwho is in your neighbourhood. If you want you can\nexamine the alliances which exist in Spaceregents\nso far. As a neutral player you can't be attacked\nbut you have several limitations in the game. If\nyou join an alliance you don't have these\nlimitations but you can be attacked. So you are\nsafe for now but should consider to join/create an\nalliance soon. It may be a good idea to contact\nyour direct neighbours as well.\n\nThis should have given you a first glance at\nSpaceRegents. More about the features of\nSpaceregents is explained in the manual. If you\nneed help feel free to join the forum and post\nyour questions there.\n\nGood luck and have fun!\n\nThe Spaceregents Team.";
        mail_to_uid($uid, "Quickstart", $quickstart);
        // runelord: options setzen
        $sth = mysql_query("insert into options (uid, map_size) values(" . $uid . ",1)");
        if (!$sth) {
            show_error("Database Failure!");
            return 0;
        }
        // geben wir noch jedem ein scout :)
        // nächste freie fleet_id finden
        $sth = mysql_query("select if(max(fid) is NULL,1,max(fid)+1) from fleet_info");
        if (!$sth) {
            show_error("Database Failure!");
            return 0;
        }
        list($next_fid) = mysql_fetch_row($sth);
        // eintrag in fleet_info
        $sth = mysql_query("insert into fleet_info (fid, pid, sid, name, uid) values('{$next_fid}','{$start}','{$sid}','Explorer','{$uid}')");
        if (!$sth) {
            show_error("Database Failure! 2x");
            return 0;
        }
        $sth = mysql_query("insert into fleet values (2,1,0,'{$next_fid}')");
        if (!$sth) {
            show_error("Database Failure! 3x");
            return 0;
        }
        $sth = mysql_query("insert into income_stats set uid=" . $uid);
        if (!$sth) {
            show_error("ERR::INCOME STATS");
            return 0;
        }
        activate("new_account");
    } else {
        new_account($error);
    }
}
 public function display()
 {
     ///////////////////////////////////////////////////////////////////////////////////ADMIN////////////////////////////////////////////////////////////////////////////////
     //Enable or disable or delete a user
     if (isset($_POST['enableOrDisable'])) {
         $task = substr(POST('enableOrDisable'), 0, 3);
         // ena ou dis
         $idUser = substr(POST('enableOrDisable'), 3);
         // ex : 69
         if ($task == "del") {
             $this->model->deleteUser($idUser);
         } else {
             $this->model->enableOrDisableUser($task, $idUser);
         }
     } else {
         if (isset($_POST['userToFind'])) {
             $rep = $this->model->userToFindAndToDisplay(POST('userToFind'));
             echo $rep;
         } else {
             if (isset($_POST['imgToTest'])) {
                 echo isImageURL(POST('imgToTest'));
             } else {
                 if (isset($_POST['titreArticle']) && isset($_POST['themeArticle']) && isset($_POST['urlImgArticle']) && isset($_POST['contentArticle'])) {
                     $articleToAdd = array();
                     array_push($articleToAdd, POST('titreArticle'));
                     array_push($articleToAdd, POST('themeArticle'));
                     array_push($articleToAdd, POST('urlImgArticle'));
                     array_push($articleToAdd, POST('contentArticle'));
                     $this->model->addArticle($articleToAdd);
                 } else {
                     if (isset($_POST['linkImgFavorite']) && isset($_POST['idRSSFeed']) && isset($_POST['idCategory'])) {
                         if (POST('linkImgFavorite') === "http://aaron-aaron.alwaysdata.net/src/images/favorite_on.png") {
                             $value = "off";
                         } else {
                             $value = "on";
                         }
                         $this->model->changeFavoriteRSSFeed($value, POST('idRSSFeed'), POST('idCategory'));
                     } else {
                         if (isset($_POST['urlToFocus'])) {
                             $rep = $this->model->focusToThisRSSFeed(POST('urlToFocus'));
                             echo $rep;
                         } else {
                             if (isset($_POST['idRSSFeedToDeleteOfACategory']) && isset($_POST['idCategory'])) {
                                 $this->model->RSSFeedToDeleteOfACategory(POST('idRSSFeedToDeleteOfACategory'), POST('idCategory'));
                             } else {
                                 if (isset($_POST['nameFluxAdd']) && isset($_POST['nameCategorieToAdd']) && isset($_POST['urlFluxAdd'])) {
                                     $sValidator = 'http://feedvalidator.org/check.cgi?url=';
                                     if ($sValidationResponse = @file_get_contents($sValidator . urlencode(POST('urlFluxAdd')))) {
                                         if (stristr($sValidationResponse, 'This is a valid RSS feed') !== false) {
                                             $this->model->addRSSFeedCategoryUser(POST('nameFluxAdd'), POST('nameCategorieToAdd'), POST('urlFluxAdd'));
                                             return;
                                         } else {
                                             echo "false";
                                             return;
                                         }
                                     } else {
                                         echo "false";
                                         return;
                                     }
                                 } else {
                                     if (isset($_POST['nameCategorie']) && isset($_POST['colorCategorie'])) {
                                         $tab = array();
                                         array_push($tab, POST('nameCategorie'));
                                         array_push($tab, POST('colorCategorie'));
                                         $this->model->addCategory($tab);
                                     } else {
                                         if (isset($_POST['catToDelete'])) {
                                             $rep = $this->model->catToDelete(POST('catToDelete'));
                                         } else {
                                             if (isset($_POST['allCategories'])) {
                                                 $rep = $this->model->allCategories();
                                                 echo $rep;
                                             } else {
                                                 if (isset($_POST['idFriendFocus'])) {
                                                     $rep = $this->model->friendBlog(POST('idFriendFocus'));
                                                     echo $rep;
                                                 } else {
                                                     if (isset($_POST['idFriendDelete'])) {
                                                         $this->model->deleteOneFriend(POST('idFriendDelete'));
                                                     } else {
                                                         if (isset($_POST['userToAddInFriend'])) {
                                                             $this->model->userToAddInFriend(POST('userToAddInFriend'));
                                                         } else {
                                                             if (isset($_POST['loadMail'])) {
                                                                 $res = $this->model->loadMail(POST('loadMail'));
                                                                 echo $res;
                                                             } else {
                                                                 if (isset($_POST['emailName']) && isset($_POST['emailPassword']) && isset($_POST['emailServer']) && isset($_POST['emailPort'])) {
                                                                     $this->model->addMail(POST('emailName'), POST('emailPassword'), POST('emailServer'), POST('emailPort'));
                                                                 } else {
                                                                     if (isset($_POST['deleteMail'])) {
                                                                         $this->model->deleteMail(POST('deleteMail'));
                                                                     } else {
                                                                         if (isset($_POST['searchTwitter'])) {
                                                                             $this->model->searchTwitter(POST('searchTwitter'));
                                                                         } else {
                                                                             if (isset($_POST['loadTwitter'])) {
                                                                                 $res = $this->model->loadTwitter(POST('loadTwitter'));
                                                                                 echo $res;
                                                                             } else {
                                                                                 if (isset($_POST['deleteTwitter'])) {
                                                                                     $this->model->deleteTwitter(POST('deleteTwitter'));
                                                                                 } else {
                                                                                     if (isset($_POST['nameInformation']) && isset($_POST['emailInformation']) && isset($_POST['imgInformation'])) {
                                                                                         if (POST('nameInformation') !== "false") {
                                                                                             $this->model->changeName(POST('nameInformation'));
                                                                                         }
                                                                                         if (POST('emailInformation') !== "false") {
                                                                                             if (mail_check(POST('emailInformation'))) {
                                                                                                 $this->model->changeEmail(POST('emailOption'));
                                                                                             }
                                                                                         }
                                                                                         if (POST('imgInformation') !== "false") {
                                                                                             $this->model->changeImg(POST('imgInformation'));
                                                                                         }
                                                                                     } else {
                                                                                         if (isset($_POST['disconnectUser'])) {
                                                                                             session_destroy();
                                                                                             header('Location:http://aaron-aaron.alwaysdata.net');
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     ////////////////////////////////////////////////////////////////////////////////~OPTIONS/////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////~FOR A USER//////////////////////////////////////////////////////////////////////////////
 }
    if (!strlen(trim($_POST['tx_subject']))) {
        set_err('tx_subject', 'Subject is required');
    }
    if (!strlen(trim($_POST['tx_name']))) {
        set_err('tx_name', 'Name is required');
    } else {
        if (!q_singleval("SELECT id FROM phpgw_fud_users WHERE alias='" . addslashes(htmlspecialchars($_POST['tx_name'])) . "'")) {
            set_err('tx_name', 'Invalid user');
        }
    }
    return $GLOBALS['error'];
}
if (isset($_GET['toi']) && (int) $_GET['toi']) {
    $_POST['tx_name'] = q_singleval('SELECT alias FROM phpgw_fud_users WHERE id=' . (int) $_GET['toi']);
} else {
    if (isset($_POST['btn_submit']) && !mail_check()) {
        if (!($email = q_singleval("SELECT email FROM phpgw_fud_users WHERE alias='" . addslashes(htmlspecialchars($_POST['tx_name'])) . "' AND (users_opt & 16) > 0"))) {
            error_dialog('ERROR: Unable to email', 'Sorry, the system was unable to email ' . htmlspecialchars($_POST['tx_name']) . ' because it was unable to locate his email address');
        }
        send_email($usr->email, $email, $_POST['tx_subject'], $_POST['tx_body'], 'Reply-To: ' . $usr->email);
        check_return($usr->returnto);
    }
}
$tx_name = isset($_POST['tx_name']) ? $_POST['tx_name'] : '';
$tx_body = isset($_POST['tx_body']) ? $_POST['tx_body'] : '';
$tx_subject = isset($_POST['tx_subject']) ? $_POST['tx_subject'] : '';
/* start page */
$TITLE_EXTRA = ': Email Form';
$name_err = get_err('tx_name');
$sub_err = get_err('tx_subject');
$body_err = get_err('tx_body');