Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'PHPMailerAutoload.php';
- $id=$_POST['cllgid'];
- $name=$_POST['signn'];
- $mail = new PHPMailer;
- $length=8;
- $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$^&*";
- $password = substr( str_shuffle( $chars ), 0, $length );
- if(!empty($_POST['cllgid']) && !empty($_POST['signn']))
- {
- $id=$_POST['cllgid'];
- $name=$_POST['signn'];
- //echo "lala";
- if($id!="" && $name!="")
- {
- $connectit=mysql_connect("localhost","root","");
- //if($connectit) echo" done1";
- mysql_select_db("try1");
- $q="select * from login
- where eid=\"$id\" and name=\"$name\";";
- $a=mysql_query($q);
- //if($a) echo" done2";
- $row=mysql_num_rows($a);
- if($row==0)
- {
- $q="Insert into try1 values('$signn','$id','$password');
- mysql_query($q);
- echo "<br><br><p class=\"pull-right color-red\" style=\"font-size:15px;\">Congrats! Now you are on BitsSmash too. </p>";
- }
- else
- {
- echo "<br><br><p class=\"pull-right color-red\" style=\"font-size:15px;\">Already Exists </p>";
- }
- } }
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup server
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'ballusmash@gmail.com'; // SMTP username
- $mail->Password = 'bitssmash1995'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
- $mail->Port = 587; //Set the SMTP port number - 587 for authenticated TLS
- $mail->setFrom('contact@bsmash.com', 'BSmash'); //Set who the message is to be sent from
- $mail->addReplyTo('systecnicdubai@gmail.com', 'Systecnic Solutions'); //Set an alternative reply-to address
- $mail->addAddress('nkgulati@gmail.com', 'Ayush Gulati'); // Add a recipient
- $mail->addAddress("f2013011@dubai.bits-pilani.ac.in", 'nAnga'); // Add a recipient
- //$mail->addCC('cc@example.com');
- //$mail->addBCC('bcc@example.com');
- $mail->WordWrap = 50; // Set word wrap to 50 characters
- //$mail->addAttachment('/usr/labnol/file.doc'); // Add attachments//
- //$mail->addAttachment('/images/image.jpg', 'new.jpg'); // Optional name
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = $name;
- $mail->Body = $password;
- $mail->AltBody = 'Parent wants to request a booking';
- //Read an HTML message body from an external file, convert referenced images to embedded,
- //convert HTML into a basic plain-text alternative body
- //$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- exit;
- }
- echo 'Message has been sent.';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement