Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.145.51.35
<?php
include("sys_session.php");
$load_data=$_POST['load_data'];
$resp_mesg="";
$resp_stat="";
$resp_file="";
if($load_data=='grid_data')
{
if (!(isset($_POST['page_numb'])))
{$page_numb = 1;}
else
{$page_numb = intval($_POST['page_numb']);}
$page_limt = ($_POST["page_limt"] <> "" && is_numeric($_POST["page_limt"]) ) ? intval($_POST["page_limt"]) : 10;
include("sys_connect.php");
$mysql="select * from sys_control";
$myres=mysqli_query($mycon,$mysql);
$mycnt=mysqli_num_rows($myres);
$last_page=ceil($mycnt/$page_limt);
if($page_numb < 1)
{$page_numb = 1;}
elseif ($page_numb > $last_page)
{$page_numb = $last_page;}
if($last_page==0)
{$lowr_limt = ($page_numb) * $page_limt;}
else
{$lowr_limt = ($page_numb-1) * $page_limt;}
$mysql="select * from sys_control";
if($myres=mysqli_query($mycon,$mysql));
{
$i=1;
echo "<table class='table_grid' border=1>";
echo "<tr>";
echo "<th width='4%'> # </th>";
echo "<th width='10%'> Code </th>";
echo "<th width='40%'> Name </th>";
echo "<th> Action </th>";
echo "</tr>";
while($row = mysqli_fetch_assoc($myres))
{
$page_link ="<a class='grid_link' href=# onClick=edit_data('$row[fadmncode]')>Edit</a>";
echo "<tr id=$row[fadmncode]>";
echo "<td width='4%' align='center'> $i</td>";
echo "<td width='10%' align='center'>$row[fadmncode]</td>";
echo "<td width='70%' align='left'>$row[fadmnname]</td>";
echo "<td width='15%' align='center'>$page_link</td>";
echo "</tr>";
$i++;
}
//NAVIGATION
echo "<tr>";
echo "<th align='center' colspan='9'>";
echo "<div style='width:80%;float:left;text-align:left;'>Pages: ";
if (($page_numb-1) > 0)
{
echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,1);'> First</a>";
echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$page_numb-1);'> Previous</a>";
}
for($i=1; $i<=$last_page; $i++)
{
if ($i == $page_numb){echo "<a href='javascript:void(0);' class='selected'> $i</a>";}
else{echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$i);'> $i</a>";}
}
if (($page_numb+1) <= $last_page){echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$page_numb+1);'> Next</a>";}
if (($page_numb) != $last_page){echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$last_page);'> Last</a>";}
echo "</div>";
echo "<div style='width:20%;float:right; text-align:right;'>Rows / Page - ";
echo "<select onChange='load_page_limt(this.value);' style='width:50px;'>";
?>
<option value="15" <?php if ($_POST["page_limt"] == 15) { echo ' selected="selected"'; } ?> >15</option>
<option value="20" <?php if ($_POST["page_limt"] == 20) { echo ' selected="selected"'; } ?> >20</option>
<option value="40" <?php if ($_POST["page_limt"] == 40) { echo ' selected="selected"'; } ?> >40</option>
<option value="50" <?php if ($_POST["page_limt"] == 50) { echo ' selected="selected"'; } ?> >50</option>
<option value="100" <?php if ($_POST["page_limt"] == 100) { echo ' selected="selected"'; } ?> >100</option>
<?php
echo "</select>";
echo "</div>";
echo "</th>";
echo "</tr>";
echo "</table>";
//NAVIGATION ENDS
}
}
if($load_data=='disp_data')
{
$admn_code=$_POST['admn_code'];
include("sys_connect.php");
$mysql="select * from sys_control where fadmncode='$admn_code'";
$myres=mysqli_query($mycon,$mysql);
$rows = array();
while($r = mysqli_fetch_assoc($myres))
{
$rows = $r;
}
echo json_encode($rows);
}
if($load_data=='save_data')
{
$page_mode=$_POST['page_mode'];
$admn_code=$_POST['admn_code'];
$admn_name=$_POST['admn_name'];
$admn_add1=$_POST['admn_add1'];
$admn_add2=$_POST['admn_add2'];
$admn_add3=$_POST['admn_add3'];
$admn_add4=$_POST['admn_add4'];
$admn_phon=$_POST['admn_phon'];
$admn_mobl=$_POST['admn_mobl'];
$admn_mail=$_POST['admn_mail'];
$mess_user=$_POST['mess_user'];
$mess_pswd=$_POST['mess_pswd'];
$mess_from=$_POST['mess_from'];
$mess_catg=$_POST['mess_catg'];
$mail_user=$_POST['mail_user'];
$mail_pswd=$_POST['mail_pswd'];
$mail_name=$_POST['mail_name'];
$mail_host=$_POST['mail_host'];
$mail_port=$_POST['mail_port'];
include("sys_connect.php");
$mysql="select * from sys_control";
$myres=mysqli_query($mycon,$mysql);
$mycnt=mysqli_num_rows($myres);
if($mycnt==0)
{
$mysql ="insert into sys_control (fadmnname, fadmnadd1, fadmnadd2, fadmnadd3, fadmnadd4, fadmnphon, fadmnmobl, fadmnmail,";
$mysql.="fmessuser, fmesspswd, fmessfrom, fmesscatg, fmailuser, fmailpswd, fmailname, fmailhost, fmailport) values(";
$mysql.="'$admn_name', '$admn_add1', '$admn_add2', '$admn_add3', '$admn_add4', '$admn_phon', '$admn_mobl', '$admn_mail', ";
$mysql.="'$mess_user', '$mess_pswd', '$mess_from', '$mess_catg', '$mail_user', '$mail_pswd', '$mail_name', '$mail_host', '$mail_port')";
$myres=mysqli_query($mycon,$mysql);
}
else
{
$mysql ="update sys_control set fadmnname='$admn_name', fadmnadd1='$admn_add1', fadmnadd2='$admn_add2', fadmnadd3='$admn_add3', ";
$mysql.="fadmnadd4='$admn_add4', fadmnphon='$admn_phon', fadmnmobl='$admn_mobl', fadmnmail='$admn_mail', fmessuser='$mess_user',";
$mysql.="fmesspswd='$mess_pswd', fmessfrom='$mess_from', fmesscatg='$mess_catg', fmailuser='$mail_user', fmailpswd='$mail_pswd', ";
$mysql.="fmailname='$mail_name', fmailhost='$mail_host', fmailport='$mail_port' where fadmncode='$admn_code'";
$myres=mysqli_query($mycon,$mysql);
}
$resp_mesg="Details updated!";
echo json_encode(array("mesg"=>$resp_mesg, "stat"=>$resp_stat, "file"=>$resp_file));
}
?>
|