Your IP : 18.191.116.61


Current Path : /home/lentoinv/churchmr.com/retreat/search/
Upload File :
Current File : /home/lentoinv/churchmr.com/retreat/search/indexold.php

<?php
session_start(); ob_start();
	   include("../data.inc.php");
	   
$repx = isset($_SESSION['sn'])?$_SESSION['sn']:$_SESSION['rid'];
if(isset($_POST['id'])){
$id = $_POST['id']; 
if(regStatus($id)==1){$report = 'User already Registered: '.userName($id);  }
else{
$qur=$db->query("select * FROM mdata WHERE sn='$id' " )or die(mysqli_error());
		  	$r=mysqli_fetch_array($qur);   
			$sid = $r['sid'];
			$rid = $r['rid'];
			$gid = $r['gid'];
			$did = $r['did'];
			$sex = trim($r['sex']);
			$section = trim($r['section']);
			$date = date('ymd');
			
		$sql = $db->query("INSERT INTO event (id,did,gid,rid,sid,sex,date,section,program,rep)
VALUES('$id','$did','$gid','$rid','$sid','$sex','$date','$section','$program','$repx')") or die(mysqli_error());

if($sql){$report = 'Registration Successful: '.userName($id);}
else{ 	$report = 'Error completing Registration, try again: '.userName($id);}
}
}

if (isset($_POST['idx'])){
$id = $_POST['idx']; 
$sql = $db->query("DELETE FROM event WHERE id = '$id' AND program = '$program' ") or die(mysqli_error());
$reportx = 'User Un-registratered: '.userName($id);

}

function dName($did,$opt){
	global $db;
$sql = $db->query("SELECT * FROM district WHERE sn = '$did' ");
$row = mysqli_fetch_array($sql);
return $row[$opt];
}

if(array_key_exists('UpdateUser', $_POST)){
$sn = $_GET['user'];
	$surname=$_POST['name'];
	$othername=$_POST['othername'];
	$phone=$_POST['phone'];
	$section=$_POST['section'];
	$address=$_POST['add'];
	$sex=$_POST['sex'];
	$age=$_POST['age'];
	$did = $_POST['district'];
	$den = $_POST['den'];
	$gid = dName($did,'gid');
	$district = dName($did,'district');
	$zone = dName($did,'zone');
	$pass = rand(1000,9999);
 $resul = $db->query(" UPDATE mdata SET surname='$surname', othername='$othername', phone='$phone', section='$section', address='$address', sex='$sex', age='$age', did='$did', gid='$gid', district='$district', zone='$zone', pass='$pass', a='$den' WHERE sn = '$sn' ") or die (mysqli_error());
 $db->query("UPDATE event SET sex='$sex', section='$section', did='$did', gid='$gid', member='$den' WHERE id = '$sn' ") or die (mysqli_error());
 
 	$report = 'Participant data successfully updated ';
}


?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Auto Registration</title>

    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
    
    <!-- jQuery libs -->
    <script  type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
    <script  type="text/javascript" src="js/jquery-ui-1.7.custom.min.js"></script>

    <script  type="text/javascript" src="js/jquery-search.js"></script>

</head>
<body>

<div id="container" style="width:100%; margin:0px;">

<input type="text" placeholder="Enter Name or Phone No to Search" autofocus id="searchData" style="width: 100%; height:35px; font-size:16px;" autocomplete="off"></div>
           
         
                <div id="results"></div>
              
<script type="text/javascript">
   setInterval(function() {
    $("#refresh").load(location.href+" #refresh>*","");
}, 5000); // seconds to wait, miliseconds. 1s = 1000
 </script>    

            <?php if(isset($report)){  ?> <div id="refresh" >  <?php
				 echo '<div class="alert alert-success alert-dismissible" style="position:fixed; top:50px; z-index:10000">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <i class="icon fa fa-check"></i> <strong>Alert!</strong> &nbsp;&nbsp;'. $report .'
              </div>';   ?>   </div>   <?php  }  ?>
              
              
              
               <?php if(isset($reportx)){  ?> <div id="refresh" >  <?php
				 echo '<div class="alert alert-danger alert-dismissible" style="position:fixed; top:50px; z-index:10000">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <i class="icon fa fa-check"></i> <strong>Alert!</strong> &nbsp;&nbsp;'. $reportx .'
              </div>';   ?>   </div>   <?php  }  ?>
              
              
  <?php if(isset($_GET['user'])){
  $user = $_GET['user']; 
  
$sq = $db->query("SELECT * FROM mdata WHERE sn = '$user' "); 
$rr = mysqli_fetch_assoc($sq); 

$rid = $rr['rid'];
 ?>

          <div class="box-header">
                      <h4  class="box-title">UPDATE USER   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="?">Close</a> </h4>  
                   </div>
              <div class="panel-body">

                
                 <form method="post">        
                      
               <p> <label> <input name="den" type="radio" value="1" <?php if($rr['a']==1){ echo 'checked'; } ?> required> Member&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label> <label><input name="den" type="radio" value="0" <?php if($rr['a']==0){ echo 'checked'; } ?> > Invitee</label></p>
               <p>
                  <select name="section" class="form-control select2" >
                         <option>SELECT SECTION</option>
                         <option <?php if('Adult'==$rr['section']){ echo 'selected' ; } ?>>Adult</option>
                          <option <?php if('Campus'==$rr['section']){ echo 'selected' ; } ?>>Campus</option>
                          <option <?php if('Youth'==$rr['section']){ echo 'selected' ; } ?>>Youth</option>
                          <option <?php if('Children'==$rr['section']){ ?> selected <?php } ?> >Children</option>
                        
                        </select>
                  
                   
               </p>
               <p>
 <select name="district" class="form-control select2">
 
                          <?php 
              $query=$db->query("select * FROM district WHERE rid='$rid' ORDER BY zone ASC, district ASC " )or die(mysqli_error());
              while($row=mysqli_fetch_array($query)){
            
              ?>
                          <option <?php if($row['sn']==$rr['did']){ echo 'selected' ; } ?> value="<?php echo $row['sn'] ?>"><?php echo $row['zone'].' / '.$row['district']; ?></option>
                          <?php }  ?>
                        </select>
</p>

                 <p>
                  <input name="name" class="form-control" placeholder="Surname*" value="<?php echo $rr['surname']; ?>" required >
                   </p>
                   
                    <p>
                  <input name="othername"  class="form-control" placeholder="Other Names" value="<?php echo $rr['othername']; ?>" required>
                   </p>
                   <p>
                  <input name="phone"  class="form-control" placeholder="Phone Number" value="<?php echo $rr['phone']; ?>" >
                   </p>
                   

                    <p>
                      <textarea id="editor1x" name="add" class="form-control" placeholder="Detailed Residential Address" rows="2"  required><?php echo $rr['address']; ?></textarea>
                     
                      </p>
                      
               
                       <p> <strong>Gender</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="sex" type="radio" value="Male" <?php if($rr['sex']=='Male'){ echo 'checked'; } ?> required> Male&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="sex" type="radio" value="Female" <?php if($rr['sex']=='Female'){ echo 'checked'; } ?>> Female</p>
                     
            <p> Age Group
                      <select name="age" class="form-control">
                                 
                                  <option selected><?php echo $rr['age']; ?></option>
                                  <option>1-3</option>
                                  <option>4-6</option>
                                  <option>7-9</option>
                                  <option>10-12</option>
                                 
                                  <option>13-16</option>
                                  <option>17-20</option>
                                  <option>21-25</option>
                                  
                                  <option>26-30</option>
                                  <option>31-35</option>
                                  <option>36-40</option>
                                  <option>41-45</option>
                                  <option>46-50</option>
                                  <option>51-60</option>
                                  <option>61-90</option>
                                 
                                </select></p>
                                
<button type="submit" class="btn btn-primary" name="UpdateUser" style="width:100%">REGISTER PARTICIPANT</button>  
                     
                    </p>
                    </form>  
                    

                </div><!-- /.tab-content -->

<?php  } ?>  
  
  
            
</div>
<script src="../../bootstrap/js/bootstrap.min.js"></script>
</body>
</html>

?>