Advertisement
Guest User

Untitled

a guest
Dec 4th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. <?php
  2. require 'PHPMailerAutoload.php';
  3. $id=$_POST['cllgid'];
  4. $name=$_POST['signn'];
  5. $mail = new PHPMailer;
  6. $length=8;
  7. $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$^&*";
  8. $password = substr( str_shuffle( $chars ), 0, $length );
  9.  
  10. if(!empty($_POST['cllgid']) && !empty($_POST['signn']))
  11. {
  12. $id=$_POST['cllgid'];
  13. $name=$_POST['signn'];
  14. //echo "lala";
  15. if($id!="" && $name!="")
  16. {
  17. $connectit=mysql_connect("localhost","root","");
  18. //if($connectit) echo" done1";
  19. mysql_select_db("try1");
  20. $q="select * from login
  21. where eid=\"$id\" and name=\"$name\";";
  22. $a=mysql_query($q);
  23. //if($a) echo" done2";
  24. $row=mysql_num_rows($a);
  25. if($row==0)
  26. {
  27. $q="Insert into try1 values('$signn','$id','$password');
  28. mysql_query($q);
  29. echo "<br><br><p class=\"pull-right color-red\" style=\"font-size:15px;\">Congrats! Now you are on BitsSmash too. &nbsp;&nbsp;&nbsp; </p>";
  30. }
  31. else
  32. {
  33. echo "<br><br><p class=\"pull-right color-red\" style=\"font-size:15px;\">Already Exists &nbsp;&nbsp;&nbsp; </p>";
  34. }
  35. } }
  36.  
  37.  
  38. $mail->isSMTP(); // Set mailer to use SMTP
  39. $mail->Host = 'smtp.gmail.com'; // Specify main and backup server
  40. $mail->SMTPAuth = true; // Enable SMTP authentication
  41. $mail->Username = 'ballusmash@gmail.com'; // SMTP username
  42. $mail->Password = 'bitssmash1995'; // SMTP password
  43. $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
  44. $mail->Port = 587; //Set the SMTP port number - 587 for authenticated TLS
  45. $mail->setFrom('contact@bsmash.com', 'BSmash'); //Set who the message is to be sent from
  46. $mail->addReplyTo('systecnicdubai@gmail.com', 'Systecnic Solutions'); //Set an alternative reply-to address
  47. $mail->addAddress('nkgulati@gmail.com', 'Ayush Gulati'); // Add a recipient
  48. $mail->addAddress("f2013011@dubai.bits-pilani.ac.in", 'nAnga'); // Add a recipient
  49. //$mail->addCC('cc@example.com');
  50. //$mail->addBCC('bcc@example.com');
  51. $mail->WordWrap = 50; // Set word wrap to 50 characters
  52. //$mail->addAttachment('/usr/labnol/file.doc'); // Add attachments//
  53. //$mail->addAttachment('/images/image.jpg', 'new.jpg'); // Optional name
  54. $mail->isHTML(true); // Set email format to HTML
  55.  
  56.  
  57. $mail->Subject = $name;
  58. $mail->Body = $password;
  59. $mail->AltBody = 'Parent wants to request a booking';
  60.  
  61. //Read an HTML message body from an external file, convert referenced images to embedded,
  62. //convert HTML into a basic plain-text alternative body
  63. //$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  64.  
  65. if(!$mail->send()) {
  66. echo 'Message could not be sent.';
  67. echo 'Mailer Error: ' . $mail->ErrorInfo;
  68. exit;
  69. }
  70.  
  71. echo 'Message has been sent.';
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement