junhill.php




    Admin Page:: New Broker/Agent



    New Broker/Agent




    Fill up the form below to insert User data in the system.


    require_once("db_const.php");
    if (!isset($_POST['submit'])) {
    ?>

    Category ::   


    Required Fields   
       
    *First Name:: *Last Name::
    *Display Name:: *Email::
    *Office:: *Office Phone::
    *Office Address:: *MLS ID::
    Login Field(s)   
       
    User ID:: Password::
    Other Information   
       
    Title:: Home Phone::
    Home Fax:: Office Fax::
    Mobile Number:: Page Number::
    Website:: CC Email::
    Bio   
       
     

     

    } else {
    ## connect mysql server
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    # check connection
    if ($mysqli->connect_errno) {
    echo "

    MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}

    ";
    exit();
    }
    ## query database
    # prepare data for insertion
    $userlevel = $_POST['userlevel'];
    $userfname = $_POST['userfname'];
    $userlname = $_POST['userlname'];
    $userdname = $_POST['userdname'];
    $useremail = $_POST['useremail'];
    $useroffice = $_POST['useroffice'];
    $userofficephone = $_POST['userofficephone'];
    $userofficeaddress= $_POST['userofficeaddress'];
    $usermlsid = $_POST['usermlsid'];
    $userid = $_POST['userid'];
    $userpassword = $_POST['userpassword'];
    $usertitle = $_POST['usertitle'];
    $userhomephone = $_POST['userhomephone'];
    $userhomefax = $_POST['userhomefax'];
    $userofficefax = $_POST['officefax'];
    $usermobilenumber= $_POST['usermobilenumber'];
    $userpagernumber = $_POST['userpagernumber'];
    $userurl = $_POST['userurl'];
    $userccemail = $_POST['userccemail'];
    $userbio = $_POST['userbio'];
    //$verified = $_POST['verified'];
    //$active = $_POST['active'];
    //$featured_list = $_POST['featured_list'];

    # check if username and email exist else insert
    $exists = 0;

    $result = $mysqli->query("SELECT userid from tbl_broker_agent WHERE userid = '{$userid}' LIMIT 1");
    if ($result->num_rows == 1) {
    $exists = 1;}

    $result = $mysqli->query("SELECT usermlsid from tbl_broker_agent WHERE usermlsid = '{$usermlsid}' LIMIT 1");
    if ($result->num_rows == 1) {$exists = 2; }

    $result = $mysqli->query("SELECT useremail from tbl_broker_agent WHERE useremail = '{$useremail}' LIMIT 1");
    if ($result->num_rows == 1) {$exists = 3; }

    if ($exists == 1){
    echo ("");
    }
    else if ($exists == 2){
    echo ("");
    }
    else if ($exists == 3){
    echo ("");
    }

    else{

    # insert data into mysql database
    $sql="INSERT INTO tbl_broker_agent (userlevel, userfname, userlname, userdname, useremail, useroffice, userofficephone, userofficeaddress, usermlsid, userid, userpassword, usertitle, userhomephone, userhomefax, userofficefax, usermobilenumber, userpagernumber, userurl, userccemail, userbio)
    VALUES
    ('$_POST[userlevel]','$_POST[userfname]','$_POST[userlname]','$_POST[userdname]','$_POST[useremail]','$_POST[useroffice]','$_POST[userofficephone]','$_POST[userofficeaddress]','$_POST[mlsid]','$_POST[userid]','$_POST[userpassword]','$_POST[usertitle]','$_POST[userhomephone]','$_POST[userhomefax]','$_POST[userofficefax]','$_POST[usermobilenumber]','$_POST[userpagernumber]','$_POST[userurl]','$_POST[userccemail]','$_POST[userbio]')";

    if ($mysqli->query($sql)) {
    //echo "New Record has id ".$mysqli->insert_id;
    echo ("");
    } else {
    echo "

    MySQL error no {$mysqli->errno} : {$mysqli->error}

    ";
    exit();
    }
    }

    }
    ?>