-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 838b086
Showing
53 changed files
with
20,993 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
<?php require '../../config.php'; | ||
|
||
if(!isset($_SESSION['admin_name'])){ | ||
header('location:../login.php'); | ||
} | ||
require '../../functions/validation.php'; | ||
$path_picture='../../assets/images/logo.png'; | ||
$path_addFile=''; | ||
?> | ||
<?php | ||
require '../inc/header.php'; | ||
if( isset($_POST['submit'])){ | ||
|
||
if(!requird_string($_POST['name'])){ | ||
$errors[]='The name must be not empty'; | ||
} | ||
if(!requird_email($_POST['email'])){ | ||
$errors[]='The email must be not empty'; | ||
} | ||
else if(!validEmail($_POST['email'])){ | ||
$errors[]='The email must be not empty'; | ||
} | ||
|
||
if(!requird_string($_POST['password'])){ | ||
$errors[]='The password must be not empty'; | ||
} | ||
|
||
|
||
|
||
if(!$errors){ | ||
$name=$_POST['name']; | ||
$email=$_POST['email']; | ||
$password = password_hash($_POST['password'],PASSWORD_DEFAULT); | ||
$sql = "INSERT INTO admins (`admin_name`,`admin_email`,`admin_password`) | ||
VALUES ('$name','$email','$password') "; | ||
insert($sql); | ||
?> | ||
|
||
<div class="container"> | ||
|
||
<div class="alert alert-danger" role="alert"> | ||
<?='Success';?> | ||
</div> | ||
</div> | ||
<?php | ||
} | ||
if($errors): | ||
?> | ||
<div class="container"> | ||
|
||
<div class="alert alert-danger" role="alert"> | ||
<?php foreach($errors as $error){ | ||
echo $error."<br>"; | ||
}?> | ||
|
||
</div> | ||
</div> | ||
<?php endif;}?> | ||
<div class="container"> | ||
<h2>Add new admin</h2> | ||
<form action="" method="POST"> | ||
<div class="mb-3"> | ||
<label for="name" class="form-label">Name</label> | ||
<input type="text" name='name'class="form-control" id="name" placeholder="Enter your name"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="email" class="form-label">Email address</label> | ||
<input type="text" name ='email'class="form-control" id="email" placeholder="Enter your email"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="message" class="form-label">Password</label> | ||
<input name='password' type="password"class="form-control" id="message" ></input> | ||
</div> | ||
<button type="submit" name='submit' class="btn btn-primary">Save</button> | ||
</form> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> | ||
|
||
<?php require '../inc/footer.php';?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php require '../../config.php'; | ||
|
||
require '../../functions/validation.php'; | ||
$path_picture='../../assets/images/logo.png'; | ||
require '../inc/header.php'; | ||
$errors=[]; | ||
if( isset($_GET['submit'])){ | ||
$name=$_GET['name']; | ||
if(requird_string($_GET['name'])){ | ||
if(minLength($_GET['name'],3)){ | ||
|
||
} | ||
else{ | ||
$errors[]='The minimum length of this name must be equal 3'; | ||
} | ||
} | ||
else{ | ||
$errors[]='The field is empty'; | ||
} | ||
|
||
if(!$errors){ | ||
$sql="INSERT INTO cities (city_name) VALUES ('$name')"; | ||
insert($sql); | ||
} | ||
if($errors): | ||
?> | ||
<div class="container"> | ||
|
||
<div class="alert alert-danger" role="alert"> | ||
<?php foreach($errors as $error){ | ||
echo $error."<br>"; | ||
}?> | ||
|
||
</div> | ||
</div> | ||
<?php endif;}?> | ||
|
||
|
||
<div class="container"> | ||
<h2>Add new cities</h2> | ||
<form action="" method="GET"> | ||
<div class="mb-3"> | ||
<label for="name" class="form-label">Name Of City</label> | ||
<input type="text" name='name'class="form-control" id="name" placeholder="Enter your name"> | ||
</div> | ||
<button type="submit" name='submit' class="btn btn-primary">Save</button> | ||
</form> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> | ||
|
||
<?php require '../inc/footer.php';?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
require '../../config.php'; | ||
|
||
require '../../functions/validation.php'; | ||
$path_picture='../../assets/images/logo.png'; | ||
require '../inc/header.php'; | ||
$errors=''; | ||
if(isset($_POST['name'])){ | ||
$id=$_POST['id']; | ||
$name=$_POST['name']; | ||
$sql="UPDATE cities SET city_name='$name' WHERE city_id=$id"; | ||
$result=mysqli_query($conn,$sql); | ||
} | ||
if(isset($_GET['id'])){ | ||
if(is_numeric($_GET['id'])){ | ||
$row=get_row('cities','city_id',$_GET['id']); | ||
if($row){ | ||
// update('cities',$_GET['id']); | ||
} | ||
else{ | ||
header('location:view_all.php'); | ||
} | ||
} | ||
else{ | ||
header('location:view_all.php'); | ||
} | ||
|
||
|
||
} | ||
else{ | ||
header('location:view_all.php'); | ||
} | ||
?> | ||
<div class="container"> | ||
<h2>Edit this city</h2> | ||
<h2><?= $errors?></h2> | ||
<form action="" method="POST"> | ||
<div class="mb-3"> | ||
<label for="name" class="form-label">Name Of City</label> | ||
<input type="text" name='name'class="form-control" id="name" placeholder="<?= $row['city_name']?>"> | ||
<input type='hidden'name ='id' value='<?= $row['city_id']?>' > | ||
</div> | ||
<button type="submit" name='submit' class="btn btn-primary">Save</button> | ||
</form> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> | ||
|
||
<?php ;unset($_GET['id']); require '../inc/footer.php';?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
require '../../config.php'; | ||
require '../../functions/validation.php'; | ||
$path_picture='../../assets/images/logo.png'; | ||
require '../inc/header.php'; | ||
$cities=selectAll('cities'); | ||
|
||
?> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>All Cities</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>City id</th> | ||
<th>City name</th> | ||
<th>Action</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php for($num=0;$num<sizeof($cities);$num++):?> | ||
<tr> | ||
<td><?= $num+1?></td> | ||
<td><?= $cities[$num][1]?></td> | ||
<td class="text-center"> | ||
<a href="<?php echo 'http://localhost/medicalProject_using%20php_mysql/admin/cities/edit.php?id='.$cities[$num][0]; ?>" class="btn btn-info">Edit</a> | ||
<a href="<?php echo 'http://localhost/medicalProject_using%20php_mysql/delete.php?id='.$cities[$num][0].'&table=cities&field=city_id';?>" class="btn btn-danger delete" >Delete</a> | ||
</td> | ||
|
||
</tr> | ||
|
||
<?php endfor;?> | ||
|
||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- Rest of your page content goes here --> | ||
|
||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Navigation Example</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | ||
</head> | ||
<body> | ||
|
||
<nav class="navbar navbar-expand-lg navbar-light bg-light"> | ||
<a class="navbar-brand" href="#"><img src="<?=$path_picture?>" width="70" alt="LOGO"></a> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarNav"> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item active"> | ||
<a class="nav-link" href="#">Home</a> | ||
</li> | ||
<li class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" href="http://localhost/medicalProject_using%20php_mysql/admin/cities/add.php" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
Cities | ||
</a> | ||
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> | ||
<a class="dropdown-item" href="http://localhost/medicalProject_using%20php_mysql/admin/cities/add.php"><span class="badge badge-primary ml-1">Add</span></a> | ||
<a class="dropdown-item" href="http://localhost/medicalProject_using%20php_mysql/admin/cities/view_all.php"><span class="badge badge-danger ml-1">View all</span></a> | ||
</div> | ||
</li> | ||
<li class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
Services | ||
</a> | ||
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> | ||
<a class="dropdown-item" href="#"><span class="badge badge-primary ml-1">Add</span></a> | ||
<a class="dropdown-item" href="#"><span class="badge badge-danger ml-1">View all</span></a> | ||
</div> | ||
</li> | ||
<li class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
Orders | ||
</a> | ||
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> | ||
|
||
<a class="dropdown-item" href="#"><span class="badge badge-danger ml-1">View all</span></a> | ||
</div> | ||
</li> | ||
<li class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
Admins | ||
</a> | ||
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> | ||
<a class="dropdown-item" href="<?=$path_addFile?>"><span class="badge badge-primary ml-1">Add</span></a> | ||
<a class="dropdown-item" href="#"><span class="badge badge-danger ml-1">View all</span></a> | ||
</div> | ||
</li> | ||
<li> | ||
<?php | ||
if(isset($_SESSION['admin_name'])):?> | ||
<a class="dropdown-item" href='http://localhost/medicalProject_using%20php_mysql/admin/logout.php'>Logout</a> | ||
</li> | ||
<?php endif;?> | ||
|
||
</ul> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php require '../config.php'; | ||
if(!isset($_SESSION['admin_name'])){ | ||
header('location:login.php'); | ||
} | ||
$path_picture='../assets/images/logo.png'; | ||
$path_addFile='admins/add.php' | ||
?> | ||
<?php require BLA.'inc/header.php'; ?> | ||
|
||
|
||
<?php require BLA.'/inc/footer.php'; ?> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
require '../config.php'; | ||
require '../functions/validation.php'; | ||
|
||
|
||
if(isset($_POST['submit'])){ | ||
session_unset(); | ||
if(!requird_string($_POST['name'])){ | ||
$errors[]='The name must be not empty'; | ||
} | ||
if(!requird_string($_POST['password'])){ | ||
$errors[]='The password must be not empty'; | ||
} | ||
if(!$errors &&!select_with_name_and_password($_POST['name'],$_POST['password'])){ | ||
$errors[]='Try again that admin is not found'; | ||
} | ||
if(!$errors){ | ||
$_SESSION['admin_name']=$_POST['name']; | ||
header('location:index.php'); | ||
} | ||
|
||
} | ||
?> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Login </title> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-4"> | ||
<h2>Login Form</h2> | ||
<?php if(!empty($errors)):?> | ||
|
||
<div class="alert alert-danger" role="alert"> | ||
<?php foreach($errors as $error){echo $error."<br>";}?> | ||
</div> | ||
<?php endif;?> | ||
<form method='POST' action =''> | ||
<div class="form-group"> | ||
<label for="username">Username</label> | ||
<input type="text" name='name' class="form-control" id="username" placeholder="Enter your username"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="password">Password</label> | ||
<input type="password" name='password'class="form-control" id="password" placeholder="Enter your password"> | ||
</div> | ||
<button type="submit" name='submit' class="btn btn-primary">Login</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
session_start(); | ||
if(isset($_SESSION['admin_name'])){ | ||
session_destroy();} | ||
else{ | ||
header("location:http://localhost/medicalProject_using%20php_mysql/index.php"); | ||
} | ||
?> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.