View file public_html/vipadz/newstaff.php

File size: 2.64Kb
<?php

/************************************

Script : Adnetwork
Website : http://facebook.com/mohd.arshadsaifi79

Script is created and provided by Arshad (http://facebook.com/mohd.arshadsaifi79)
**************************************/

include '../db.php';
include '../functions.php';

headtag("$SiteName - Add New Staff");

if($adminlog==1){
echo '<div class="title">Add New Staff</div>';
 $aid=formget("id");
if(dump_adata("rank")=='1')
{
 if(isset($_POST['username']) AND isset($_POST['passd']) AND isset($_POST['name']) AND isset($_POST['email']) AND isset($_POST['facebook']) AND isset($_POST['phone']) AND isset($_POST['rank'])){

    $username=formpost("username");
    $passd=formpost("passd");
    $pass=md5($passd);
    $name=formpost("name");
    $email=formpost("email");
    $facebook=formpost("facebook");
    $phone=formpost("phone");
    $rank=formpost("rank");

 $errors=array();

 if(strlen($username)<1){
    $errors[]='Username cannot be empty!';
  }

if(strlen($name)<1){
    $errors[]='Fullname cannot be empty!';
  }

$unch=mysql_query("SELECT * FROM staff WHERE username='$username'");

if(mysql_num_rows($unch)>0){
$errors[]='UserName already registered with another account!';
}

if(!preg_match('/^[\w\-]+$/',$username)){
$errors[]='Invalid Character On Username!';
}

   if(strlen($passd)<1){
    $errors[]='Password cannot be empty!';
  }

   if(strlen($email)<1){
    $errors[]='Email cannot be empty!';
  }
if(!is_numeric($phone)){
 $errors[]='Phone must be a numeric value';
}

  if(empty($errors)){
    
   $date=date("l , F d , Y");
   $cad=mysql_query("INSERT INTO staff (username,pass,name,email,facebook,phone,rank) VALUES ('$username','$pass','$name','$email','$facebook','$phone','$rank')");
   if($cad){
     echo '<div class="success">Staff Created Successfully</div>';
    }

    else {
      echo 'oh lala';
    }
    }
    else {
     dump_error($errors);
    }
   }
 
  echo '<div class="form"><form method="post">Username:<br/><input type="text" name="username"/><br/>Password:<br/><input type="password" name="passd"/><br/>Fullname: <br/><input type="text" name="name"/><br/>Email:<br/><input type="text" name="email"/><br/>Facebook:<br/><input type="text" name="facebook"/><br/>Phone:<br/><input type="text" name="phone"/><br/>Rank:<br/><select name="rank"><option value="3" selected="selected">Account Manager</option><option value="2">Sub Admin</option><option value="1">Head Admin</option></select></br><input type="submit" value="Create Staff"/></form></div>';

}
else {
echo '<div class="error">Access Denied</div>';
}
echo '<div class="page"><a href="index.php"> Go Back To Home</a></div>';
include '../foot.php';
}

else {

header('Location:/');
}
?>