Пример #1
0
<?php

require_once './controlador_tutor.php';
$method = $_SERVER['REQUEST_METHOD'];
$source = htmlentities($_POST['source']);
if (strcmp($method, 'POST') == 0) {
    $clave_prof = htmlentities($_POST['clave_prof']);
    if ($source == 'alta' || $source == 'modificacion') {
        $apellido_p = htmlentities($_POST['apellidoP']);
        $apellido_m = htmlentities($_POST['apellidoM']);
        $genero = htmlentities($_POST['genero']);
        $area = htmlentities($_POST['area']);
        $email = htmlentities($_POST['correo']);
        if ($source == 'alta') {
            if (addTutor($clave_prof, $apellido_p, $apellido_m, $genero, $area, $email)) {
                echo 'Tutor agregado correctamente';
            } else {
                echo 'Error: No se pudo crear al tutor';
            }
        } elseif ($source == 'modificacion') {
            if (updateTutor($clave_prof, $apellido_p, $apellido_m, $genero, $area, $email)) {
                echo 'Tutor modificado correctamente';
            } else {
                echo 'Error: No se pudo modificar al tutor';
            }
        }
    } else {
        if ($source == 'busqueda') {
            if (findTutor($clave_prof)) {
                $result = rellenarBusqueda($clave_prof);
                echo $result;
Пример #2
0
		return $affectRows;
	}
}

class Tutor
{
	
	function create($ID,$name, $gender,$phone,$email,$class,$year,$major,$password,$verified)
	{
		$insertedRows = TutorData::create($ID,$name, $gender,$phone,$email,$class,$year,$major,$password,$verified);
		$success = ($insertedRows == 1) ? true : false;
		return $success;
	}
}*/
if ($_GET['f'] == 'add' && $_GET['name'] && $_GET['gender'] && $_GET['phone'] && $_GET['email'] && $_GET['class'] && $_GET['year'] && $_GET['major'] && $_GET['password']) {
    addTutor($_GET['name'], $_GET['gender'], $_GET['phone'], $_GET['email'], $_GET['class'], $_GET['year'], $_GET['major'], $_GET['password']);
} else {
    if ($_GET['f'] == 'get' && $_GET['email']) {
        getTutor($_GET['email']);
    } elseif ($_GET['f'] == 'get' && $_GET['tid']) {
        getTutorInfo($_GET['tid']);
    } else {
        if ($_GET['f'] == 'update' && $_GET['name'] && $_GET['gender'] && $_GET['phone'] && $_GET['email'] && $_GET['class'] && $_GET['year'] && $_GET['major'] && $_GET['password'] && $_GET['tid']) {
            updateTutor($_GET['name'], $_GET['gender'], $_GET['phone'], $_GET['email'], $_GET['class'], $_GET['year'], $_GET['major'], $_GET['password'], $_GET['tid']);
        } else {
            if ($_GET['f'] == 'list' && $_GET['email']) {
                listTutorsByEmail($_GET['email']);
            } else {
                if ($_GET['f'] == 'list' && $_GET['name']) {
                    listTutorByName($_GET['name']);
                } else {