Question

PHP, HTML, CSS I have to make a website for a health club. Or a spa. Or some other kind of business where you have a mem...

PHP, HTML, CSS

I have to make a website for a health club. Or a spa. Or some other kind of business where you have a membership and keep track of transactions for those customers.

First I need to create a page where the customer is signed up for a membership. The fields should include:

First name
Last name
Street Address
City
State
Zip Code
Email
Phone Number

I should create a table that has all of that data as well as a unique ID.

Then I have to make a page that allows you to search for the member and check them in to the club. I should create a page where they check in . This would be another table that stores the unique ID from the user table and the date/time.

Then I have to create a page that allows employees to search for users and bring up their customer data including every time they have visited the club. (Two more pages!) This should be arranged on the page in a way that is easily understandable.

I have to clean up any input I receive from the users.  

Thanks,

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PHP CODE:

<?php
spl_autoload_register(function ($class) {
include './'.$class.'.php';
});
class User extends Model {
public static $TABLE_NAME='users';
   public static $HIDDEN = ['password'];
public static $INPUT_RULE = [
       'id' => ['type'=>'INTEGER'],
       'name' => ['require', 'type' => 'NAME_HUN', 'length' => [5, 50]],
       'country' => ['type' => 'NAME_HUN', 'length' => [5, 50]],
       'email' => ['require', 'type' => 'EMAIL', 'length' => [5, 50], 'isUnique' => false],
       'password' => ['require', 'type' => 'ALPHA_NUM', 'length' => [6,64]],   //ALPHA_NUM LOWER_UPPER_NUM
// --- not used options ---
//'status' => ['type' => 'INTEGER', 'insert' => 1],
       //'rank' => ['type' => 'INTEGER', 'insert' => 1],
        //'created' => ['type' => 'MYSQL_DATE', 'insert' => '$date$'],
        //'updated' => ['type' => 'MYSQL_DATE', 'insert' => '$date$', 'update' => '$date$'],
    ];
public static $USER_STATUS = ['Guest', 'Active', 'Banned', 'Deleted'];
   public static $ACTION_RULE = [
       'add' => [
'password2' => ['match' => 'password'],
'email' => ['isUnique' => true]
],
'settings' => [
'password' => [
'empty' => true,
'type' => 'ALPHA_NUM',
'length' => [6,64]
],
'password_new1' => [
'type' => 'ALPHA_NUM',
'length' => [6,64]
],
'password_new2' => ['match' => 'password_new1'],
]
    ];
public static $ROLE_REQ = [
'settings' => 1,
'get_my_data' => 1,
'admin_edit' => 3,
'delete_user' => 3
];
   public static $AUTO_FILL = [
       'add' => [
           'status' => 1,
           'rank' => 1,
       ]
    ];
   protected function add($user_data=null){
       $login_data = [
           'email' => $user_data['email'],
           'password' => $user_data['password'],
       ];
$user_data['ip'] = $_SERVER['SERVER_ADDR'];
       $user_data['password'] = $this->createPassword($user_data['password']);
unset($user_data['password2']);
       if($this->save($user_data)) {
           $this->login($login_data);
       } else {
           return static::refuseData('Regisztráció sikertelen!');
       }
   }
protected function index($index=0) {
$perPage = 2000; // at moment not have any point to make it with pagination
$cond = static::$auth['role'] > 2;
$users = static::getPage($index, $amount, 1);
$addon = ['page' => $index]; //additional data if once i make pagination
return $this->sendResponse([$users, $addon], 'build');
}
protected function view($id=0) {
$role = static::$auth['role'];
$cond = $role > 100 ? 1 : 'status = 1';
if ($result = static::readRecords(sprintf('`id` = %u AND %s', $id, $cond), true)) {
return $this->sendResponse([$result, $role], 'build');
} else {
return static::refuseData('Felhasználó nem található!', 'redirect');
}
}
protected function save_status() {
$id = static::$auth['userId'];
if ($id > 0) {
static::$LOG = false;
$sql = sprintf("SELECT count(id) as count FROM `messages` WHERE visibility IN (0,1) AND target_id = %u AND status = 0", $id);
$msgCounter = static::execQuery($sql)[0];
$this->save([ 'id' => $id, 'last_action' => time()]);
return $this->sendResponse($msgCounter, null);
}
}
protected function get_my_data() {
if (static::$auth['role'] === 0) {
return static::refuseData('Your user data not exist!');
}
$user = static::getById(static::$auth['userId']);
if (empty($user)) { return static::refuseData('Invalid user id or deleted user!'); }
unset($user['password']);
unset($user['id']);
unset($user['rank']);
return $this->sendResponse($user, 'get');
}
protected function edit($data) {
extract($data, EXTR_PREFIX_SAME, "wddx");
static::$HIDDEN = [];
$user = static::getById(static::$auth['userId']);
if (empty($user)) { return static::refuseData('Your user data not exist!'); }
$newData = [
'id' => static::$auth['userId'],
'name' => $name,
'city' => $city,
'phone' => $phone,
'email' => $email,
'address' => $address
];
if (!empty($password)) {
       if ($this->createPassword($password) !== $user['password']) {
           return static::refuseData('Wrong current password!');
       }
if (empty($password_new1)) {
return static::refuseData('Invalid new password!');
}
$newData['password'] = $this->createPassword($password_new1);
}
if ($this->save($newData)) {
$user = &$_SESSION[$_SESSION['token']];
$user = array_merge($user, $newData);
return $this->sendResponse($newData, 'update');
}
return static::refuseData('Something went wrong, we cannot save your data!');
}
protected function login($user_data){
       extract($user_data, EXTR_PREFIX_SAME, "wddx");
       $result = static::readRecords(sprintf("email='%s' AND password='%s'", $email, $this->createPassword($password)), true, false);
       if (!$result){
           return static::refuseData('Email and password pair not exist in database!');
       }
if ($result['status'] != 1){
$status = static::$USER_STATUS[$result['status']] ?? 'Unknown';
return static::refuseData("Sorry but your account status is $status !");
}
       $hash = md5(uniqid().time()).md5(rand(0,10000).'_'.uniqid());
       static::$auth = [
           'hash' => $hash,
           'role' => $result['rank'],
           'name' => $result['name'],
'userId' => $result['id'],
       ];
       $_SESSION[$hash] = $result;
       $_SESSION['token'] = $hash;
$this->save([
'id' => $result['id'],
'login' => $result['login']+1,
'updated' => date("Y-m-d H:i:s")
]);
       $this->sendResponse(['/home'], 'render.redirect', ['Sikeres bejelentkezés!', 'success']);
   }
   protected function logout($data=null){
       if (isset($_SESSION['token'])) {
           unset($_SESSION[$_SESSION['token']]);
       }
       static::$auth = [
           'hash' => '',
           'role' => 0,
'userId' => 0,
           'name' => 'Guest',
       ];
       $this->sendResponse(['/home'], 'render.redirect', 'Sikeres Kijelentkezés!');
   }
protected function createPassword($pw) {
return md5($pw);
}
protected function admin_edit($data) {
extract($data, EXTR_PREFIX_SAME, "wddx");
$user = static::getById($id);
if (empty($user)) { return static::refuseData('User data not exist!'); }
$newData = [
'id' => $id,
'status' => $status,
'rank' => $rank,
'email' => $email,
];
if ($this->save($newData)) {
return $this->sendResponse($newData, null);
}
return static::refuseData('Something went wrong, we cannot save the user data!');
}
protected function delete_user($data) {
if (empty($data['id'])) { return static::refuseData('User id missing!'); }
$id = intval($data['id']);
$user = static::getById($id);
if (empty($user)) { return static::refuseData('User data not exist!'); }
if (static::deleteById($id)) {
return $this->sendResponse(['id' => $id], null);
}
return static::refuseData('Something went wrong, we cannot delete this user data!');
}
}
$user = new User();
?>

