コード例 #1
0
function checkIfExists($con, $columnName, $data)
{
    $sql = "SELECT " . $columnName . " FROM users WHERE " . $columnName . "='" . $data . "'";
    $result = pushQueryToArray($con, $sql);
    if (!empty($result)) {
        return true;
    } else {
        return false;
    }
}
コード例 #2
0
function makeTreatmentsOfAppointment($con)
{
    $sqlLatest = "SELECT max(ID) FROM appointments";
    $appointmentID = pushQueryToArray($con, $sqlLatest);
    foreach ($_SESSION['chosenTreatments'] as $treatment) {
        $sql = "INSERT INTO appointments_has_treatments (appointments_ID, treatments_ID) VALUES (" . $appointmentID[0]['max(ID)'] . "," . $treatment . ")";
        mysqli_query($con, $sql);
    }
    unsetAppointmentSessionVars();
    redirectToHome();
}
コード例 #3
0
function searchUsers($con)
{
    $sql = "SELECT *\t\t\t\t\t\r\n\t\t\tFROM users\r\n\t\t\tWHERE lastName\r\n\t\t\tLIKE '%" . $_GET['search'] . "%'\r\n\t\t\tOR firstName LIKE '%" . $_GET['search'] . "%'\r\n\t\t\tOR phoneNumber LIKE '%" . $_GET['search'] . "%'\r\n\t\t\tor emailAdress LIKE '%" . $_GET['search'] . "%'\t\r\n\t\t\tORDER BY ID DESC";
    $usersBySearchInput = pushQueryToArray($con, $sql);
    return $usersBySearchInput;
}
コード例 #4
0
ファイル: credentials.php プロジェクト: jdreg95/haarstudio-c
<?php

require '../other/config.php';
// config.php is always required.
require '../functions/generalFunctions.php';
// generalFunctions.php is required on almost every page. It contains general functions used on many pages.
require '../other/metaData.php';
// metaData.php is used to print the credentials of the user.
checkIfLoggedIn();
//Check if the user is logged in.
$nameInfo = getFullName($con, $_SESSION['ID']);
//The variable nameInfo contains data about the name of the user.
$sql = "SELECT * FROM users WHERE ID=" . $_SESSION['ID'];
//Query that retrieves user info.
$userInfo = pushQueryToArray($con, $sql);
//The array userInfo contains the retrieved user info.
require '../pages/requireshtml/htmlTillEndHeader.php';
?>
	<div class="column">				
		<div class="lined">
			<h1>Gegevens van <?php 
echo $nameInfo[0];
?>
</h1>
			<span class="bold-line"></span>
		</div>
		<p>U bent nu op de pagina 'Mijn gegevens' u kunt hiernaast zien wat uw huidige gegevens zijn.</p>
		<p>Druk hieronder op 'Wijzig gegevens' om uw gegevens te wijzigen. Om uw wachtwoord te wijzigen, druk op 'Wijzig wachtwoord'.</p>
		<a href="../pages/home.php" class="button link" id="back">Terug</a>
	</div>	
	<div class="column">
コード例 #5
0
ファイル: redirection.php プロジェクト: jdreg95/haarstudio-c
function defineDay($con)
{
    $day = date('l', strtotime($_SESSION['date']));
    if ($day == "Sunday") {
        $_SESSION['errorDate'] = "Sorry, we zijn op zondag gesloten, kies alstublieft een andere datum.";
        header('Location:  ../pages/steptwomakeapp.php');
        die;
    } else {
        $sql = "SELECT starttime, endtime FROM openingtimes WHERE day='" . $day . "'";
        $_SESSION['detailsOfDate'] = pushQueryToArray($con, $sql);
    }
    print_r($_SESSION['detailsOfDate']);
    checkIfAlreadyClosed($con);
}
コード例 #6
0
require '../other/config.php';
// config.php is always required.
require '../functions/generalFunctions.php';
// generalFunctions.php is needed on almost every page. It contains general functions used on many pages.
require '../functions/stepTwoMakeAppFunctions.php';
// stepTwoMakeAppFunctions.php is required. It contains functions used on this page.
checkIfLoggedIn();
// Chekc if the user is logged in.
checkIfCustomerTypeIsValid();
// Check if the customertype is valid.
//SQL code to retrieve treatments and hairdressers and the corresponding arrays with the results.
$sqlTreatments = "SELECT ID, name, code FROM treatments";
$treatments = pushQueryToArray($con, $sqlTreatments);
$sqlHairdressers = "SELECT * FROM hairdressers";
$hairDressers = pushQueryToArray($con, $sqlHairdressers);
require '../pages/requireshtml/htmlTillEndHeader.php';
?>
					<div class="column">
						<div class="lined">
						<h1><?php 
