lec-php-05
<?php
$customer = $_GET['cust-name'];
$egg_style = $_GET['egg-style'] ?? 'scrambled';
$side = $_GET['side'] ?? 'bacon';
$drink = $_GET['drink'] ?? 'coffee';
include 'order.view.php';Given the above, write the markup that would result from going to this URL:
<body>
<h1>Your Breakfast Is Ready, <?= $customer; ?></h1>
<p>One order of eggs, <?= $egg_style ?>.</p>
<p>Side of <?= $side ?></p>
<p>And a cuppa <?= $drink ?></p>
</body>order.php
order.view.php
order.php?cust-name=Miko&side=hash+brownsAssuming we run the above blob of code, what values does $another_variable have on lines 4, 6, 8, and 12?
<?php
$some_variable = "hi";
$another_variable = $some_variable ?? "foo";
$another_variable = $yet_another_variable ?? "bar";
$another_variable = $pancakes ?? "baz";
$yet_another_variable = "bye";
$another_variable = $yet_another_variable ?? "bar";◉ Why is a cookie like a remora?
◉ What flavours of cookies are there and how do I bake them?
◉ What's a common cookie gotcha?
◉ How do cookies tie into The Project?
◉ Why does the client get all the fun? What about the server?
◉ How do I read/write delicious data to the session store?
◉ What's a common session gotcha?
◉ How do sessions tie into The Project?
This is a problem.
Get familiar with it.
🤔 See any cookies?
🤔 Notice anything in the Response Headers that's cookie-ish?
🤔 See any cookies now? What do you notice about them?
🤔 Notice anything in the Request Headers that's cookie-ish?
I think you should be summarizing like this, but I'm feeling all generous like.
1-cookies
DEMO
make-a-cookie.php
1-cookies
DEMO
mood.php
2-cookie-gotcha
DEMO
gotcha.php
From Milestone 3:
"A persistent cookie is used to store the last date and time the user logged in; this date and time should be displayed at the bottom of the Theatre List and Now Playing pages."
3-sessions
DEMO
start-a-session.php
3-sessions
DEMO
open-page.php
3-session-gotcha
DEMO
order-is-important.php
3-session-gotcha
DEMO
writing-gotcha.php
3-session-gotcha
DEMO
reading-gotcha.php
From Milestone 4:
"If a user enters the username admin and password pw into the Login Form, the login status is saved using PHP session state, and the form then redirects to the Theatre List. "