Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $url='http://192.168.2.21:8080/WisManOnlineCenter_1.0/services/trial/getOrganizationHierarchy';
- $ch=curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($useridofuser));
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
- $response= curl_exec($ch);
- echo('\n'."Server response : \n \n".$response);
- curl_close($ch);
- //parsing the json response from server
- $jsonde="$response";
- $_SESSION['json']=$jsonde;
- $org = array();
- $loc = array();
- $bui = array();
- $items = json_decode($response);
- foreach( $items as $each ){
- $loc[]=$each->location[0]->name;
- $bui[]=$each->location[0]->building[0];
- $org[]=$each->name;
- }
- ?>
- <html>
- <head>
- <title>Login Form</title>
- <script>
- function validate()
- {
- var vusername=trim(document.theForm.username.value);
- var vpassword=trim(document.theForm.password.value);
- var vpassword1=trim(document.theForm.password1.value);
- var vemail=trim(document.theForm.email.value);
- var vdepartment=trim(document.theForm.department.value);
- var vfirstname=trim(document.theForm.firstname.value);
- var vlastname=trim(document.theForm.lastname.value);
- var vlandphone=trim(document.theForm.landphone.value);
- var vmobile=trim(document.theForm.mobile.value);
- var vexpirydate=trim(document.theForm.expirydate.value);
- var vimage=trim(document.theForm.image.value);
- var vopcode=trim(document.theForm.opcode.value);
- if(vusername=="")
- {
- alert("User Name Field is Empty");
- document.theForm.username.focus();
- return false;
- }
- else if(vpassword=="")
- {
- alert("Password Field is Empty");
- document.theForm.password.focus();
- return false;
- }
- else if(vpassword1=="")
- {
- alert("Confirm Password Field is Empty");
- document.theForm.password1.focus();
- return false;
- }
- else if(vemail=="")
- {
- alert("Email Field is Empty");
- document.theForm.email.focus();
- return false;
- }
- else if(vdepartment=="")
- {
- alert("Department Field is Empty");
- document.theForm.department.focus();
- return false;
- }
- else if(vfirstname=="")
- {
- alert("First Name Field is Empty");
- document.theForm.firstname.focus();
- return false;
- }
- else if(vlastname=="")
- {
- alert("Last Name Field is Empty");
- document.theForm.lastname.focus();
- return false;
- }
- else if(vlandphone=="")
- {
- alert("Land Phone Field is Empty");
- document.theForm.landphone.focus();
- return false;
- }
- else if(vmobile=="")
- {
- alert("Mobile Field is Empty");
- document.theForm.mobile.focus();
- return false;
- }
- else if(vexpirydate=="")
- {
- alert("Expiry Date Field is Empty");
- document.theForm.expirydate.focus();
- return false;
- }
- else if(vimage=="")
- {
- alert("Image Field is Empty");
- document.theForm.image.focus();
- return false;
- }
- else if(vopcode=="")
- {
- alert("Opcode Field is Empty");
- document.theForm.opcode.focus();
- return false;
- }
- }
- function trim(s) {
- return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
- }
- function onKeyPressBlockNumbers(e)
- {
- var key = window.event ? e.keyCode : e.which;
- var keychar = String.fromCharCode(key);
- reg = /\d/;
- return !reg.test(keychar);
- }
- function isNumberKey(evt)
- {
- var charCode = (evt.which) ? evt.which : event.keyCode
- if (charCode > 31 && (charCode < 48 || charCode > 57))
- return false;
- return true;
- }
- function run() {
- document.getElementById("srt").value = document.getElementById("Ultra").value;
- }
- function up() {
- //if (document.getElementById("srt").value != "") {
- var dop = document.getElementById("srt").value;
- //}
- pop(dop);
- }
- function pop(val) {
- alert(val);
- }
- </script>
- </head>
- <body><center>
- <div style="margin-top:10px">
- <h3>ADD OPERATOR</h3>
- </div>
- <form name="theForm" method="post" action="addoperator.php" enctype="multipart/form-data" onSubmit="return validate();">
- <table border="0" >
- <tr><td>Username</td>
- <td><input type="text" name="username" onkeypress="return onKeyPressBlockNumbers(event);"></td></tr>
- <tr><td>Password</td>
- <td><input name="password" type="password"></td></tr>
- <tr><td>Confirm Password</td>
- <td><input name="password1" type="password"></td></tr>
- <tr><td>Email</td>
- <td><input name="email" type="email"></td></tr>
- <tr><td>Organisation Name</td>
- <td>
- <select style="width: 155px" name="category_id" id="category_id">
- <option value="">Select</option>
- <?php foreach($org as $key=>$val){?>
- <option value="<?php echo $val; ?>"><?php echo $val;?></option>
- <?php
- }
- ?> </select></td></tr>
- <tr><td>Location</td>
- <td>
- <select style="width: 155px" name="category_id1" id="category_id1">
- <option value="">Select</option>
- <?php foreach($loc as $key=>$val){?>
- <option value="<?php echo $val; ?>"><?php echo $val; ?></option>
- <?php
- }
- ?>
- </select></td></tr>
- <tr><td>Building</td>
- <td>
- <select style="width: 155px" name="category_id2" id="category_id2">
- <option value="">Select</option>
- <?php foreach($bui as $key=>$val){?>
- <option value="<?php echo $val; ?>"><?php echo $val; ?></option>
- <?php
- }
- ?>
- </select></td></tr>
- <tr><td>Department</td>
- <td><select style="width:155px" name="department" id="department">
- <option>Select</option>
- <option>default</option>
- </select></td></tr>
- <?php
- $oneYearOn = date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 7300 day"));
- //echo $oneYearOn;
- $oneYearOn1=date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 40day"));
- //echo $oneYearOn1;
- ?>
- <tr><td>Sub Category</td>
- <td>
- <select style="width:155px" name="subcategory" id="Ultra" onchange="run()">
- <option value="0">Select</option>
- <option value="<?=$oneYearOn?>">Employee</option>
- <option value="<?=$oneYearOn1?>">Temporary</option>
- </select>
- </td>
- </tr> <tr><td>First Name</td>
- <td><input name="firstname" type="text" onkeypress="return onKeyPressBlockNumbers(event);"></td></tr>
- <tr><td>Last Name</td>
- <td><input name="lastname" type="text" onkeypress="return onKeyPressBlockNumbers(event);"></td></tr>
- <tr><td>Land Phone</td>
- <td><input name="landphone" type="number" onkeypress="return isNumberKey(event)"></td></tr>
- <tr><td>Mobile</td>
- <td><input name="mobile" type="number" onkeypress="return isNumberKey(event)"></td></tr>
- <tr><td>Expiry date</td>
- <td><input name="expirydate" type="text" id="srt"><br></td></tr>
- <tr><td>Opcode</td>
- <td><input name="opcode" type="text" onkeypress="return isNumberKey(event)"></td></tr>
- <tr><td>Image</td>
- <td><input type="file" name="file" id="file"></td>
- <tr><td><input type="submit" name="submit" value="Submit"></td></tr>
- </table>
- </form>
- </center>
- </body>
- </html>
- <html>
- <body>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement