Esempio n. 1
0
 if ($_POST['birthdate'] == '') {
     #$error .= "birthdate is required!.<br/>";
 }
 if ($_POST['gender'] == '') {
     #$error .= "gender is required!.<br/>";
 }
 if (countfield("username", $_POST['username']) != 0) {
     $error .= "Username is already exist try another!.<br/>";
 }
 if (countfield("email", $_POST['email']) != 0) {
     #	$error .= "Email is already exist try another!.<br/>";
 }
 if ($_POST['password'] != $_POST['password2']) {
     $error .= "Password do not match.<br/>";
 }
 if (countfield("code_id", $_POST['code_value']) != 0) {
     $error .= "Code entered is already use by another user.<br/>";
 }
 if (countresult("SELECT * FROM tbl_code WHERE code_value='" . $_POST['code_value'] . "' AND code_pin='" . $_POST['code_pin'] . "'") == 0) {
     $error .= "Code Value and PIN does not match or not exist.<br/>";
 } else {
     if ($_POST['refer'] != '') {
         $codeq = mysql_query("SELECT * FROM tbl_code WHERE code_value='" . $_POST['code_value'] . "' AND code_pin='" . $_POST['code_pin'] . "'");
         $rowcode = mysql_fetch_assoc($codeq);
         $referq = mysql_query("SELECT b.code_package FROM tbl_accounts as a JOIN tbl_code as b WHERE b.code_value=a.code_id AND a.accounts_id='" . $_POST['refer'] . "'");
         $rowrefer = mysql_fetch_assoc($referq);
         //exit("SELECT b.code_package FROM tbl_accounts as a JOIN tbl_code as b WHERE b.code_value=a.code_id AND a.accounts_id='".$_POST['refer']."'");
         //echo $rowcode['code_package']."==".$rowrefer['code_package'];
         if ($rowcode['code_package'] != $rowrefer['code_package']) {
             $error .= "Your referrer is not same package as yours.<br/>";
         }
Esempio n. 2
0
<?php 
session_start();
require_once "./connect.php";
require_once "./function.php";
$accounts_id = $_SESSION['accounts_id'];
if ($_POST['submit'] != '') {
    if (countfield("email", $_POST['email']) != 0 && $_POST['email'] != $_SESSION['email']) {
        $error .= "<i class=\"fa fa-warning\"></i>Email is already exist.<br>";
    }
    if ($error == '') {
        $_SESSION['email'] = $_POST['email'];
        unset($_POST['submit']);
        $fields = formquery($_POST);
        mysql_query("UPDATE tbl_accounts SET {$fields} WHERE accounts_id='{$accounts_id}'");
        $success = 1;
    }
}
$field[] = array("type" => "text", "value" => "username", "attr" => "disabled");
$field[] = array("type" => "password", "value" => "password", "attr" => "disabled");
$field[] = array("type" => "email", "value" => "email");
//
$q = mysql_query("SELECT * FROM tbl_accounts WHERE accounts_id='{$accounts_id}'");
$row = mysql_fetch_assoc($q);
foreach ($field as $f) {
    ${$f}['value'] = $row[$f['value']];
}
?>
<h2>Edit Profile</h2>   
<?php 
if ($error != '') {
    ?>