<?php require 'user.php'; if (isset($_POST["nombre"]) && isset($_POST["email"])) { if (preg_match("/[^A-Za-z'- ]/", $_POST['nombre'])) { die("Nombre invalido"); } echo "Bienvenido " . $_POST['nombre'] . "<br />"; User::create($_POST['nombre'], $_POST['email']); User::readAll(); //exit(); }
<?php header('Content-Type: application/json; charset=utf-8'); require 'vendor/autoload.php'; require 'user.php'; $app = new \Slim\Slim(); // 1. Create a route for a get method to return a user $app->get('/user/read/:id', function ($id) { echo json_encode(User::read($id), JSON_UNESCAPED_UNICODE); }); // 2. Create a route for a get method to return all users $app->get('/user/read/', function () { echo 'funciona'; echo json_encode(User::readAll(), JSON_UNESCAPED_UNICODE); }); // 3. Create a route for a post method to create a new user $app->post('/user/create/:username/:password', function ($username, $password) { echo 'funciona'; echo json_encode(User::create($username, $password), JSON_UNESCAPED_UNICODE); }); // 4. Create a route for a put method to update a user // 5. Create a route for a delete method to delete a user $app->run();
<?php require_once dirname(__FILE__) . './vendor/autoload.php'; //autoload packages chk_lgn(); $db = new Database(); $user = new User($db->conn); //echo sha1('123456'); $stmt = $user->readAll(); $num = $stmt->rowCount(); require 'templates/header.php'; ?> <div id="page-wrapper"> <div class="container-fluid"> <!-- Page Heading --> <div class="row"> <div class="col-lg-12"> <h1 class="page-header"> List Patients <small>Manage Patients</small> </h1> <ol class="breadcrumb"> <li> <i class="fa fa-dashboard"></i> <a href="index.php">Dashboard</a> </li> <li class="active"> <i class="fa fa-users"></i> List Patients </li>
<?php require_once dirname(__FILE__) . './vendor/autoload.php'; //autoload packages $db = new Database(); $user = new User($db->conn); $users = $user->readAll(); $num = $users->rowCount(); include "templates/header.php"; include "templates/menu.php"; // include "patients/patients.php"; ?> <div id="page-wrapper"> <div class="container-fluid"> <!-- Page Heading --> <div class="row"> <div class="col-lg-12"> <h1 class="page-header"> Blank Page <small>Subheading</small> </h1> <ol class="breadcrumb"> <li> <i class="fa fa-dashboard"></i> <a href="index.html">Dashboard</a> </li> <li class="active"> <i class="fa fa-file"></i> Blank Page
<?php // core configuration include_once "../config/core.php"; // check if logged in as admin include_once "login_checker.php"; // include classes include_once '../config/database.php'; include_once '../objects/user.php'; include_once "../objects/category.php"; // get database connection $database = new Database(); $db = $database->getConnection(); // initialize objects $user = new User($db); $category = new Category($db); // set page title $page_title = "Users"; // include page header HTML include_once "layout_head.php"; // read all users from the database $stmt = $user->readAll($from_record_num, $records_per_page); // count retrieved users $num = $stmt->rowCount(); // include products table HTML template include_once "read_users_template.php"; // include page footer HTML include_once "layout_foot.php";