-
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
1 parent
63e86dc
commit 316a4c2
Showing
31 changed files
with
1,694 additions
and
3 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
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 |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# Laser-hair-removal-app | ||
Full php app control panel to administrate clients database and sessions of laser hair removal in a beauty center. | ||
# Laser hair removal app to manage client's threataments in beauty center | ||
|
||
Full PHP script control panel to manage client's database and sessions of laser hair removal threataments in a beauty center. | ||
|
||
## Features: | ||
|
||
- Add, edit, remove clients. | ||
- List all clients or search one client. | ||
- Upload system of client's disclaimer threatament documents. | ||
- Add, remove new threatament to client. (Mode just one session or Pack of 5 sessions ("bonus pack")). | ||
- Consume session of client. | ||
- Counter of sessions left of each threatament of client. | ||
- Option "pay before session threatament" or "pending payment" label reminder). | ||
- Note: script is actually only translated to spanish, sorry. | ||
|
||
## Requirements | ||
|
||
PHP and MySQL database. | ||
|
||
## Instalation | ||
|
||
1.) Import in MySQL tables struct from database_struct.sql. | ||
2.) Configure MySQL connection parameters in connectDB.php. | ||
3.) Set in upload.php file full path to /documents/ folder where will be stored client's disclaimer threatament documents. | ||
4.) Upload all files to your hosting. Done. | ||
|
||
## Screenshots | ||
Main page of control panel: | ||
<img src=screenshots/01.jpg width=500> | ||
|
||
Listing clients: | ||
<img src=screenshots/02.jpg width=500> | ||
|
||
Add new client to database: | ||
<img src=screenshots/03.jpg width=500> | ||
|
||
Client threataments and sessions consumption: | ||
<img src=screenshots/04.jpg width=500> | ||
|
||
Add new threatament: | ||
<img src=screenshots/05.jpg width=500> | ||
|
||
Sessions consumption page: | ||
<img src=screenshots/06.jpg width=500> | ||
|
||
Client's disclaimer threatament documents upload: | ||
<img src=screenshots/07.jpg width=500> | ||
|
||
## Collaborations | ||
|
||
Collaborations to improve script are always welcome. |
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,144 @@ | ||
<? | ||
class Clients | ||
{ | ||
|
||
function __construct() | ||
{ | ||
|
||
} | ||
|
||
|
||
public function getClients($db,$page){ | ||
$offset=paginate($db,$page,"all"); | ||
$results = $db->getData("SELECT * FROM clients ORDER BY lastname ASC LIMIT $offset,10"); | ||
if($results){ | ||
$template = new Template; | ||
$template->load("templates/client_list_all.php"); | ||
$template->replace("data", $results); | ||
$template->publish(); | ||
} | ||
} | ||
|
||
|
||
public function searchClients($db,$word){ | ||
$results = $db->getData("SELECT * FROM clients WHERE ( lastname LIKE '%".$word."%' OR name LIKE '%".$word."%' OR phone LIKE '%".$word."%' ) ORDER BY lastname ASC"); | ||
if($results){ | ||
$template = new Template; | ||
$template->load("templates/client_list_all.php"); | ||
$template->replace("data", $results); | ||
$template->publish(); | ||
} | ||
} | ||
|
||
public function formAddClients(){ | ||
$template = new Template; | ||
$template->load("templates/client_form_add.php"); | ||
$data=array( | ||
'op'=>'adding', | ||
'cid'=>'', | ||
'name'=>'', | ||
'lastname'=>'', | ||
'yearborn'=>'', | ||
'sex'=>'', | ||
'address'=>'', | ||
'phone'=>'', | ||
'email'=>'', | ||
'coloreyes'=>'', | ||
'colorhair'=>'', | ||
'skintype'=>'', | ||
'other'=>'' | ||
); | ||
$template->replace("data", $data); | ||
$template->publish(); | ||
} | ||
|
||
public function addClients($db,$name,$lastname,$yearborn,$sex,$address,$phone,$email,$coloreyes,$colorhair,$skintype,$other){ | ||
$result = $db->executeInstruction(" | ||
INSERT INTO `clients` (`name`, `lastname`, `yearborn`, `sex`, `address`, `phone`, `email`, `coloreyes`, `colorhair`, `skintype`, `other`, `dateadded`) | ||
VALUES ('".$name."', '".$lastname."', '".$yearborn."', '".$sex."', '".$address."', '".$phone."', '".$email."', '".$coloreyes."', '".$colorhair."', '".$skintype."', '".$other."', '".date("Y-m-d")."'); | ||
"); | ||
$template = new Template; | ||
$template->load("templates/alert_message.php"); | ||
if($result){ | ||
$data=array( | ||
'type'=>'alert-success', | ||
'message'=>'Datos de cliente insertados con éxito en la base de datos.' | ||
); | ||
}else{ | ||
$data=array( | ||
'type'=>'alert-danger', | ||
'message'=>'Error. No fue posible insertar los datos de cliente en la base de datos.' | ||
); | ||
} | ||
$template->replace("data", $data); | ||
$template->publish(); | ||
} | ||
|
||
public function formEditClients($db,$id){ | ||
$result = $db->getDataSingle("SELECT * FROM `clients` WHERE `id` = '".$id."'"); | ||
if($result){ | ||
$template = new Template; | ||
$template->load("templates/client_form_edit.php"); | ||
$result['op']='editing'; | ||
$template->replace("data", $result); | ||
$template->publish(); | ||
} | ||
} | ||
|
||
public function editClients($db,$name,$lastname,$yearborn,$sex,$address,$phone,$email,$coloreyes,$colorhair,$skintype,$other,$cid){ | ||
$result = $db->executeInstruction("UPDATE `clients` SET `name`='".$name."', `lastname`='".$lastname."', `yearborn`='".$yearborn."', `sex`='".$sex."', `address`='".$address."', `phone`='".$phone."', `email`='".$email."', `coloreyes`='".$coloreyes."', `colorhair`='".$colorhair."', `skintype`='".$skintype."', `other`='".$other."' WHERE `id` = '".$cid."'"); | ||
if($result){ | ||
$template = new Template; | ||
$template->load("templates/alert_message.php"); | ||
$data=array( | ||
'type'=>'alert-success', | ||
'message'=>'Datos de cliente modificados con éxito.<br><br> <a href=orders.php?op=view&cid='.sanitize($_POST['cid']).'&name='.sanitize($_POST['name']).'&lastname='.sanitize($_POST['lastname']).'><b>Volver a ficha de cliente</b></a>' | ||
); | ||
$template->replace("data", $data); | ||
$template->publish(); | ||
} | ||
} | ||
|
||
public function uploadClients(){ | ||
$template = new Template; | ||
$template->load("templates/client_form_edit.php"); | ||
$result['op']='uploading'; | ||
$template->replace("data", $result); | ||
$template->publish(); | ||
} | ||
|
||
public function formRemoveClients($cid,$name,$lastname) { | ||
$template = new Template; | ||
$template->load("templates/client_form_remove.php"); | ||
$data=array( | ||
'op'=>'removing', | ||
'cid'=>$cid, | ||
'name'=>$name, | ||
'lastname'=>$lastname | ||
); | ||
$template->replace("data", $data); | ||
$template->publish(); | ||
} | ||
|
||
public function removeClients($db,$cid) { | ||
$result = $db->executeInstruction("DELETE FROM `clients` WHERE `id` = '".$cid."'"); | ||
$template = new Template; | ||
$template->load("templates/alert_message.php"); | ||
if($result){ | ||
$data=array( | ||
'type'=>'alert-success', | ||
'message'=>'Datos de cliente eliminados con éxito.' | ||
); | ||
} | ||
else{ | ||
$data=array( | ||
'type'=>'alert-danger', | ||
'message'=>'Error. No fue posible eliminar los datos de cliente.' | ||
); | ||
} | ||
$template->replace("data", $data); | ||
$template->publish(); | ||
} | ||
} | ||
|
||
?> |
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,76 @@ | ||
<?php | ||
require 'functions.php'; | ||
require 'mysqldatabase.class.php'; | ||
require 'template.class.php'; | ||
require 'clients.class.php'; | ||
require 'connectDB.php'; | ||
|
||
include('templates/header.php'); | ||
|
||
$db = new MySQLDatabase($HOST,$USERNAME,$PASSWORD,$DATABASE); | ||
$db->connect(); | ||
if(isset($_REQUEST['op'])) | ||
$op = sanitize($_REQUEST['op']); | ||
else | ||
$op = ""; | ||
$client = new Clients; | ||
switch($op) { | ||
default: | ||
echo '<br>'; | ||
if(isset($_GET['page'])) | ||
$page=sanitize($_GET['page']); | ||
else | ||
$page=1; | ||
if(isPositiveValue($page)) | ||
$client->getClients($db,$page); | ||
break; break; | ||
case "searching": | ||
echo '<br>'; | ||
if(isset($_POST['word'])&&$_POST['word']!=""){ | ||
$word=sanitize($_POST['word']); | ||
$client->searchClients($db,$word); | ||
} | ||
break; | ||
case "add": | ||
$client->formAddClients(); | ||
break; | ||
case "adding": | ||
$client->formAddClients($db,sanitize($_POST['name']),sanitize($_POST['lastname']),sanitize($_POST['yearborn']),sanitize($_POST['sex']),sanitize($_POST['address']),sanitize($_POST['phone']),sanitize($_POST['email']),sanitize($_POST['coloreyes']),sanitize($_POST['colorhair']),sanitize($_POST['skintype']),sanitize($_POST['other'])); | ||
break; | ||
case "edit": | ||
$id=sanitize($_GET['cid']); | ||
if(isPositiveValue($id)) | ||
$client->formEditClients($db,$id); | ||
break; | ||
case "editing": | ||
$id=sanitize($_POST['cid']); | ||
if(isPositiveValue($id)) | ||
$client->editClients($db,sanitize($_POST['name']),sanitize($_POST['lastname']),sanitize($_POST['yearborn']),sanitize($_POST['sex']),sanitize($_POST['address']),sanitize($_POST['phone']),sanitize($_POST['email']),sanitize($_POST['coloreyes']),sanitize($_POST['colorhair']),sanitize($_POST['skintype']),sanitize($_POST['other']),$id); | ||
break; | ||
case "uploading": | ||
$client->uploadClients(); | ||
break; | ||
case "remove": | ||
$id=sanitize($_GET['cid']); | ||
if(isPositiveValue($id)) | ||
$client->formRemoveClients($id,sanitize($_GET['name']),sanitize($_GET['lastname'])); | ||
break; | ||
case "removing": | ||
$cid=sanitize($_POST['cid']); | ||
if(isPositiveValue($cid)) | ||
$client->removeClients($db,$cid); | ||
break; | ||
|
||
|
||
} | ||
$db->close(); | ||
|
||
|
||
|
||
|
||
include('templates/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,6 @@ | ||
<?php | ||
$HOST = 'localhost'; | ||
$USERNAME = 'your_mysql_username'; | ||
$PASSWORD = 'your_mysql_password'; | ||
$DATABASE = 'your_database_name'; | ||
?> |
Oops, something went wrong.