echo isset($_SESSION['edit']) && $_SESSION['edit'] == true ? 'Wijzig' : 'Maak';
?>
 een afspraak</h1>
							<span class="bold-line"></span>
						</div>
						<h2>Stap 2</h2>
						<p>
							Kies hiernaast uw gewenste behandelingen, kapper of kapster en datum.
							Data voor de dag van vandaag zijn niet beschikbaar voor keuze.
						</p>
コード例 #7
0
function printAppointmentDetails($con)
{
    $sql = "SELECT appointments.*, hairdressers.name AS kapster, customertypes.name AS klantType, \r\n\t\t\ttreatments.name AS behandeling, users.firstName, users.insertion, users.lastName\r\n\t\t\tFROM appointments JOIN hairdressers ON hairdressers.ID = appointments.hairDressers_ID \r\n\t\t\tJOIN customertypes ON customertypes.ID = appointments.customerTypes_ID \r\n\t\t\tJOIN users ON users.ID = appointments.USERS_ID\r\n\t\t\tJOIN (appointments_has_treatments JOIN treatments ON treatments.ID = appointments_has_treatments.treatments_ID) \r\n\t\t\tON appointments_has_treatments.appointments_ID = appointments.ID\r\n\t\t\tWHERE appointments.ID=" . $_GET['app'];
    $appointmentDetails = pushQueryToArray($con, $sql);
    return $appointmentDetails;
}
コード例 #8
0
function createEditSessionVars($con)
{
    $_SESSION['chosenTreatments'] = [];
    $sqlSelectAppDetails = "SELECT\r\n\t\t\t\t\t\t\t\t\tusers_ID,\r\n\t\t\t\t\t\t\t\t\thairDressers_ID, \r\n\t\t\t\t\t\t\t\t\tdate, \r\n\t\t\t\t\t\t\t\t\ttime, \r\n\t\t\t\t\t\t\t\t\tnotice, \r\n\t\t\t\t\t\t\t\t\tduration, \r\n\t\t\t\t\t\t\t\t\tcustomerTypes_ID\r\n\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\tappointments\r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tID=" . $_GET['edit'];
    $appDetails = pushQueryToArray($con, $sqlSelectAppDetails);
    $_SESSION['edit'] = true;
    $_SESSION['appointmentID'] = $_GET['edit'];
    $_SESSION['date'] = $appDetails[0]['date'];
    $_SESSION['hairdresser'] = $appDetails[0]['hairDressers_ID'];
    $_SESSION['notice'] = $appDetails[0]['notice'];
    $_SESSION['customerType'] = $appDetails[0]['customerTypes_ID'];
    $sqlSelectTreatmentsOfApp = "SELECT treatments_ID \r\n\t\t\t\t\t\t\t\tFROM appointments_has_treatments \r\n\t\t\t\t\t\t\t\t\tJOIN treatments ON treatments.ID = appointments_has_treatments.treatments_ID\r\n\t\t\t\t\t\t\t\tWHERE appointments_ID=" . $_GET['edit'];
    $treatmentsQuery = mysqli_query($con, $sqlSelectTreatmentsOfApp);
    $_SESSION['chosenTreatments'] = [];
    foreach ($treatmentsQuery as $treatmentID) {
        foreach ($treatmentID as $id) {
            array_push($_SESSION['chosenTreatments'], $id);
        }
    }
}