HTML CODE:

<!DOCTYPE html>
<html>
   <head>
       <title> Győzelem Gyülekezet </title>
       <meta charset="UTF-8">
       <meta name="description" content="Ez a Győzelem Gyülekezet honlapja. Kivánjuk, hogy áldásos legyen az itt léted!">
       <meta name="keywords" content="Győzelem Gyülekezet,Jézus,Biblia,Nagyvárad">
       <meta name="author" content="Varga Zsolt">
       <meta name="viewport" content="width=device-width, initial-scale=1.0">
       <link rel="stylesheet" href="/css/index.css" type="text/css"/>
       <link rel="canonical" href="http://gyozelem.ro/home" />
   </head>
   <body>

       <div class="grid" id="App">

           <div class="header-line">
               <div class="burger">
                   <input type="checkbox" id="burgerCheckbox" />
                   <span class="burger-line"></span>
                   <span class="burger-line"></span>
                   <span class="burger-line"></span>
                   <span class="burger-line"></span>
                   <span id="burger_menu">
                       <nav><!--burger-menu--></nav>
                       <span class="log-related">
                           <span class="log-in logged_only"><!--burger-logged--></span>
                           <span class="logout guest_only"><!--burger-login--></span>
                       </span>
                   </span>
               </div>
           </div>

           <header>
               <div class="shadow"></div>
               <div class="log-menu">
                   <div class="logged logged_only"><!--page-logged-->
                   </div>
                   <div class="guest guest_only"><!--page-login-->
                   </div>
               </div>
               <picture>
                   <div class="igevers"
                       data-mobil="...életét adta váltságul..."
                       data-tablet="&#8216;&#8216;...a mi betegségeinket viselte, és a mi fájdalmainkat hordozta...&#8217;&#8217;&#10; &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;(Ézs 53:4)"
                       data-desktop="&#8216;&#8216; Mert a keresztről való beszéd bolondság ugyan azoknak, a kik elvesznek; de nekünk, kik megtartatunk, Istennek ereje.&#8217;&#8217;&#10; &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; (1Kor 1:18)"
                       data-desktop-hd="&#8216;&#8216; De hála Istennek, aki a diadalmat adja nekünk a mi Urunk Jézus Krisztus által!&#8217;&#8217;&#10; &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; (1Kor 15:57)">
                   </div>
               </picture>
           </header>

           <nav>
               <div class="menu"><!--page-menu-->
               </div>
           </nav>

           <div class="content page">
               <img src="/img/static/logo.png" class="page_logo">
               <div class="loader middle">
                   <div class="spinner"></div>
               </div>
           </div>

           <footer>
               &copy; 2017 by Varga Zsolt
           </footer>
       </div>
   <link rel="stylesheet" href="/css/delayed.css" type="text/css" />
   <script src="/js/App.js" type="text/javascript"></script>
   </body>
