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 be3246a

Browse files
lessons
0 parents commit be3246a

File tree

105 files changed

+11062
-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.

105 files changed

+11062
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
try{
4+
$username = 'root';
5+
$password = '';
6+
7+
$database = new PDO("mysql:host=localhost; dbname=codershiyar; " ,$username ,$password );
8+
// $database = new PDO("mysql:host=server232.web-hosting.com; dbname=shiygtjs_academy" ,$username ,$password );
9+
if($database){
10+
11+
echo 'تم اتصال بقاعدة البيانات بنجاح';
12+
}
13+
14+
15+
}catch(Exception $error){
16+
echo 'فشل اتصال بقاعدة بيانات';
17+
}
18+
19+
?>

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
13+
14+
<?php
15+
$username = "root";
16+
$password = "";
17+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
18+
19+
20+
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)");
29+
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+
}
47+
?>
48+
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>
62+
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>
68+

‎LESSON 11 - الدرس/codershiyar.sql

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
-- phpMyAdmin SQL Dump
2+
-- version 5.0.2
3+
-- https://www.phpmyadmin.net/
4+
--
5+
-- Host: 127.0.0.1
6+
-- Generation Time: Aug 21, 2020 at 04:22 PM
7+
-- Server version: 10.4.13-MariaDB
8+
-- PHP Version: 7.4.8
9+
10+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11+
START TRANSACTION;
12+
SET time_zone = "+00:00";
13+
14+
15+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
16+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
17+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
18+
/*!40101 SET NAMES utf8mb4 */;
19+
20+
--
21+
-- Database: `codershiyar`
22+
--
23+
24+
-- --------------------------------------------------------
25+
26+
--
27+
-- Table structure for table `files`
28+
--
29+
30+
CREATE TABLE `files` (
31+
`id` int(11) NOT NULL,
32+
`name` varchar(255) NOT NULL,
33+
`type` varchar(255) NOT NULL,
34+
`position` varchar(255) NOT NULL
35+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
36+
37+
--
38+
-- Dumping data for table `files`
39+
--
40+
41+
INSERT INTO `files` (`id`, `name`, `type`, `position`) VALUES
42+
(1, 'course.sql', 'application/octet-stream', 'files/course.sql'),
43+
(2, 'download (4).jfif', 'image/jpeg', 'files/download (4).jfif'),
44+
(3, 'download (3).jfif', 'image/jpeg', 'files/download (3).jfif');
45+
46+
--
47+
-- Indexes for dumped tables
48+
--
49+
50+
--
51+
-- Indexes for table `files`
52+
--
53+
ALTER TABLE `files`
54+
ADD PRIMARY KEY (`id`);
55+
56+
--
57+
-- AUTO_INCREMENT for dumped tables
58+
--
59+
60+
--
61+
-- AUTO_INCREMENT for table `files`
62+
--
63+
ALTER TABLE `files`
64+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
65+
COMMIT;
66+
67+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
68+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
69+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

‎LESSON 11 - الدرس/files/course.sql

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
-- phpMyAdmin SQL Dump
2+
-- version 5.0.2
3+
-- https://www.phpmyadmin.net/
4+
--
5+
-- Host: 127.0.0.1
6+
-- Generation Time: Aug 18, 2020 at 10:16 PM
7+
-- Server version: 10.4.13-MariaDB
8+
-- PHP Version: 7.4.8
9+
10+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11+
START TRANSACTION;
12+
SET time_zone = "+00:00";
13+
14+
15+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
16+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
17+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
18+
/*!40101 SET NAMES utf8mb4 */;
19+
20+
--
21+
-- Database: `shiygtjs_academy`
22+
--
23+
24+
-- --------------------------------------------------------
25+
26+
--
27+
-- Table structure for table `course`
28+
--
29+
30+
CREATE TABLE `course` (
31+
`id` int(11) NOT NULL,
32+
`name` varchar(255) NOT NULL,
33+
`img` varchar(255) NOT NULL,
34+
`link` varchar(255) NOT NULL
35+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36+
37+
--
38+
-- Dumping data for table `course`
39+
--
40+
41+
INSERT INTO `course` (`id`, `name`, `img`, `link`) VALUES
42+
(1, 'Master HTML', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnyrnapIyOphXAkIcR5DDOGkz'),
43+
(2, 'Master CSS', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnyoxjc9Prw0uhwgp6YZ2-_sg'),
44+
(3, 'Bootstrap 4', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnyrPiX-b1MNG-MSPAJ0OgpHA'),
45+
(4, 'Master JavaScript Development', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnyp1nMM8mGRzpwuu6FNxFy0D'),
46+
(5, 'Master PHP web development', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnypZGBMDMGYI48WfZEyAgQK_'),
47+
(6, 'Master Java Development', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnyol1gLHHgsiQbcOayNljG4_'),
48+
(7, 'Master Android Developer', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnypdGHUkZ3f52wTDRywLQo4l'),
49+
(8, 'SQL - MySQL', '', 'https://www.youtube.com/playlist?list=PLMTdZ61eBnyoQoEmLOcgTBdrAOVT-GFju'),
50+
(9, 'PHP - MYSQL', '', 'https://www.youtube.com/watch?v=y5vMI7Nicyk&list=PLMTdZ61eBnypZGBMDMGYI48WfZEyAgQK_&index=60');
51+
52+
--
53+
-- Indexes for dumped tables
54+
--
55+
56+
--
57+
-- Indexes for table `course`
58+
--
59+
ALTER TABLE `course`
60+
ADD PRIMARY KEY (`id`);
61+
62+
--
63+
-- AUTO_INCREMENT for dumped tables
64+
--
65+
66+
--
67+
-- AUTO_INCREMENT for table `course`
68+
--
69+
ALTER TABLE `course`
70+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
71+
COMMIT;
72+
73+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
74+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
75+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
179 KB
Binary file not shown.
341 KB
Binary file not shown.

‎LESSON 11 - الدرس/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>

‎LESSON 11 - الدرس/view.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
$username = "root";
3+
$password = "";
4+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
5+
6+
$files = $database->prepare("SELECT * FROM files");
7+
$files->execute();
8+
foreach($files AS $file ){
9+
echo "<a href='" ."http://localhost/server/". $file["position"] . "' download>".$file["name"]."</a> <br>";
10+
}
11+
?>
12+

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
2+
<?php
3+
$username = "root";
4+
$password = "";
5+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
6+
7+
8+
9+
$getItems = $database->prepare("SELECT * FROM products");
10+
$getItems->execute();
11+
12+
foreach($getItems AS $data){
13+
echo '<div class="card text-white bg-success mb-3" style="max-width: 18rem;">
14+
<div class="card-header">منتج - ' . $data['Id']. '</div>
15+
<div class="card-body">
16+
<h5 class="card-title">' . $data['Name'] . '</h5>
17+
<p class="card-text">' .$data['Price']. ' </p>
18+
<form method="POST"> <button class="btn btn-danger" type="submit" name="remove" value="'.$data['Id'] .' ">X - حذف </button></from/>
19+
20+
</div>
21+
</div>';
22+
23+
24+
}
25+
26+
if(isset($_POST['remove'])){
27+
$removeProduct = $database->prepare("DELETE FROM products WHERE Id = :id ");
28+
$getId = $_POST['remove'];
29+
$removeProduct->bindParam("id",$getId);
30+
31+
if($removeProduct->execute()){
32+
echo 'تم حذف بنجاح';
33+
header("Location: index.php");
34+
}else{
35+
echo 'فشل حذف';
36+
}
37+
}
38+
?>
39+
40+

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
<?php
4+
$username = "root";
5+
$password = "";
6+
$database = new PDO("mysql:host=localhost; dbname=codershiyar;",$username,$password);
7+
8+
9+
10+
if(isset( $_GET['edit'])){
11+
$getProduct = $database->prepare("SELECT * FROM products WHERE Id = :id");
12+
$getProduct->bindParam("id",$_GET['edit']);
13+
$getProduct->execute();
14+
foreach($getProduct AS $data){
15+
echo '
16+
<div class="container">
17+
<form method="POST" >
18+
Name: <input class="form-control" type="text" name="Name" value="'.$data['Name'].'"/>
19+
Price: <input class="form-control" type="text" name="Price" value="'.$data['Price'].'"/>
20+
<button class="btn btn-dark mt-3" type="submit" name="update" value="' . $data['Id'].'"> تحديث</button>
21+
<a class="btn btn-success mt-3" href="index.php"> عودة</a>
22+
</form>
23+
</div>
24+
';
25+
}
26+
27+
if(isset($_POST['update'])){
28+
$update = $database->prepare("UPDATE products
29+
SET Name = :Name , Price = :Price WHERE Id = :Id");
30+
$update->bindParam("Name",$_POST['Name']);
31+
$update->bindParam("Price",$_POST['Price']);
32+
$update->bindParam("Id",$_POST['update']);
33+
$update->execute();
34+
header("Location: edit.php?edit=" . $_POST['update']);
35+
}
36+
37+
}
38+
?>

0 commit comments

Comments
(0)

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