Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 96a0815

Browse files
new lessons
1 parent be3246a commit 96a0815

File tree

105 files changed

+327
-355
lines changed

Some content is hidden

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

105 files changed

+327
-355
lines changed

‎LESSON 1 - الدرس/index.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎LESSON 10 - الدرس/index.php

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,16 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>Document</title>
7-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
8-
</head>
9-
<body>
10-
11-
<main class="container">
12-
131

142
<?php
153
$username = "root";
164
$password = "";
175
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
186

7+
$sql = $database->prepare("SELECT * FROM users");
198

9+
$sql->execute();
2010

21-
if(isset($_POST['send'])){
22-
$Title = $_POST['Title'];
23-
$Content = $_POST['Content'];
24-
$Date = $_POST['Date'];
25-
$Time = $_POST['Time'];
26-
27-
$addData = $database->prepare("INSERT INTO articles(Title,Content,Date,Time)
28-
VALUES(:Title, :Content , :Date, :Time)");
11+
echo $sql->columnCount();
2912

30-
$addData->bindParam("Title",$Title);
31-
$addData->bindParam("Content",$Content);
32-
$addData->bindParam("Date",$Date);
33-
$addData->bindParam("Time",$Time);
34-
35-
if($addData->execute()){
36-
echo '<div class="alert alert-success mt-3" role="alert">
37-
تم إضافة بيانات بنجاح
38-
</div>';
39-
40-
}else{
41-
echo '<div class="alert alert-danger" role="alert">
42-
فشل إضافة بيانات
43-
</div>';
44-
echo '';
45-
}
46-
}
4713
?>
4814

49-
<form method="POST">
50-
Title : <input class="form-control" type="text" name="Title" required/>
51-
<br>
52-
Content : <input class="form-control" type="text" name="Content" required/>
53-
<br>
54-
Date : <input class="form-control" type="date" name="Date" required/>
55-
<br>
56-
Time : <input class="form-control" type="time" name="Time" required/>
57-
<br>
58-
<button class="btn btn-danger mt-3" type="submit" name="send">ارسال - Send</button>
59-
</form>
60-
61-
</main>
6215

63-
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
64-
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
65-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
66-
</body>
67-
</html>
6816

‎LESSON 12 - الدرس/index.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
$username = "root";
3+
$password = "";
4+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
5+
6+
if(isset($_POST['upload'])){
7+
$fileType = $_FILES["file"]["type"];
8+
$fileName = $_FILES["file"]["name"];
9+
$file = $_FILES["file"]["tmp_name"];
10+
11+
move_uploaded_file($file,"files/".$fileName);
12+
$position = "files/".$fileName;
13+
$uploadFile = $database->prepare("INSERT INTO files(name,type,position) VALUES(:name,:type,:position)");
14+
$uploadFile->bindParam("name",$fileName);
15+
$uploadFile->bindParam("type",$fileType);
16+
$uploadFile->bindParam("position",$position);
17+
if($uploadFile->execute()){
18+
echo 'تم رفع ملف بنجاح';
19+
}else{
20+
echo 'فشل رفع ملف';
21+
}
22+
}
23+
?>
24+
25+
<form method="POST" enctype="multipart/form-data">
26+
<input type="file" name="file" accept="image/*,video/*,audio/*" required/>
27+
<button type="submit" name="upload">رفع ملف</button>
28+
</form>
File renamed without changes.

‎LESSON 13 - الدرس/index.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎LESSON 14 - 13 - الدرس/index.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
$username = "root";
3+
$password = "";
4+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
5+
6+
$myFiles = $database->prepare("SELECT * FROM files WHERE fileType = 'image/jpeg' ");
7+
$myFiles->execute();
8+
9+
foreach($myFiles AS $data){
10+
$getFile = "data:" . $data['fileType'] . ";base64,".base64_encode($data['file']);
11+
echo "<a href='" . $getFile. "' download>" .$data['fileName'] . "</a> <br>";
12+
echo '<img src="' .$getFile . '" width="300px" />';
13+
14+
}
15+
16+
if(isset($_POST['upload'])){
17+
$fileName = $_FILES['file']["name"];
18+
$fileType = $_FILES['file']["type"];
19+
$fileData = file_get_contents( $_FILES['file']["tmp_name"]);
20+
21+
$addFile = $database->prepare("INSERT INTO files(file,fileName,fileType)
22+
VALUES(:file ,:fileName,:fileType)");
23+
24+
$addFile->bindParam("file",$fileData);
25+
$addFile->bindParam("fileName",$fileName);
26+
$addFile->bindParam("fileType",$fileType);
27+
28+
if($addFile->execute()){
29+
echo 'تم حفظ ملف';
30+
}else{
31+
echo 'فشل تخزين ملف';
32+
}
33+
34+
}
35+
36+
37+
38+
?>
39+
40+
<form method="POST" enctype="multipart/form-data">
41+
42+
<input type="file" name="file" required/>
43+
44+
<button type="submit" name="upload" >حفظ ملف</button>
45+
</form>

‎LESSON 14 - الدرس/index.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /