JezK
Edit File: ajax.php
<?php session_start(); include('main.php'); $type = $_REQUEST['type']; if($type == 1) { $formSubmissionID = $_REQUEST['formSubmissionID']; $data = $sli->getUserDetails($formSubmissionID); if($data != 0) { if($data['userDetails']['submissionStatus'] == 1) { $userID = $data['userDetails']['id']; $email = $data['userDetails']['email']; $constitution = ""; switch($data['userDetails']['constitution']) { case 1: $constitution = "Trust"; break; case 2: $constitution = "FPO / MPCS"; break; case 3: $constitution = "Co-op Society"; break; case 4: $constitution = "Company Act"; break; } $registerButton = ""; //checking whether user already registered or not $isUserRegistered = $sli->isUserAlreadyRegistered($userID); if(!$isUserRegistered) { $registerButton = '<input type="button" value="Register" class="btn btn-warning" onclick="register('.$userID.',\''.$email.'\',\''.$formSubmissionID.'\')">'; } echo '<tr><td>'.$data['userDetails']['name'].'</td><td>'.$data['userDetails']['email'].'</td><td>'.$constitution.'</td><td><a href="userDetails.php?id='.$formSubmissionID.'"><input type="button" value="View" class="btn btn-warning"></a> '.$registerButton.'</td></tr>'; } else { echo -2; //form not submitted. } } else { echo 0; //details not found } //header('Content-type: application/json'); //echo json_encode($data); } elseif($type == 2) { $userID = $_REQUEST['userID']; $email = $_REQUEST['email']; $formSubmissionID = $_REQUEST['formSubmissionID']; $password = time(); $result = $sli->registerUser($userID,$email,$password,$formSubmissionID); if($result != -3) { //sending registration details to mail $headers = "From: Nabfins<donotreply@nabfins.com>" . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $subject="SLI Registration details"; //$message = "Hi,<br><br>Your Email to login is:<b>".$email."</b><br><br><br>Your password is:<b>".$password."</b><br> Best Regards,<br><br>Nabfins Team.<br>"; $message = '<html> <head> </head> <body style="margin:0px;background: #eeeee0;"> <div style="text-align:center;background: #eeeee0;float: left;width: 100%;border-bottom: 1px solid #352f2f;"><img src="http://nabfins.org/wp-content/themes/rocketboard-v1-04/images/logo.png" alt="default-logo" style="float:left;padding: 8px 10px;"><div style="padding: 38px 0px;color:#6a0000;font-weight:bold;">SLI APPICATION SUBMISSION</div></div> <div style="line-height: 26px;clear:both;padding:10px;">Dear,<br>Congratualations !<p style="padding:0px 0px;margin: 8px 0px;">You are now one of the SLI institutions who got successfully registered in NABFINS. Please check your credentials below.</p>Email : '.$email.'<br>Password : '.$password.'<div>You can login at <a href="'.$sli->getBaseURL().'SLI-User">'.$sli->getBaseURL().'SLI-User</a></div><br><br>Regards,<br>NABFINS.</div> </body> </html>'; mail($email,$subject,$message,$headers); mail('rampanesh@krifynet',$subject,$message,$headers); mail('sli@nabfins.org',$subject,$message,$headers); } echo $result; } else if($type == 4) { $userID = $_REQUEST['userID']; $email = $_REQUEST['email']; $applicationType = $_REQUEST['applicationType']; $result = $sli->rejectUser($userID,$applicationType,$email); echo $result; } ?>