MMCT TEAM
Server IP : 2a02:4780:3:2287:0:3736:a38e:8  /  Your IP : 216.73.217.106
Web Server : LiteSpeed
System : Linux sg-nme-web2187.main-hosting.eu 5.14.0-611.54.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 6 18:03:03 EDT 2026 x86_64
User : u926327694 ( 926327694)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail, proc_open
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u926327694/domains/gesnavachetanschool.in/../evisioninfotech.in/public_html/member/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/gesnavachetanschool.in/../evisioninfotech.in/public_html/member/master.php
<?php  
$page_title = 'Master';
include 'header.php';
$agent_id = $userData['id'];
$role = $userData['user_type'];
?>
<div class="content-wrapper">
	<section class="content mt-4">
		<div class="container-fluid">
			<div class="row">
				<div class="col-md-12">
					<?php include('alert-msg.php'); ?>
					<div class="card card-primary">
						<div class="card-header">
							<h3 class="card-title">Add <?php echo $page_title; ?></h3>
						</div>
						<form action="" method="POST" enctype="multipart/form-data">
							<div class="card-body">
								<div class="row">
									<?php 
									if($role == "1")
									{
										?>
										<div class="col-md-4">
											<div class="form-group">
												<label>School</label>
												<select class="form-control school_id select2" name="school_id" required>
													<option value="">--Select--</option>
													<?php
													$sel_school=mysqli_query($con,"select * from users where agent_id = $agent_id and user_type=2 order by id desc");
													while($row_school=mysqli_fetch_array($sel_school))
													{
														?>
														<option value="<?php echo $row_school['id']; ?>"><?php echo $row_school['name']; ?></option>
														<?php
													}
													?>
												</select>
											</div>
										</div>
										<?php
									}
									?>
									<div class="col-md-4">
										<div class="form-group">
											<label>Select Master</label>
											<select class="form-control select2" name="master_name" required>
											    <option value="">--Select--</option>
											    <option value="Section">Section</option>
											    <option value="Place">Place</option>
											    <option value="Designation">Designation</option>
											    <option value="Type Member">Type Member</option>
											    <option value="Members Style">Members Style</option>
											</select>
										</div>
									</div>
									<div class="col-md-4">
										<div class="form-group">
											<label>Title</label>
											<input type="text" name="master_title" class="form-control" required />
										</div>
									</div>
								</div>
								<button type="submit" class="btn btn-primary" name="btnSubmit">Submit</button>
							</div>
						</form>
					</div>
					<div class="card card-primary">
						<div class="card-header">
							<h3 class="card-title"><?php echo $page_title; ?> List</h3>
						</div>
						<div class="card-body">
							<table class="table table-bordered table-striped main_datatables">
								<thead>
									<tr>
										<th>Sr. No.</th>
										<th>School Name</th>
										<th>Master</th>
										<th>Master Title</th>
										<th>Action</th>
									</tr>
								</thead>
								<tbody>
									<?php
									if($role == "1")
									{
										$sel_master=mysqli_query($con,"select m.*,u.name from master as m inner join users as u on u.id = m.school_id  where school_id in(select id from users where agent_id = $agent_id and user_type=2)");
									}
									else
									{
										$sel_master=mysqli_query($con,"select m.*,u.name from master as m inner join users as u on u.id = m.school_id  where school_id=$agent_id");
									}
									
									$i=1;
									while($row_master=mysqli_fetch_array($sel_master))
									{

										?>
										<tr>
											<td><?php echo $i; ?></td>
											<td><?php echo $row_master['name']; ?></td>
											<td><?php echo $row_master['master']; ?></td>
											<td><?php echo $row_master['master_title']; ?></td>
											<td>
												<a href="master-delete.php?id=<?php echo $row_master['id']; ?>" onclick="return confirm('Are you sure you want to delete ?');" class="btn btn-sm btn-danger"><i class="fas fa-trash"></i></a>
											</td>
										</tr>
										<?php
										$i=$i+1;
									}
									?>
								</tbody>
							</table>
						</div>
						<!-- /.card-body -->
					</div>
				</div>
			</div>
		</div>
	</section>
</div>
<?php include 'footer.php'; ?>

<?php
if(isset($_POST['btnSubmit']))
{
	if($role == "1")
	{
		$school_id = $_POST['school_id'];	
	}
	else
	{
		$school_id = $agent_id;
	}
	
	$master_name = $_POST['master_name'];
	$master_title = $_POST['master_title'];
	
	$ins = mysqli_query($con,"INSERT INTO `master` (`school_id`, `master`, `master_title`) VALUES ('$school_id', '$master_name', '$master_title')");
	if($ins)
	{
	    $_SESSION['success_msg'] = 'Master has been added...';
	    echo"<script>window.location='master.php';</script>";
	}
	else
	{
	    $_SESSION['error_msg'] = 'Unable to add Master...';
	    echo"<script>window.location='master.php';</script>";
	}
}
?>

MMCT - 2023