Exemplo n.º 1
0
 public function post_register()
 {
     $rules = array('regName' => 'required|match:/[a-z]+/', 'regLastName' => 'required|match:/[a-z]+/', 'regMail' => 'required|unique:users,email', 'regMail2' => 'required', 'regPassword' => 'required|max:18|min:3', 'regPassword2' => 'same:regPassword', 'regDate' => 'before:01/01/1998', 'regCell' => 'required');
     $vld = Validator::make(Input::all(), $rules);
     if ($vld->fails()) {
         $getCity = City::all();
         $get1stTowns = Town::where('city_id', '=', 1)->get();
         return View::make('user.register')->with('city', $getCity)->with('towns', $get1stTowns);
     }
     $data = Input::all();
     //Gender Validation
     if ($data['regGender'] === 'Woman') {
         $data['regGender'] = 0;
     } elseif ($data['regGender'] === 'Man') {
         $data['regGender'] = 1;
     } else {
         $data['regGender'] = -1;
     }
     //Date Validation
     $MySQLDate = date('Y-m-d', strtotime(str_replace('/', '-', $data['regDate'])));
     try {
         // create the user
         $user = Sentry::user()->register(array('email' => $data['regMail'], 'password' => $data['regPassword'], 'metadata' => array('first_name' => $data['regName'], 'last_name' => $data['regLastName'], 'birth_date' => $MySQLDate, 'city' => $data['regCity'], 'town' => $data['regTown'], 'phone' => $data['regPhone'], 'cell_phone' => $data['regCell'], 'sex' => $data['regGender'])));
         if ($user) {
             // the user was created
             $_user = Sentry::user($user['id']);
             $link = URL::Base() . '/user/activate/' . $user['hash'];
             $name = $_user->metadata['first_name'] . ' ' . $_user->metadata['last_name'];
             $to = $_user['email'];
             sendActivation($to, $name, $link);
         } else {
             return Response::error('500');
         }
     } catch (Sentry\SentryException $e) {
         return View::make('user.register')->with('error', $e->getMessage());
     }
     return View::make('user.register-complete');
 }
Exemplo n.º 2
0
                $logJoin->logInfo('result: '.$result);
                
                $sql = "SELECT player_id from $playerstable where name = '$name'";
                $result = mysql_query($sql);
                $row = mysql_fetch_array($result);
                $player_id = $row['player_id'];
                
                echo $createdmsg;
                if ($country == "No country") {
                  echo $nocountrymsg;
                }
                
                if (startsWith($ip, "41.") || startsWith($ip, "197.") || startsWith($ip, "105.")) {
                  $logJoin->logInfo('Not sending activation email for IP='.$ip);
                } else {
                  sendActivation($player_id, $logJoin);
                }
              }
            }
          }
        }
      }    
    }
    else {

      if (!isset($_GET['sid']) && $signupEmailRequired) {
        ?>
        <table class="layouttable" width="600"><tr><td>
        <p style="margin-bottom:10px">To get a quick overview, check out our <a href="/faq.php">FAQ</a>. We currently support these games: <?= getVersionsImagesNoSpace(getSupportedVersions()) ?></p>
        <p style="margin-bottom:10px">To be allowed to sign up for the league, please send an email <b>in English language</b> to <b><?= $admin_signup ?><?= $mailDomain ?></b> and tell us briefly  
        why you want to join - no lengthy explanations needed.</p>
Exemplo n.º 3
0
    $stmt->setFetchMode(PDO::FETCH_CLASS, 'User');
    if ($user = $stmt->fetch()) {
        //check if the user is already activated
        if ($user->sPassword != "" && $user->activated == 1) {
            header('Location: index.php?register&notactivated');
        }
    } else {
        header('Location: index.php?register&notfound');
    }
    if ($user->Eaddress == "") {
        echo "Redirecting to fill in email...";
        // update password
        $stmt = $db->prepare('UPDATE tblempall SET sPassword = :sPassword WHERE EmpNum = :EmpNum');
        $stmt->execute(array(':EmpNum' => $EmpNum, ':sPassword' => $password));
        header('Location: index.php?register&req_email&empNum=' . $EmpNum);
    } else {
        echo "Sending activation email";
        // update password and send email to activate
        $stmt = $db->prepare('UPDATE tblempall SET sPassword = :sPassword WHERE EmpNum = :EmpNum');
        $stmt->execute(array(':EmpNum' => $EmpNum, ':sPassword' => $password));
        sendActivation($user->Eaddress, $EmpNum);
    }
} else {
    if (isset($_POST['email']) && isset($_POST['empNum'])) {
        // update the email and send email to activate
        $stmt = $db->prepare('UPDATE tblempall SET Eaddress = :email WHERE EmpNum = :EmpNum');
        $stmt->execute(array(':EmpNum' => $_POST['empNum'], ':email' => $_POST['email']));
        echo "Sending activation 2";
        sendActivation($_POST['email'], $_POST['empNum']);
    }
}