D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafrica
/
result.dominicaninstitute.org
/
Filename :
capply-old.php
back
Copy
<?php require('PHPMailer/mail.php'); try{ $conn = new PDO("mysql:host=localhost;dbname=diafrica_result","diafrica_result","07036543898Ola."); $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); }catch(PDOException $e){ echo $e->getMessage(); } function create($table,$data){ global $conn; foreach($data as $field => $value){ $fields[] = sprintf("`%s`",$field); $values[] = sprintf("'%s'",$value); $field_list = join(',',$fields); $value_list = join(',',$values); } $query = sprintf("INSERT INTO `%s`(%s)VALUES(%s)",$table,$field_list,$value_list); $stmt = $conn->prepare($query); $stmt->execute(); return true; } if (isset($_POST['submit'])) { $haddress = $_POST['haddress']; $caddress = $_POST['caddress']; $saddress = $_POST['saddress']; $fname = $_POST['fname']; $oname = $_POST['oname']; $reason = $_POST['reason']; $phone = $_POST['phone']; $email = $_POST['email']; $dob = $_POST['dob']; $matric = $_POST['matric']; $fromto = $_POST['fromto']; $program = $_POST['program']; $entry = $_POST['entry']; $who = $_POST['who']; $pfname = $_POST['pfname']; $poname = $_POST['ooname']; $phome = $_POST['phome']; $pemail = $_POST['pemail']; $pphone = $_POST['pphone']; $pdob = $_POST['pdob']; $pnation = $_POST['pnation']; $utype = $_POST['utype']; $sig = $_FILES['signature']['tmp_name']; $sig2 = $_FILES['upload']['tmp_name']; $random = rand(0001,9999); $temporary = explode("." , $_FILES [ "signature" ][ "name" ]); $file_extension = end ($temporary ); $pic = $_FILES['signature']['name']; $picp = $_FILES['signature']['tmp_name']; $pics = $_FILES['signature']['size']; $temporary2 = explode("." , $_FILES [ "upload" ][ "name" ]); $file_extension2 = end ($temporary2 ); $pic2 = $_FILES['upload']['name']; $picp2 = $_FILES['upload']['tmp_name']; $pics2 = $_FILES['upload']['size']; list($width,$height) = getimagesize($sig); if ($width > 100 || $height > 100) { $message = "Please Input an Image that is 5 100X100px"; }else{ $rando = rand(00001,99999); $hash = sha1($pic); $hash = $hash.$rando; $ext1 = pathinfo($pic, PATHINFO_EXTENSION); $ext1 = strtolower($ext1); $upload_folder1 = "signature/".$hash.".".$ext1; $uploadpic = $hash.".".$ext1; $rando2 = rand(00001,99999); $hash2 = sha1($pic2); $hash2 = $hash2.$rando2; $ext2 = pathinfo($pic2, PATHINFO_EXTENSION); $ext2 = strtolower($ext2); $upload_folder2 = "uploads/".$hash.".".$ext2; $uploadpic2 = $hash.".".$ext2; $in = array('iden' => $random, 'haddress' => $haddress, 'caddress' => $caddress, 'saddress' => $saddress, 'sname' => $fname, 'oname' => $oname, 'reason' => $reason, 'phone' => $phone, 'email' => $email, 'dob' => $dob, 'matric' => $matric, 'fromto' => $fromto, 'program' => $program, 'entry' => $entry, 'who' => $who, 'pfname' => $pfname, 'poname' => $poname, 'phome' => $phome, 'pemail' => $pemail, 'pphone' => $pphone, 'pdob' => $pdob, 'pnation' => $pnation, 'utype' => $utype, 'upload' => $uploadpic2, 'signature' => $uploadpic, ); move_uploaded_file($picp, $upload_folder1); move_uploaded_file($picp2, $upload_folder2); create('crequest',$in); $to_email= 'records@dominicaninstitute.org'; $to_email2= 'registrar@dominicaninstitute.org'; $to_name='Registrar'; $subject="Application for Certificate for $fname $oname"; $body ="<html><body style='text-align:center;'>"; $body.="Hello sir, an application for Certificate has been sent.. Download it <a href='http://result.dominicaninstitute.org/capply2.php?d=$random'><button>Here</button></a>"; $body.="</body></html>"; mail::send_mail($to_email,$to_name,$subject,$body); mail::send_mail($to_email2,$to_name,$subject,$body); $message = "You have successfully sent a mail to the registrar as reguards to your certificate click <a href='http://result.dominicaninstitute.org/capply2.php?d=$random'><button class='btn btn-success'>Here</button></a> to download your copy of the letter"; } } ?> <!DOCTYPE html> <html> <head> <title>Application for Certificate</title> <link rel="stylesheet" type="text/css" href="./apply-old.css"> </head> <body> <div class="box"> <img src="logo2.png" style="display: block; margin: auto;" width="50%"> <h1 style="text-align: center; text-transform: uppercase;">Application for Certificate</h1> <?php if (isset($message)) { ?> <div style="border: 1px solid black; margin:5px; border-radius: 10px; padding: 5px; background: #417b4e"> <?php echo $message; ?> </div> <?php } ?> <form method="post" enctype="multipart/form-data"> <h2>Bio-Data</h2> <div class="row"> <div class="form-group col-md-4"> <label>First Name</label> <input type="text" name="fname" required placeholder="Full Name"> </div> <div class="form-group col-md-4"> <label>Other Names</label> <input type="text" name="oname" required placeholder="Other Names"> </div> <div class="form-group col-md-4"> <label>House Address</label> <input type="text" name="haddress" required placeholder="e.g NO 1, Zone 1"> </div> </div> <div class="row"> <div class="form-group col-md-4"> <label>City Address</label> <input type="text" name="caddress" required placeholder="e.g city"> </div> <div class="form-group col-md-4"> <label>State/Country Address</label> <input type="text" name="saddress" required placeholder="e.g State, Country"> </div> <div class="form-group col-md-4"> <label>Phone Number</label> <input type="text" name="phone" required placeholder="e.g+234..."> </div> </div> <div class="row"> <div class="form-group col-md-4"> <label>Email</label> <input type="text" name="email" required placeholder="abc@example.com"> </div> <div class="form-group col-md-4"> <label>Date of Birth</label> <input type="date" name="dob" required placeholder="" min="1901-01-01" max="<?php echo date('Y-m-d');?>"> </div> <div class="form-group col-md-4"> <label>Nationalty</label> <input type="text" required placeholder=""> </div> </div> <h2>My DI Data</h2> <div class="row"> <div class="form-group col-md-3"> <label>Matric No</label> <input type="text" name="matric" required placeholder="e.g DI/123"> </div> <div class="form-group col-md-3"> <label>Year of Entry</label> <input type="text" name="entry" required placeholder="e.g 2018/2019"> </div> <div class="form-group col-md-3"> <label>Year of Graduation </label> <input type="text" name="fromto" required placeholder="e.g 2018/2019"> </div> <div class="form-group col-md-3"> <label>Program</label> <input type="text" name="program" required placeholder="e.g B.A. Philosophy" > </div> </div> <h2>Authentication of Request</h2> <h3 style="color: red">Please indicate below if applicant will not collect in person</h3> <div class="row"> <div class="form-group col-md-4"> <label>Choose Below</label> <select name="who" id="who" onchange="loadthis();"> <option value="personal">Personal</option> <option value="proxy">Proxy</option> </select> </div> </div> <div id="proxyy"> <div class="row"> <div class="form-group col-md-4"> <label>First Name (Proxy)</label> <input type="text" name="pfname" placeholder="Full Name"> </div> <div class="form-group col-md-4"> <label>Other Names (Proxy)</label> <input type="text" name="ooname" placeholder="Other Names"> </div> <div class="form-group col-md-4"> <label>House Address (Proxy)</label> <input type="text" name="phome" placeholder="e.g NO 1, Zone 1"> </div> </div> <div class="row"> <div class="form-group col-md-3"> <label>Email (Proxy)</label> <input type="text" name="pemail" placeholder="abc@example.com"> </div> <div class="form-group col-md-3"> <label>Phone Number (Proxy)</label> <input type="text" name="pphone" placeholder="e.g+234..."> </div> <div class="form-group col-md-3"> <label>Date of Birth (Proxy)</label> <input type="date" name="pdob" placeholder="" min="1990-01-01" max="<?php echo date('Y-m-d');?>"> </div> <div class="form-group col-md-3"> <label>Nationalty (Proxy)</label> <input type="text" placeholder="" name="pnation"> </div> </div> </div> <div id="personall"> <div class="row"> <div class="form-group col-md-4"> <label>Signature(side must be 100X100px) </label> <input type="file" name="signature" placeholder="e.g 2014-2018"> </div> <div class="form-group col-md-4"> <label>Choose Mode of Identification</label> <select name="utype"> <option value="Drivers License">Driver's Licence</option> <option value="Voters Card">Voter's Card</option> <option value="International Passport">International Passport</option> <option value="DI Student ID Card">DI Student ID Card</option> </select> </div> <div class="form-group col-md-4"> <label>Upload Identification </label> <input type="file" name="upload" placeholder="e.g 2014-2018"> </div> </div> </div> <button class="btn btn-success" type="submit" name="submit">Submit</button> </form> </div> </body> <script type="text/javascript"> window.onload = prot(); function prot(){ document.getElementById('personall').hidden = false; document.getElementById('proxyy').hidden = true; } function loadthis(){ var whois = document.getElementById('who').value; if (whois == 'personal') { document.getElementById('proxyy').hidden = true; }else if (whois == 'proxy') { document.getElementById('proxyy').hidden = false; }else{ document.getElementById('personall').hidden = false; document.getElementById('proxyy').hidden = true; } } </script> </html>