Skip to content

Commit 22ee4c0

Browse files
committed
23 24
1 parent 96a0815 commit 22ee4c0

File tree

327 files changed

+41003
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

327 files changed

+41003
-0
lines changed

LESSON 21 - الدرس/app/active.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
2+
3+
<main class="container">
4+
5+
<?php
6+
7+
if(isset($_GET['code'])){
8+
9+
$username = "root";
10+
$password = "";
11+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
12+
13+
$checkCode = $database->prepare("SELECT SECURITY_CODE FROM users WHERE SECURITY_CODE = :SECURITY_CODE");
14+
$checkCode->bindParam("SECURITY_CODE",$_GET['code']);
15+
$checkCode->execute();
16+
if($checkCode->rowCount()>0){
17+
18+
$update = $database->prepare("UPDATE users SET SECURITY_CODE = :NEWSECURITY_CODE ,
19+
ACTIVATED=true WHERE SECURITY_CODE = :SECURITY_CODE");
20+
$securityCode = md5(date("h:i:s"));
21+
$update->bindParam("NEWSECURITY_CODE",$securityCode);
22+
$update->bindParam("SECURITY_CODE",$_GET['code']);
23+
24+
25+
if($update->execute()){
26+
echo '<div class="alert alert-success" role="alert">
27+
تم تحقق من حسابك بنجاح
28+
</div>';
29+
echo '<a class="btn btn-warning" href="login.php">تسجيل دخول</a>';
30+
}
31+
}else{
32+
echo '<div class="alert alert-danger" role="alert">
33+
هذا كود لم يعد صالحا للأستخدام
34+
</div>';
35+
}
36+
37+
}
38+
?>
39+
40+
41+
</main>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"phpmailer/phpmailer": "^6.1"
4+
}
5+
}

LESSON 21 - الدرس/app/composer.lock

+87
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LESSON 21 - الدرس/app/index.php

Whitespace-only changes.

LESSON 21 - الدرس/app/login.php

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
2+
<main class="container mt-3" style="text-align: right!important;">
3+
<form method="POST">
4+
5+
<p class="font-weight-bold">بريد الكتروني </p>
6+
<input class="form-control" type="email" name="email" required/>
7+
8+
9+
<p class="font-weight-bold">كلمة المرور </p>
10+
<input class="form-control" type="password" name="password" required/>
11+
12+
<a class="btn btn-outline-dark mt-3" href="register.php">تسجيل </a>
13+
<button class="btn btn-warning mt-3" type="submit" name="login">تسجيل دخول</button>
14+
15+
</form>
16+
17+
<?php
18+
if(isset($_POST['login'])){
19+
$username = "root";
20+
$password = "";
21+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
22+
23+
$login = $database->prepare("SELECT * FROM users WHERE EMAIL = :email AND PASSWORD = :password");
24+
$login->bindParam("email",$_POST['email']);
25+
$login->bindParam("password",$_POST['password']);
26+
$login->execute();
27+
if($login->rowCount()===1){
28+
$user = $login->fetchObject();
29+
if($user->ACTIVATED === "1"){
30+
31+
echo 'مرحبا ' .$user->NAME;
32+
$_SESSION['email'] = $user->EMAIL;
33+
$_SESSION['password'] = $user->PASSWORD;
34+
$_SESSION['name'] = $user->name;
35+
36+
}else{
37+
echo '
38+
<div class="alert alert-warning">
39+
يرجى تفعيل حسابك في البداية , لقد ارسلنا
40+
رمز تحقق من حسابك إلى بريد الكتروني خاص بك
41+
</div>
42+
';
43+
}
44+
}else{
45+
echo '
46+
<div class="alert alert-danger">
47+
كلمة مرور او بريد الكتروني غير صحيح
48+
</div>
49+
';
50+
}
51+
}
52+
?>
53+
</main>
54+

LESSON 21 - الدرس/app/mail.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
// Import PHPMailer classes into the global namespace
3+
// These must be at the top of your script, not inside a function
4+
use PHPMailer\PHPMailer\PHPMailer;
5+
use PHPMailer\PHPMailer\SMTP;
6+
use PHPMailer\PHPMailer\Exception;
7+
8+
// Load Composer's autoloader
9+
require 'mailer/autoload.php';
10+
11+
// Instantiation and passing `true` enables exceptions
12+
$mail = new PHPMailer();
13+
14+
//Server settings
15+
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
16+
$mail->isSMTP(); // Send using SMTP
17+
$mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through
18+
$mail->SMTPAuth = true; // Enable SMTP authentication
19+
$mail->Username = 'ضع بريد الكتروني خاص بك'; // SMTP username
20+
$mail->Password = 'ضع كلمة مرور خاص بك'; // SMTP password
21+
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
22+
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
23+
24+
// Content
25+
$mail->isHTML(true);
26+
$mail->CharSet = "UTF-8";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
// autoload.php @generated by Composer
4+
5+
require_once __DIR__ . '/composer/autoload_real.php';
6+
7+
return ComposerAutoloaderInitb7d6377ee324d8c3f56c6d308c8f812a::getLoader();

0 commit comments

Comments
 (0)