SHOW:
|
|
- or go back to the newest paste.
1 | <? | |
2 | require_once "function/password.php"; | |
3 | include('function/autoload.php'); | |
4 | include('function/PHPMailer/class.phpmailer.php'); | |
5 | include('function/PHPMailer/class.smtp.php'); | |
6 | if(isset($_POST['daftar'])){ | |
7 | $salt = rand(0,1000); | |
8 | $hash = MyEncrypt($salt,"en"); | |
9 | $username = mysql_escape_string($_POST['username']); | |
10 | $email = mysql_escape_string($_POST['email']); | |
11 | $password = mysql_escape_string($_POST['password']); | |
12 | $repassword = mysql_escape_string($_POST['repassword']); | |
13 | $nama = mysql_escape_string($_POST['nama']); | |
14 | $hp = mysql_escape_string($_POST['hp']); | |
15 | $tanggal_daftar = date("Y-m-d"); | |
16 | ||
17 | if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { | |
18 | ?> | |
19 | <script> | |
20 | $.toast('Please Enter Valid Email'); | |
21 | </script> | |
22 | <? | |
23 | }else{ | |
24 | $sql_cek_email = mysql_query("SELECT email from peserta WHERE email = '$email'",$peserta_tryout); | |
25 | $cek_email = mysql_num_rows($sql_cek_email); | |
26 | if($cek_email>0){ | |
27 | ?> | |
28 | <script> | |
29 | $.toast('Email Already Used'); | |
30 | </script> | |
31 | <? | |
32 | }else{ | |
33 | $sql_cek_username = mysql_query("SELECT username from peserta WHERE username = '$username'",$peserta_tryout); | |
34 | $cek_username = mysql_num_rows($sql_cek_username); | |
35 | ||
36 | if($cek_username>0){ | |
37 | ?> | |
38 | <script> | |
39 | $.toast('Username Already Used'); | |
40 | </script> | |
41 | <? | |
42 | }else{ | |
43 | if($repassword ==$password){ | |
44 | $pass = MyEncrypt($password,"en"); | |
45 | $sql_register = mysql_query("INSERT INTO peserta SET username = '$username', nama = '$nama', email = '$email', password = '$pass', hash = '$hash', tanggal_daftar = '$tanggal_daftar', status = '0'",$peserta_tryout); | |
46 | ||
47 | $nama_penerima=$_POST['nama']; | |
48 | $email_penerima=$_POST['email']; | |
49 | $subjek="Verification Register Account"; | |
50 | $pesan='Thanks for signing up! | |
51 | Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. | |
52 | ------------------------ | |
53 | Username: '.$nama.' | |
54 | Password: '.$password.' | |
55 | ------------------------ | |
56 | ||
57 | Please click this link to activate your account: | |
58 | http://localhost/tryout/auth/verify&email='.$email.'&hash='.$hash.''; | |
59 | ||
60 | $mail = new PHPMailer(); | |
61 | ||
62 | $mail->Host = "ssl://smtp.gmail.com"; | |
63 | $mail->Mailer = "smtp"; | |
64 | $mail->SMTPAuth = true; | |
65 | ||
66 | - | $mail->Username = "officialrizkyramadhan@gmail.com"; |
66 | + | $mail->Username = "@gmail.com"; |
67 | - | $mail->Password = "cacadmentalz"; |
67 | + | $mail->Password = ""; |
68 | - | $webmaster_email = "officialrizkyramadhan@gmail.com"; |
68 | + | $webmaster_email = "@gmail.com"; |
69 | $email = $email_penerima; | |
70 | $name = $nama_penerima; | |
71 | $mail->From= $webmaster_email; | |
72 | $mail->FromName="Try Out"; | |
73 | $mail->AddAddress($email, $name); | |
74 | ||
75 | $mail->AddReplyTo($webmaster_email, "Try Out"); | |
76 | $mail->WordWrap = 50; | |
77 | ||
78 | $mail->IsHTML(true); | |
79 | $mail->Subject = $subjek; | |
80 | $mail->Body = $pesan; | |
81 | ||
82 | $mail->AltBody = "YOOO E-Mail Gw UDAH SIAP BRO"; | |
83 | if(!$mail->Send()) { | |
84 | echo "mail error" . $mail->ErrorInfo; | |
85 | } else { | |
86 | echo "email berhasil di kirim"; | |
87 | } | |
88 | }else{ | |
89 | ?> | |
90 | <script> | |
91 | $.toast('Password Must Same'); | |
92 | </script> | |
93 | <? | |
94 | } | |
95 | } | |
96 | } | |
97 | } | |
98 | } | |
99 | ?> |