</html>

Add a comment
Know the answer?
Add Answer to:
PHP, HTML, CSS I have to make a website for a health club. Or a spa. Or some other kind of business where you have a mem...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName...

    This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName ContactName Address City PostalCode Search O ASC DESC List All Records Insert Record Country List City CustomerName ContactName Address City PostalCode Country List City Find by IID Find Insert 1 <! DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http:L 3-<head> 4 Kmeta http-equiv-"Content-Type" content-"text/html; charset-utf-8" />...

  • Could you create a website based on html and css? Details in the below: Note: You...

    Could you create a website based on html and css? Details in the below: Note: You can put link that I can download that folder Based on Project 2-1, do the necessary changes to have a webpage structure of a header, main, and footer sections. Then: •Set the width of the page to 700px •Use the font family starting with Verdana •Move one of the images from your Project 2-1 to the header. •Set the width of the header image...

  • I have to make a pixel art maker using javascript. HTML and CSS were already provided....

    I have to make a pixel art maker using javascript. HTML and CSS were already provided. I only had to do the JavaScript part. Every time I run the HTML folder nothing happens when I choose the width, height, and color. This is my code: (ONLY JS IS SUPPOSED TO BE FIXED). JS: // Select color input // Select size input const colorPicker = document.getElementsById('colorPicker'); const rowNum = document.getElementsById('inputHeight'); const cellNum = document.getElementById('inputWidth'); const pixelCanvas = document.getElementById('pixelCanvas'); const form =...

  • given below are the project description and their Html and css files i need javascript according to the project and other files!

    HTML------------------------------------------------------CSS---------------------------------------------------WEB230 - JavaScript 1 Assignment 7 - FormsSome of these tasks would be better done in HTML or CSS but do them in JavaScript to practice whatwe have learned.1. Select the form element and save it in a variable. From here we can access all of the form fields.2. When the page loads do the following:add the password value "monkey"select the favourite city "New York"clear the textarea3. Add an event handler to the "name" field to change the background color...

  • You need to implement a web application that is split in three parts, namely, Webpage, PHP and My...

    You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...

  • Please i need help with with this php files, the css does not have to look...

    Please i need help with with this php files, the css does not have to look like in the screen shot in the button. Create a file named paint.class.php and within it define a class named Paint, which has the following private properties: imgName title artist year gender paintID Define a static member variable named id, which will be used to set each instance’s paintID value and then be incremented, all inside the class constructor. Create a constructor that takes...

  • I NEED SOME HELP WITH THIS PLEASE :) 1. Create a data entry form on one...

    I NEED SOME HELP WITH THIS PLEASE :) 1. Create a data entry form on one of your web pages for visitors who want to be added to your mailing list. Include one of each of the following input elements*: Text <input type="text".... • Tel <input type="tel".... . Email <input type="email"... Date <input type="date"... . A set of radio buttons <input type="radio"... • A set of check boxes <input type="checkbox"... • A select element with options <select>.....</select> (do NOT add...

  • In this assignment you will combine HTML, PHP, and SQL in order to create a web...

    In this assignment you will combine HTML, PHP, and SQL in order to create a web form that allows a manager to add films to the sakila database. You will also create a method to allow the manager to view a list of all films along with their related information, and a list of actors in the movies. Task 1 Create an initial HTML page titled manager.html with 2 buttons. The first button will be labeled “View Films”, and the...

  • the is my HTML and CSS code. I didn't attach the image or the CSS file...

    the is my HTML and CSS code. I didn't attach the image or the CSS file because of the space limit. two things I wanted to incorporate on this page are to make "MY TOP 3 MUSIC GENRES" blink using javascript and to make the video links autoplay using javascript both should be using javascript requirement: our professor told us not to use <div> or alert. thank you for your help <!DOCTYPE html> <!-- I used w3school for the formatting...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT