Location: PHPKode > projects > MapleStory Register > register_do.php
<?php
    /*
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    */
    session_start();
    include("functions.php");
    print '<title>Maple Story Register with Image Verification v2</title>';
    $name = mysql_real_escape_string(trim($_POST['username']));
    $pass = mysql_real_escape_string(sha1($_POST['password']));
    $email = mysql_real_escape_string(trim($_POST['email']));
    $dt = mysql_real_escape_string(trim($_POST['dob']));
    $code = mysql_real_escape_string(trim($_POST['code']));
    $sel = 'SELECT * FROM accounts WHERE name="'.$name.'"';
    if (strtoupper($_POST['code']) == $_SESSION['code']) {
        echo '<script type="text/javascript">alert("Congradulations, You have entered the Security code correctly.")</script>';
    } else {
        echo '<script type="text/javascript">alert("You have entered a wrong Security code, Please try again!")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php">';
        exit();
    }
    if ($name == "") {
        echo '<script type="text/javascript">alert("No Username Inserted")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php">';
        exit();
    } elseif(mysql_num_rows(mysql_query($sel)) >= 1 ) {
        echo '<script type="text/javascript">alert("Were Sorry '.$name.' already Exsist")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php">';
        exit();
    } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
        echo '<script type="text/javascript">alert("Sorry - '.$email.' Is not a valid Email.")</script>';
    } else {
        echo '<script type="text/javascript">alert("You have successfuly entered a correct email.")</script>';
    }
    if ($pass == "") {
        echo '<script type="text/javascript">alert("No password filled in")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php">';
        exit();
    }
    $arr = split("-", $dt); // splitting the array
    $yy = $arr[0] - 0; // first element of the array is year
    $mm = $arr[1] - 0; // second element is month
    $dd = $arr[2] - 0; // third element is date
    if (!checkdate($mm, $dd, $yy)) {
        echo '<script type="text/javascript">alert("Invalid date double check they way you entered it. Your date must look like this Year-Month-Day")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php">';
    } else {
        $d = 'INSERT INTO accounts (name, password, email, birthday) VALUES ("'.$name.'", "'.$pass.'", "'.$email.'", "'.$dob.'")';
        mysql_query($d) OR die (mysql_error());
        echo '<script type="text/javascript">alert("Dear - '.$name.' you may now login to our game servers.")</script>';
    }
    //End of script
?>
Return current item: MapleStory Register