0byt3m1n1
Path:
C:
/
Users
/
Administrator
/
Desktop
/
CWRDM Backup
/
cpms_new
/
ADMIN
/
[
Home
]
File: createuser_ctrl.php
<?php require_once "../model/employee_mdl.php"; //include("../model/employee_mdl.php"); //$arr_img_type = array( "image/bmp" => "bmp", "image/gif" => "gif", // "image/jpeg" => "jpeg", "image/png" => "png", "image/pjpeg" => "jpeg"); $salutation = ""; $name = ""; $username = ""; $password = ""; $designation = ""; $error_flag = 0; $username = @$_POST['txtusername']; $password = @$_POST['txtpassword']; $name = @$_POST['txtname']; $designation = @$_POST['txtdesignation']; $salutation = @$_POST['salutation']; $coinvestigator = @$_POST['txtcoinvestigator']; $division = @$_POST['division']; if(!empty($coinvestigator)) { $coinvestigator = implode(",", $coinvestigator); } //---------Null---/ if ($username == "") { $error['username_null'] = "Please Enter username"; $error_flag = 1; } if ($password == "") { $error['password_null'] = "Please Enter password"; $error_flag = 1; } if ($name == "") { $error['name_null'] = "Please Enter Name"; $error_flag = 1; } if ($designation == "") { $error['designation_null'] = "Please Enter Designation"; $error_flag = 1; } if ($salutation == "") { $error['salutation_null'] = "Please Enter Salutation"; $error_flag = 1; } $employee = new Employee(); $result = $employee->userNameCheck($username); If ($result == "True") { $error_flag = 1; $error['username_exist'] = "user name exists."; } if ($error_flag == 1) { include("createuser.php"); exit(); } else { $uploadOk= FALSE; $check = getimagesize($_FILES["photo"]["tmp_name"]); if($check !== false) { $uploadOk = TRUE; } $type = $_FILES['photo']['type']; $ph_name = $_FILES['photo']['name']; $ph_name = rand(10000, 99999999) . $ph_name; $target_dir = "../photo/"; $target_file = $target_dir . basename($ph_name); if ($uploadOk) { if (!move_uploaded_file($_FILES['photo']['tmp_name'], $target_file)) { $message = "Photo not uploaded. Registration Failed."; $url = $server_ip . "/ADMIN/createuser.php?message=$message"; echo "<script>window.location='$url'</script>"; exit(); } $employee = new Employee(); $result = $employee->addUser($username, $password, $name, $designation, $salutation, $coinvestigator, $target_file,$division); if ($result == "True") { $message = "Registration Completed successfully.."; $url = $server_ip . "/ADMIN/createuser.php?message=$message"; echo "<script>window.location='$url'</script>"; exit(); } else { $message = "Registration Failed."; $url = $server_ip . "/ADMIN/createuser.php?message=$message"; echo "<script>window.location='$url'</script>"; exit(); } } else { $message = "Invalid image."; $url = $server_ip . "/ADMIN/createuser.php?message=$message"; echo "<script>window.location='$url'</script>"; exit(); } } ?>