Centre of Excellence in Bioinformatics(CoE)
Job Swap Wizard
if(isset($_POST['submit']) == "Submit")
{
if($_POST['pass'] != "ela123"){ echo msg("Invalid Password"); echo ""; }
// echo "post = ".$_POST['swap'];
// $showall=mysql_query("select * from tesla where jobstatus != 'Completed' and jobstatus !='Failed' and device = '$_POST[swap]' order by id ");
$sql1=mysqli_query($con,"select * from tesla where jobstatus = 'Ready To Start' and device = '$_POST[swap]' order by id ");
$rows = mysqli_num_rows($sql1);
if($rows != 0)
{
echo "";
}
else{
?>
if(isset($_POST['from']) != "" and isset($_POST['to']) != "")
{
$from=mysqli_query($con,"select a.* ,b.* from tesla a, users b where id = '$_POST[from]' and a.userid = b.userid");
$fromrows = mysqli_num_rows($from);
$fromshow=mysqli_fetch_array($from);
$to=mysqli_query($con,"select a.* ,b.* from tesla a, users b where id = '$_POST[to]' and a.userid = b.userid");
$torows = mysqli_num_rows($to);
$toshow=mysqli_fetch_array($to);
if($torows != 0){
$swap1=mysqli_query($con,"update tesla set userid = '$toshow[userid]', gname = '$toshow[gname]' , software = '$toshow[software]' , job = '$toshow[job]' , device = '$toshow[device]' , regtime = '$toshow[regtime]' where id = '$_POST[from]'");
$swap2=mysqli_query($con,"update tesla set userid = '$fromshow[userid]', gname = '$fromshow[gname]' , software = '$fromshow[software]' , job = '$fromshow[job]' , device = '$fromshow[device]' , regtime = '$fromshow[regtime]' where id = '$_POST[to]'");
sndmail($toshow['name'],$fromshow['name'],$fromshow['jobid'],$toshow['email'],$fromshow['email'],$fromshow['sysname'] );
msg("Job Swap Done Successfully....");
}
}
}
?>
function msg($msg)
{
?>
}
?>
function sndmail($toname, $fromname, $jobid, $temail, $femail, $sysname)
{
$subject = "Tesla Job Swap";
$message = "Hi $toname Your Job is 'Ready To Start' due to Swap of Job with $fromname..
Use The Below Job ID as Password to login $sysname Server & submit your Job
----------------------------
Job ID: $jobid
----------------------------
This email was automatically generated.";
if(!mail($temail, $subject, $message, "FROM: elavarasan@bicpu.edu.in")){
die ("Sending Email Failed, Please Contact Site Admin!");
}
$subject = "Tesla Job Swap";
$message = "Hi $fromname Your Job is 'In Queue' due to the Swap of Job with $toname..
This email was automatically generated.";
if(!mail($femail, $subject, $message, "FROM: elavarasan@bicpu.edu.in")){
die ("Sending Email Failed, Please Contact Site Admin!");
}
}
?>