Viewing: generate_user.php
<?php require_once('configuration/configuration.php'); $oComman = new CommonClass(); $oGeneral = new GeneralClass(); $oProduct = new ProductClass(); if($_POST['data_id']!='') { $tableName='`tbl_customer`'; $fldName='`id`'; $id=$_POST['data_id']; $status=$_POST['data_status']; $oProduct->changeStatus($tableName , $id , $fldName , $status); die; } $iPageId = $_SESSION['F_USERID']; // Primery Key for table $oProduct->getUser($iPageId); $aUser = $oProduct->aResults; if($aUser[0]['fld_username']!=$_SESSION['F_USERNAME']) { header('location:login.php?error=2'); } $sMode = $_REQUEST['type']; if($sMode == "") { $sMode = "add"; } if($sMode == 'add') { if(isset($_POST['_hiddenTXT'])) { $sTableName = 'tbl_customer'; $aData = $_POST; $oGeneral->check_duplicate_record($sTableName, 'email', $_POST['email']); $iCount = $oGeneral->icount; if($iCount>0 ) { header('location:add_customer.php?message=1'); } else { $aData['added_by'] = $_SESSION['F_USERID']; $aData['added_date'] = date('Y-m-d h:i:s'); $iPageInsertId = $oGeneral->insert_data($sTableName, $aData); header("Location:add_customer.php?message=2"); } } } else if($sMode=='edit') { $oProduct->getCustomer($_REQUEST['id'],'',$_SESSION['F_USERID']); $aCustomer = $oProduct->aResults; $iCustomer = $oProduct->iResults; if(isset($_POST['_hiddenTXT'])) { $sTableName = 'tbl_customer'; $iPageId=$_REQUEST['id']; $sTblMatchField='id'; $aData = $_POST; $oGeneral->update_data($sTableName, $sTblMatchField, $aData, $iPageId); header("Location: add_customer.php?message=3"); } } if($_REQUEST['type']=='del' && $_REQUEST['did']!='') { $sMatchId = trim($_REQUEST['did']); $sTablName = 'tbl_customer'; $sMatchfield = 'id'; $oGeneral->delete_record($sTablName, $sMatchfield, $sMatchId); header("Location: manage_customer.php?message=4"); } if(isset($_REQUEST['message'])) { header( "refresh:5;url=manage_customer.php" ); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Manage Customer : Performance Application Testing Online</title> <link rel="stylesheet" href="css/bootstrap-datepicker.min.css" /> <link rel="stylesheet" href="css/bootstrap-datepicker3.min.css" /> <?php include("includes/header.php"); ?> <!-- ##### End Nav Bar ##### --> <div class="container"> <!--For slides--> <img src="img/register-banner.png" style="width:100%" > <!--End of slides--> </div> <div class="container text-center" id="easycont"> <div class="row"> <!-- ##### R Side Bar ##### --> <div class="col-md-12 text-left"> <form class="well form-horizontal" action="" method="post" id="contact_form"> <?php $oProduct->getCustomer('','',$_SESSION['F_USERID']); $aCustomer = $oProduct->aResults; $iCustomer = $oProduct->iResults; ?> <br> <?php if(isset($_REQUEST['message'])) { if($_REQUEST['message']==4) { ?> <div id="close" class="alert alert-danger"> <span class="vd_alert-icon"><i class="fa fa-exclamation-circle vd_red"></i></span> One Row is Deleted Successfully. </div> <?php } } ?> <div class="panel widget"> <div class="panel-body-list table-responsive"> <div class="col-md-6 text-left"> <div class="panel panel-default"> <div class="panel-heading">Get Random User</div> <div class="panel-body"> <p>Clicking on 'Get New User' button will get new user</p> <p>Loading icon will be displayed until the request is processed</p> <div id="loading"></div> <br/><br/> <button type="button" class="btn btn-default" id="save">Get New User</button> </div> </div> </div> <div class="col-md-6 text-left"> <div class="panel panel-default"> <div class="panel-heading">User feedback form</div> <div class="panel-body" style="padding:10px 32px;"> <form id="frm" method="post" > <div class="form-group"> <span class="title-validation validation-error"></span> <label for="usr">Name:</label> <input type="text" name="title" id="title" class="form-control"> </div> <div class="form-group"> <label for="comment">Visit Date of training</label> <div id="sandbox-container1"> <div class="input-group date"> <input type="text" placeholder="dd/mm/yyyy" class="form-control"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span> </div> </div> </div> <div class="form-group"> <label for="usr">Traning Date Range:</label> <div class="input-daterange input-group" id="datepicker"> <input type="text" class="form-control" placeholder="Start date"/> <span class="input-group-addon">To</span> <input type="text" class="form-control" placeholder="End date"/> </div> </div> <div class="form-group"> <label for="comment">Comment:</label> <textarea rows="5" name="description" id="description" class="form-control"></textarea> </div> <div id="submit-control"> <input type="button" class="btn btn-primary" name="btn-submit" id="btn-submit" value="submit" onClick="ajaxSubmit();" /> </div> </form> </div> </div> </div> </div> </div> </form> </div> <!-- ##### R Side Bar ##### --> </div> </div> <?php include("includes/footer.php"); ?> <!--<link rel="stylesheet" href="cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/css/bootstrapValidator.min.css"/> </script><script src="js/inputform.js"></script> <script type="text/javascript" src="cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.min.js"></script>--> <script src="js/random-user-result.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="js/bootstrap-datepicker.min.js"></script> <script src="js/bootstrap-date-example.js"></script> <script> function ajaxSubmit() { var valid = true; valid = checkEmpty($("#title")); if (valid) { var title = $("#title").val(); var description = $("#description").val(); $.ajax({ url: "first-form-demo.php", data: 'title=' + title + '&description=' + description, type: "POST", beforeSend: function() { $('#submit-control').html("<img src='LoaderIcon.gif' /> Request is Processing!"); }, processData: false, async: false, success: function(data) { setInterval(function() { $('#submit-control').html("Form submited Successfully! Thetestingworld team contact you soon") }, 1000); } }); } } function checkEmpty(obj) { var name = $(obj).attr("name"); $("." + name + "-validation").html(""); $(obj).css("border", ""); if ($(obj).val() == "") { $(obj).css("border", "#FF0000 1px solid"); $("." + name + "-validation").html("*"); return false; } return true; } </script> <script> $( "#datepicker" ).datepicker(); $(document).ready(function () { setTimeout(function(){ $('.remove').fadeIn(1000); }, 5000); $( ".jupdate" ).click(function() { var data_id =$(this).attr('data_id'); var data_status =$(this).attr('data_status'); var txt=$(this).text(); if(txt.indexOf("Disapprove")>= 0){ $(this).html('<span class="label label-success">Approved</span>'); data_status=0; var status="Approved"; } else { $(this).html('<span class="label label-danger">Disapprove</span>'); data_status=1; var status="Disapprove"; } //alert(data_status); $.post( "manage_customer.php", { data_id: data_id, data_status: data_status }) .done(function( data ) { alert( "Customer Status " + status ); }); }); }); </script> </body> </html>
Return