├── 10
├── calculator1.php
├── calculator2.php
├── menus.php
├── sticky1.php
└── sticky2.php
├── 11
├── add_quote.php
├── list_dir.php
├── login.php
├── register.php
├── script_11_02
│ └── add_quote.php
├── upload_file.php
├── users.txt
└── view_quote.php
├── 12
├── add_entry.php
├── create_table.php
├── delete_entry.php
├── edit_entry.php
├── mysqli_connect.php
├── script_12_02
│ └── mysqli_connect.php
├── script_12_05
│ └── add_entry.php
└── view_entries.php
├── 13
├── htdocs
│ ├── add_quote.php
│ ├── css
│ │ └── style.css
│ ├── delete_quote.php
│ ├── edit_quote.php
│ ├── includes
│ │ └── functions.php
│ ├── index.php
│ ├── login.php
│ ├── logout.php
│ ├── templates
│ │ ├── footer.html
│ │ └── header.html
│ └── view_quotes.php
└── mysqli_connect.php
├── 01
├── hello1.php
├── hello2.php
├── hello3.php
├── phpinfo.php
└── welcome.html
├── 02
├── predefined.php
├── quotes.php
├── script_02_02.php
└── variables.php
├── 03
├── feedback.html
├── handle_form.php
├── hello.html
├── hello.php
├── script_03_02
│ └── feedback.html
├── script_03_04
│ └── handle_form.php
└── script_03_05
│ └── handle_form.php
├── 04
├── calculator.html
├── handle_calc.php
├── random.php
├── script_04_03
│ └── handle_calc.php
├── script_04_04
│ └── handle_calc.php
└── script_04_05
│ └── handle_calc.php
├── 05
├── handle_post.php
├── posting.html
├── script_05_03
│ └── handle_post.php
├── script_05_04
│ └── handle_post.php
├── script_05_05
│ └── handle_post.php
├── script_05_06
│ └── handle_post.php
├── script_05_07
│ └── handle_post.php
└── thanks.php
├── 06
├── handle_reg.php
├── register.html
├── register.php
├── script_06_03
│ └── handle_reg.php
├── script_06_04
│ └── handle_reg.php
├── script_06_05
│ └── handle_reg.php
├── script_06_06
│ └── handle_reg.php
├── script_06_07
│ └── handle_reg.php
└── script_06_08
│ └── handle_reg.php
├── 07
├── books.php
├── event.html
├── event.php
├── list.html
├── list.php
├── sort.php
├── soups1.php
├── soups2.php
└── soups3.php
├── 08
├── books.php
├── css
│ ├── concise.min.css
│ └── masthead.css
├── index.php
├── login.php
├── register.php
├── script_08_10
│ └── register.php
├── script_08_13
│ └── login.php
├── template.html
├── templates
│ ├── footer.html
│ ├── header.html
│ ├── script_08_06
│ │ └── header.html
│ ├── script_08_07
│ │ └── footer.html
│ ├── script_08_11
│ │ └── header.html
│ └── script_08_12
│ │ └── footer.html
└── welcome.php
├── 09
├── customize.php
├── login.php
├── logout.php
├── reset.php
├── script_09_03
│ └── customize.php
├── script_09_05.txt
├── view_settings.php
└── welcome.php
├── README.md
└── license.txt
/01/hello1.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello, World!
6 |
7 |
8 | The following was created by PHP:
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/01/hello2.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello, World!
6 |
11 |
12 |
13 | The following was created by PHP:
14 | Hello, world!";
16 | ?>
17 |
18 |
19 |
--------------------------------------------------------------------------------
/01/hello3.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello, World!
6 |
11 |
12 |
13 | The following was created by PHP:
14 | Hello, world!";
22 |
23 | ?>
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/01/phpinfo.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/01/welcome.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Welcome to this Page!
6 |
7 |
8 | This is a basic HTML page!
9 |
10 | Even with some decoration, it's still not very exciting.
11 |
12 |
--------------------------------------------------------------------------------
/02/predefined.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Predefined Variables
6 |
7 |
8 |
9 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/02/quotes.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Quotes
6 |
7 |
8 | Double Quotes
20 | name1 is $name1
21 | name2 is $name2
";
22 |
23 | print 'Single Quotes
24 | name1 is $name1
25 | name2 is $name2
';
26 |
27 | ?>
28 |
29 |
--------------------------------------------------------------------------------
/02/script_02_02.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Variables and Comments
6 |
7 |
8 |
19 |
20 |
--------------------------------------------------------------------------------
/02/variables.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Variables
6 |
7 |
8 | The address is: $street $city $state $zip";
18 |
19 | ?>
20 |
21 |
--------------------------------------------------------------------------------
/03/feedback.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Feedback Form
6 |
7 |
8 |
9 | Please complete this form to submit your feedback:
10 |
11 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/03/handle_form.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Your Feedback
6 |
7 |
8 | Thank you, $title $name, for your comments.
21 | You stated that you found this example to be '$response' and added: $comments
";
22 |
23 | ?>
24 |
25 |
--------------------------------------------------------------------------------
/03/hello.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Greetings!
6 |
7 |
8 |
9 | Click a link to say hello:
10 |
11 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/03/hello.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Greetings!
6 |
11 |
12 |
13 | Hello, $name !";
23 |
24 | ?>
25 |
26 |
--------------------------------------------------------------------------------
/03/script_03_02/feedback.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Feedback Form
6 |
7 |
8 |
9 |
32 |
33 |
--------------------------------------------------------------------------------
/03/script_03_04/handle_form.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Your Feedback
6 |
7 |
8 | Thank you, $title $name, for your comments.
23 | You stated that you found this example to be '$response' and added: $comments
";
24 |
25 | ?>
26 |
27 |
--------------------------------------------------------------------------------
/03/script_03_05/handle_form.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Your Feedback
6 |
7 |
8 | Thank you, $title $name, for your comments.
24 | You stated that you found this example to be '$response' and added: $comments
";
25 |
26 | ?>
27 |
28 |
--------------------------------------------------------------------------------
/04/calculator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Product Cost Calculator
6 |
7 |
8 |
33 |
34 |
--------------------------------------------------------------------------------
/04/handle_calc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Product Cost Calculator
6 |
9 |
10 |
11 | You have selected to purchase:
42 | $quantity widget(s) at
43 | $$price price each plus a
44 | $$shipping shipping cost and a
45 | $tax percent tax rate.
46 | After your $$discount discount, the total cost is
47 | $$total .
48 | Divided over $payments monthly payments, that would be $$monthly each.";
49 |
50 | ?>
51 |
52 |
--------------------------------------------------------------------------------
/04/random.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Lucky Numbers
6 |
7 |
8 | Your lucky numbers are:
20 | $n1
21 | $n2
22 | $n3";
23 |
24 | ?>
25 |
26 |
--------------------------------------------------------------------------------
/04/script_04_03/handle_calc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Product Cost Calculator
6 |
9 |
10 |
11 | You have selected to purchase:
46 | $quantity widget(s) at
47 | $$price price each plus a
48 | $$shipping shipping cost and a
49 | $tax percent tax rate.
50 | After your $$discount discount, the total cost is
51 | $$total .
52 | Divided over $payments monthly payments, that would be $$monthly each.";
53 |
54 | ?>
55 |
56 |
--------------------------------------------------------------------------------
/04/script_04_04/handle_calc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Product Cost Calculator
6 |
9 |
10 |
11 | You have selected to purchase:
43 | $quantity widget(s) at
44 | $$price price each plus a
45 | $$shipping shipping cost and a
46 | $tax percent tax rate.
47 | After your $$discount discount, the total cost is
48 | $$total .
49 | Divided over $payments monthly payments, that would be $$monthly each.";
50 |
51 | ?>
52 |
53 |
--------------------------------------------------------------------------------
/04/script_04_05/handle_calc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Product Cost Calculator
6 |
9 |
10 |
11 | You have selected to purchase:
44 | $quantity widget(s) at
45 | $$price price each plus a
46 | $$shipping shipping cost and a
47 | $tax percent tax rate.
48 | After your $$discount discount, the total cost is
49 | $$total .
50 | Divided over $payments monthly payments, that would be $$monthly each.";
51 |
52 | ?>
53 |
54 |
--------------------------------------------------------------------------------
/05/handle_post.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Forum Posting
6 |
7 |
8 | Thank you, $name, for your posting:
24 | $posting
";
25 |
26 | ?>
27 |
28 |
--------------------------------------------------------------------------------
/05/posting.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Forum Posting
6 |
7 |
8 |
9 |
25 |
26 |
--------------------------------------------------------------------------------
/05/script_05_03/handle_post.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Forum Posting
6 |
7 |
8 | Thank you, $name, for your posting:
24 | $posting
";
25 |
26 | ?>
27 |
28 |
--------------------------------------------------------------------------------
/05/script_05_04/handle_post.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Forum Posting
6 |
7 |
8 | Thank you, $name, for your posting:
28 | Original: $posting
29 | Entity: $html_post
30 | Stripped: $strip_post
";
31 |
32 | ?>
33 |
34 |
--------------------------------------------------------------------------------
/05/script_05_05/handle_post.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Forum Posting
6 |
7 |
8 | Thank you, $name, for your posting:
24 | $posting
";
25 |
26 | // Make a link to another page:
27 | $name = urlencode($name);
28 | $email = urlencode($_POST['email']);
29 | print "Click here to continue.
";
30 |
31 | ?>
32 |
33 |
--------------------------------------------------------------------------------
/05/script_05_06/handle_post.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Forum Posting
6 |
7 |
8 | Thank you, $name, for your posting:
30 | $posting...
31 | ($words words)
";
32 |
33 | ?>
34 |
35 |
--------------------------------------------------------------------------------
/05/script_05_07/handle_post.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Forum Posting
6 |
7 |
8 | Thank you, $name, for your posting:
31 | $posting
32 | ($words words)
";
33 |
34 | ?>
35 |
36 |
--------------------------------------------------------------------------------
/05/thanks.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Thanks!
6 |
7 |
8 | Thank you, $name. We will contact you at $email.";
21 |
22 | ?>
23 |
24 |
--------------------------------------------------------------------------------
/06/handle_reg.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration
6 |
7 |
8 | Registration Results
9 | You have been successfully registered (but not really).';
21 | }
22 | ?>
23 |
24 |
--------------------------------------------------------------------------------
/06/register.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration Form
6 |
7 |
8 |
9 |
37 |
38 |
--------------------------------------------------------------------------------
/06/register.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration Form
6 |
7 |
8 |
9 |
61 |
62 |
--------------------------------------------------------------------------------
/06/script_06_03/handle_reg.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration
6 |
9 |
10 |
11 | Registration Results
12 | Please enter your email address.';
24 | $okay = false;
25 | }
26 |
27 | // Validate the password:
28 | if (empty($_POST['password'])) {
29 | print 'Please enter your password.
';
30 | $okay = false;
31 | }
32 |
33 | // If there were no errors, print a success message:
34 | if ($okay) {
35 | print 'You have been successfully registered (but not really).
';
36 | }
37 | ?>
38 |
39 |
--------------------------------------------------------------------------------
/06/script_06_04/handle_reg.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration
6 |
9 |
10 |
11 | Registration Results
12 | Please enter your email address.';
24 | $okay = false;
25 | }
26 |
27 | // Validate the password:
28 | if (empty($_POST['password'])) {
29 | print 'Please enter your password.
';
30 | $okay = false;
31 | }
32 |
33 | // Validate the birth year:
34 | if (is_numeric($_POST['year'])) {
35 | $age = 2016 - $_POST['year']; // Calculate age this year.
36 | } else {
37 | print 'Please enter the year you were born as four digits.
';
38 | $okay = false;
39 | }
40 |
41 | // If there were no errors, print a success message:
42 | if ($okay) {
43 | print 'You have been successfully registered (but not really).
';
44 | print "You will turn $age this year.
";
45 | }
46 | ?>
47 |
48 |
--------------------------------------------------------------------------------
/06/script_06_05/handle_reg.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration
6 |
9 |
10 |
11 | Registration Results
12 | Please enter your email address.';
24 | $okay = false;
25 | }
26 |
27 | // Validate the password:
28 | if (empty($_POST['password'])) {
29 | print 'Please enter your password.
';
30 | $okay = false;
31 | }
32 |
33 | // Check the two passwords for equality:
34 | if ($_POST['password'] != $_POST['confirm']) {
35 | print 'Your confirmed password does not match the original password.
';
36 | $okay = false;
37 | }
38 |
39 | // Validate the birth year:
40 | if (is_numeric($_POST['year'])) {
41 | $age = 2016 - $_POST['year']; // Calculate age this year.
42 | } else {
43 | print 'Please enter the year you were born as four digits.
';
44 | $okay = false;
45 | }
46 |
47 | // Check that they were born before this year:
48 | if ($_POST['year'] >= 2016) {
49 | print 'Either you entered your birth year wrong or you come from the future!
';
50 | $okay = false;
51 | }
52 |
53 | // If there were no errors, print a success message:
54 | if ($okay) {
55 | print 'You have been successfully registered (but not really).
';
56 | print "You will turn $age this year.
";
57 | }
58 |
59 | ?>
60 |
61 |
--------------------------------------------------------------------------------
/06/script_06_06/handle_reg.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Registration
7 |
10 |
11 |
12 | Registration Results
13 | Please enter your email address.';
25 | $okay = false;
26 | }
27 |
28 | // Validate the password:
29 | if (empty($_POST['password'])) {
30 | print 'Please enter your password.
';
31 | $okay = false;
32 | }
33 |
34 | // Check the two passwords for equality:
35 | if ($_POST['password'] != $_POST['confirm']) {
36 | print 'Your confirmed password does not match the original password.
';
37 | $okay = false;
38 | }
39 |
40 | // Validate the year:
41 | if ( is_numeric($_POST['year']) AND (strlen($_POST['year']) == 4) ) {
42 |
43 | // Check that they were born before 2016.
44 | if ($_POST['year'] < 2016) {
45 | $age = 2016 - $_POST['year']; // Calculate age this year.
46 | } else {
47 | print 'Either you entered your birth year wrong or you come from the future!
';
48 | $okay = false;
49 | } // End of 2nd conditional.
50 |
51 | } else { // Else for 1st conditional.
52 |
53 | print 'Please enter the year you were born as four digits.
';
54 | $okay = false;
55 |
56 | } // End of 1st conditional.
57 |
58 | // Validate the terms:
59 | if ( !isset($_POST['terms'])) {
60 | print 'You must accept the terms.
';
61 | $okay = false;
62 | }
63 |
64 | // If there were no errors, print a success message:
65 | if ($okay) {
66 | print 'You have been successfully registered (but not really).
';
67 | print "You will turn $age this year.
";
68 | }
69 | ?>
70 |
71 |
--------------------------------------------------------------------------------
/06/script_06_07/handle_reg.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration
6 |
9 |
10 |
11 | Registration Results
12 | Please enter your email address.';
24 | $okay = false;
25 | }
26 |
27 | // Validate the password:
28 | if (empty($_POST['password'])) {
29 | print 'Please enter your password.
';
30 | $okay = false;
31 | }
32 |
33 | // Check the two passwords for equality:
34 | if ($_POST['password'] != $_POST['confirm']) {
35 | print 'Your confirmed password does not match the original password.
';
36 | $okay = false;
37 | }
38 |
39 | // Validate the year:
40 | if ( is_numeric($_POST['year']) AND (strlen($_POST['year']) == 4) ) {
41 |
42 | // Check that they were born before 2016.
43 | if ($_POST['year'] < 2016) {
44 | $age = 2016 - $_POST['year']; // Calculate age this year.
45 | } else {
46 | print 'Either you entered your birth year wrong or you come from the future!
';
47 | $okay = false;
48 | } // End of 2nd conditional.
49 |
50 | } else { // Else for 1st conditional.
51 |
52 | print 'Please enter the year you were born as four digits.
';
53 | $okay = false;
54 |
55 | } // End of 1st conditional.
56 |
57 | // Validate the terms:
58 | if ( !isset($_POST['terms'])) {
59 | print 'You must accept the terms.
';
60 | $okay = false;
61 | }
62 |
63 | // Validate the color:
64 | if ($_POST['color'] == 'red') {
65 | $color_type = 'primary';
66 | } elseif ($_POST['color'] == 'yellow') {
67 | $color_type = 'primary';
68 | } elseif ($_POST['color'] == 'green') {
69 | $color_type = 'secondary';
70 | } elseif ($_POST['color'] == 'blue') {
71 | $color_type = 'primary';
72 | } else { // Problem!
73 | print 'Please select your favorite color.
';
74 | $okay = false;
75 | }
76 |
77 | // If there were no errors, print a success message:
78 | if ($okay) {
79 | print 'You have been successfully registered (but not really).
';
80 | print "You will turn $age this year.
";
81 | print "Your favorite color is a $color_type color.
";
82 | }
83 | ?>
84 |
85 |
--------------------------------------------------------------------------------
/06/script_06_08/handle_reg.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Registration
6 |
9 |
10 |
11 | Registration Results
12 | Please enter your email address.';
24 | $okay = false;
25 | }
26 |
27 | // Validate the password:
28 | if (empty($_POST['password'])) {
29 | print 'Please enter your password.
';
30 | $okay = false;
31 | }
32 |
33 | // Check the two passwords for equality:
34 | if ($_POST['password'] != $_POST['confirm']) {
35 | print 'Your confirmed password does not match the original password.
';
36 | $okay = false;
37 | }
38 |
39 | // Validate the year:
40 | if ( is_numeric($_POST['year']) AND (strlen($_POST['year']) == 4) ) {
41 |
42 | // Check that they were born before 2016.
43 | if ($_POST['year'] < 2016) {
44 | $age = 2016 - $_POST['year']; // Calculate age this year.
45 | } else {
46 | print 'Either you entered your birth year wrong or you come from the future!
';
47 | $okay = false;
48 | } // End of 2nd conditional.
49 |
50 | } else { // Else for 1st conditional.
51 |
52 | print 'Please enter the year you were born as four digits.
';
53 | $okay = false;
54 |
55 | } // End of 1st conditional.
56 |
57 | // Validate the terms:
58 | if ( !isset($_POST['terms'])) {
59 | print 'You must accept the terms.
';
60 | $okay = false;
61 | }
62 |
63 | // Validate the color:
64 | switch ($_POST['color']) {
65 | case 'red':
66 | $color_type = 'primary';
67 | break;
68 | case 'yellow':
69 | $color_type = 'primary';
70 | break;
71 | case 'green':
72 | $color_type = 'secondary';
73 | break;
74 | case 'blue':
75 | $color_type = 'primary';
76 | break;
77 | default:
78 | print 'Please select your favorite color.
';
79 | $okay = false;
80 | break;
81 | } // End of switch.
82 |
83 | // If there were no errors, print a success message:
84 | if ($okay) {
85 | print 'You have been successfully registered (but not really).
';
86 | print "You will turn $age this year.
";
87 | print "Your favorite color is a $color_type color.
";
88 | }
89 | ?>
90 |
91 |
--------------------------------------------------------------------------------
/07/books.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Larry Ullman's Books and Chapters
6 |
7 |
8 | Some of Larry Ullman's Books
9 | 'Getting Started with PHP', 'Variables', 'HTML Forms and PHP', 'Using Numbers'];
15 |
16 | // Create the second array:
17 | $phpadv = [1 => 'Advanced PHP Techniques', 'Developing Web Applications', 'Advanced Database Concepts', 'Basic Object-Oriented Programming'];
18 |
19 | // Create the third array:
20 | $phpmysql = [1 => 'Introduction to PHP', 'Programming with PHP', 'Creating Dynamic Web Sites', 'Introduction to MySQL'];
21 |
22 | // Create the multidimensional array:
23 | $books = [
24 | 'PHP VQS' => $phpvqs,
25 | 'PHP Advanced VQP' => $phpadv,
26 | 'PHP and MySQL VQP' => $phpmysql
27 | ];
28 |
29 | // Print out some values:
30 | print "The third chapter of my first book is {$books['PHP VQS'][3]} .
";
31 | print "The first chapter of my second book is {$books['PHP Advanced VQP'][1]} .
";
32 | print "The fourth chapter of my fourth book is {$books['PHP and MySQL VQP'][4]} .
";
33 |
34 | // See what happens with foreach:
35 | foreach ($books as $key => $value) {
36 | print "$key: $value
\n";
37 | }
38 |
39 | ?>
40 |
41 |
--------------------------------------------------------------------------------
/07/event.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Add an Event
6 |
7 |
8 |
9 |
27 |
28 |
--------------------------------------------------------------------------------
/07/event.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Add an Event
6 |
7 |
8 | You want to add an event called {$_POST['name']} which takes place on: ";
15 |
16 | // Print each weekday:
17 | if (isset($_POST['days']) AND is_array($_POST['days'])) {
18 |
19 | foreach ($_POST['days'] as $day) {
20 | print "$day \n";
21 | }
22 |
23 | } else {
24 | print 'Please select at least one weekday for this event!';
25 | }
26 |
27 | // Complete the paragraph:
28 | print '';
29 | ?>
30 |
31 |
--------------------------------------------------------------------------------
/07/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | I Must Sort This Out!
6 |
7 |
8 |
9 |
18 |
19 |
--------------------------------------------------------------------------------
/07/list.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | I Have This Sorted Out
6 |
7 |
8 | ', $words_array);
22 |
23 | // Print the results:
24 | print "An alphabetized version of your list is: $string_words
";
25 |
26 | ?>
27 |
28 |
--------------------------------------------------------------------------------
/07/sort.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My Little Gradebook
6 |
7 |
8 | 95,
16 | 'Sherwood' => 82,
17 | 'Toni' => 98,
18 | 'Franz' => 87,
19 | 'Melissa' => 75,
20 | 'Roddy' => 85
21 | ];
22 |
23 | // Print the original array:
24 | print 'Originally the array looks like this: ';
25 | foreach ($grades as $student => $grade) {
26 | print "$student: $grade \n";
27 | }
28 | print '
';
29 |
30 | // Sort by value in reverse order, then print again:
31 | arsort($grades);
32 | print 'After sorting the array by value using arsort(), the array looks like this: ';
33 | foreach ($grades as $student => $grade) {
34 | print "$student: $grade \n";
35 | }
36 | print '
';
37 |
38 | // Sort by key, then print again:
39 | ksort($grades);
40 | print 'After sorting the array by key using ksort(), the array looks like this: ';
41 | foreach ($grades as $student => $grade) {
42 | print "$student: $grade \n";
43 | }
44 | print '
';
45 |
46 | ?>
47 |
48 |
--------------------------------------------------------------------------------
/07/soups1.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | No Soup for You!
6 |
7 |
8 | Mmm...soups
9 | 'Clam Chowder',
16 | 'Tuesday' => 'White Chicken Chili',
17 | 'Wednesday' => 'Vegetarian'
18 | ];
19 |
20 | // Try to print the array:
21 | print "$soups
";
22 |
23 | // Print the contents of the array:
24 | print_r($soups);
25 |
26 | ?>
27 |
28 |
--------------------------------------------------------------------------------
/07/soups2.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | No Soup for You!
6 |
7 |
8 | Mmm...soups
9 | 'Clam Chowder',
16 | 'Tuesday' => 'White Chicken Chili',
17 | 'Wednesday' => 'Vegetarian'
18 | ];
19 |
20 | // Count and print the current number of elements:
21 | $count1 = count($soups);
22 | print "The soups array originally had $count1 elements.
";
23 |
24 | // Add three items to the array:
25 | $soups['Thursday'] = 'Chicken Noodle';
26 | $soups['Friday'] = 'Tomato';
27 | $soups['Saturday'] = 'Cream of Broccoli';
28 |
29 | // Count and print the number of elements again:
30 | $count2 = count($soups);
31 | print "After adding 3 more soups, the array now has $count2 elements.
";
32 |
33 | // Print the contents of the array:
34 | print_r($soups);
35 |
36 | ?>
37 |
38 |
--------------------------------------------------------------------------------
/07/soups3.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | No Soup for You!
6 |
7 |
8 | Mmm...soups
9 | 'Clam Chowder',
17 | 'Tuesday' => 'White Chicken Chili',
18 | 'Wednesday' => 'Vegetarian',
19 | 'Thursday' => 'Chicken Noodle',
20 | 'Friday' => 'Tomato',
21 | 'Saturday' => 'Cream of Broccoli'
22 | ];
23 |
24 | // Print each key and value:
25 | foreach ($soups as $day => $soup) {
26 | print "$day: $soup
\n";
27 | }
28 |
29 | ?>
30 |
31 |
--------------------------------------------------------------------------------
/08/books.php:
--------------------------------------------------------------------------------
1 |
10 |
11 | J.D. Salinger's Books
12 |
13 | The Catcher in the Rye
14 | Nine Stories
15 | Franny and Zooey
16 | Raise High the Roof Beam, Carpenters and Seymour: An Introduction
17 |
18 |
19 |
--------------------------------------------------------------------------------
/08/css/concise.min.css:
--------------------------------------------------------------------------------
1 | :root{-ms-overflow-style:-ms-autohiding-scrollbar;overflow-y:scroll;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%}audio:not([controls]){display:none}details{display:block}input[type="number"]{width:auto}input[type="search"]{-webkit-appearance:textfield}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}main,summary{display:block}pre{overflow:auto}progress{display:inline-block}textarea{overflow:auto}template,[hidden]{display:none}[unselectable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:root{box-sizing:border-box;color:#555;cursor:default;font-family:"Helvetica","Arial",sans-serif;font-size:14px;line-height:1.5;text-rendering:optimizeLegibility;vertical-align:top}@media(min-width:30em){:root{font-size:16px}}:root .nonresponsive{font-size:16px}*,::after,::before{box-sizing:inherit;color:inherit;font-family:inherit;font-size:inherit;line-height:inherit;text-decoration:inherit;vertical-align:inherit}*{cursor:inherit;margin:0;padding:0}body{background-color:white}a,button,input[type="submit"],input,select,textarea{cursor:initial}*[dir="rl;"]{direction:rtl;unicode-bidi:embed}bdo[dir="ltr"],bdo[dir="rtl"]{unicode-bidi:bidi-override}bdo[dir="ltr"]{direction:ltr}bdo[dir="rtl"]{direction:rtl}hr{border:0;border-top:1px solid #e0e0e0;display:block;height:1px;margin:20px 0}figure{margin:24px 1em}figcaption{color:#666;font-style:italic;text-align:center}::-moz-selection{background-color:#d6d6d6}::selection{background-color:#d6d6d6}::-moz-selection{background-color:#d6d6d6}blockquote{border-left:1px solid #e0e0e0;color:#666;margin-bottom:20px;padding:0 1em}blockquote cite,blockquote footer{display:block;font-size:80%;font-style:italic;margin-top:10px}blockquote cite:before,blockquote footer:before{content:"\2014 \00A0"}.blockquote--reverse{border-left:none;border-right:1px solid #e0e0e0;text-align:right}button,input[type="submit"],.button{background-color:#4591aa;border:0;color:white;cursor:pointer;display:inline-block;line-height:48px;overflow:visible;padding:0 2.5em;text-align:center;text-decoration:none;-webkit-transition:150ms;transition:150ms;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;white-space:nowrap}button:hover,input[type="submit"]:hover,button:focus,input[type="submit"]:focus,.button:hover,.button:focus{background-color:#75b3c7;color:inherit;text-decoration:none}button:focus,input[type="submit"]:focus,button:active,input[type="submit"]:active,.button:focus,.button:active{outline:0}button:active,input[type="submit"]:active,.button:active{background-color:#63a8bf}button[disabled],input[disabled][type="submit"],.button[disabled]{background-color:gainsboro;color:white;cursor:not-allowed}.button--muted{background-color:#aaa}.button--muted:hover,.button--muted:focus{background-color:#d0d0d0}.button--muted:active{background-color:#c4c4c4}.button--primary{background-color:#4591aa}.button--primary:hover,.button--primary:focus{background-color:#75b3c7}.button--primary:active{background-color:#63a8bf}.button--success{background-color:#45ca69}.button--success:hover,.button--success:focus{background-color:#81db99}.button--success:active{background-color:#6dd589}.button--warning{background-color:#ffb800}.button--warning:hover,.button--warning:focus{background-color:#ffcd4d}.button--warning:active{background-color:#ffc633}.button--error{background-color:#ca4829}.button--error:hover,.button--error:focus{background-color:#df7961}.button--error:active{background-color:#db674b}.button--xsm{font-size:.75em;line-height:32px;padding:0 1.5em}.button--sm{font-size:.875em;line-height:40px;padding:0 2em}.button--lg{font-size:1.125em;line-height:56px;padding:0 3em}.button--xlg{font-size:1.125em;line-height:64px;padding:0 3.5em}.button--full{width:100%}.button--pill{border-radius:25px}.button--flat{background-color:transparent;color:#555}.button--flat:hover{background-color:rgba(0,0,0,0.1);color:#555}.button--flat[disabled]{background-color:transparent;color:#666}.button--collapse{width:100%}@media(min-width:30em){.button--collapse{width:auto}}@media(min-width:30em){form,form [row]{margin-bottom:24px}}.nonresponsive form,.nonresponsive form [row]{margin-bottom:24px}input:not([type="submit"]),select,textarea{border:1px solid #e0e0e0;border-radius:3px;font-size:.875em;height:32px;padding:0 .75em;-webkit-transition:150ms;transition:150ms;width:100%}input:not([type="submit"]):focus,select:focus,textarea:focus{border-color:#74cbe8;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px rgba(69,145,170,0.5);outline:0}input:not([type="submit"])[disabled],select[disabled],textarea[disabled]{background-color:#f5f5f5;cursor:not-allowed}input:not([type="submit"]){line-height:normal;min-height:24px}input:not([type="submit"])[type="checkbox"]:focus,input:not([type="submit"])[type="radio"]:focus,input:not([type="submit"])[type="range"]:focus,input:not([type="submit"])[type="file"]:focus,input:not([type="submit"])[type="color"]:focus,input:not([type="submit"])[type="submit"]:focus{border-color:transparent;box-shadow:none;outline:0}label{display:block;font-size:.875em}fieldset{border:1px solid #e0e0e0;border-radius:3px;padding:24px 1em;margin-bottom:24px}legend{font-size:.875em;font-weight:bold;padding:0 1em}input[type="checkbox"],input[type="file"],input[type="image"],input[type="radio"]{height:auto;width:auto}input[type="checkbox"],input[type="radio"]{line-height:normal;padding:0;vertical-align:middle}input[type="checkbox"]+label,input[type="radio"]+label{display:inline-block;margin:0 0 0 .5em;line-height:30px;vertical-align:middle}input[type="file"]{border:0;line-height:100%;padding:0}textarea{height:auto;padding:8px 1em;resize:vertical}select{background-color:transparent;border-radius:5px;padding:0}select[disabled]{color:#666}select[multiple]{height:auto}select::-ms-expand{display:none}select::-ms-value{color:currentColor}select option{padding:0 .75em}input[type="range"]{border:0;padding:0;width:100%;-webkit-appearance:none}input[type="range"]:focus{outline:0}input[type="range"]::-webkit-slider-runnable-track{background-color:gainsboro;border:0;border-radius:3px;height:5px}input[type="range"]::-webkit-slider-thumb{border:0;border-radius:50%;background-color:#4591aa;height:16px;margin-top:-5px;width:16px;-webkit-appearance:none}input[type="range"]::-moz-range-track{background-color:gainsboro;border:0;border-radius:3px;height:5px}input[type="range"]::-moz-range-thumb{border:0;border-radius:50%;background-color:#4591aa;height:16px;margin-top:-5px;width:16px}input[type="range"]::-ms-track{background-color:gainsboro;border:0;border-radius:3px;color:transparent;height:5px}input[type="range"]::-ms-thumb{border:0;border-radius:50%;background-color:#4591aa;height:16px;margin-top:-5px;width:16px}.input--help{color:#666;display:block;font-size:.75em;font-weight:bold;margin-top:8px}.form--inline input,.form--inline select,.form--inline textarea{margin-bottom:20px}@media(min-width:30em){.form--inline input,.form--inline select,.form--inline textarea{display:inline-block;margin-bottom:0;vertical-align:middle;width:auto}.form--inline label{display:inline;margin-right:.5em;vertical-align:middle}.form--inline input+label{margin-left:1em}}.nonresponsive .form--inline input,.nonresponsive .form--inline select,.nonresponsive .form--inline textarea{display:inline-block;margin-bottom:0;vertical-align:middle;width:auto}.nonresponsive .form--inline label{display:inline;margin-right:.5em;vertical-align:middle}.nonresponsive .form--inline input+label{margin-left:1em}.input--small{font-size:.75em;height:24px}.input--large{height:48px;font-size:1em}.input--flat{background-color:transparent;border-color:transparent;box-shadow:none}.input--flat:focus{border-color:#74cbe8}.input--success{background-color:rgba(69,202,105,0.15);border-color:#45ca69}.input--success:focus{border-color:#45ca69}.input--warning{background-color:rgba(255,184,0,0.15);border-color:#ffb800}.input--warning:focus{border-color:#ffb800}.input--error{background-color:rgba(202,72,41,0.15);border-color:#ca4829}.input--error:focus{border-color:#ca4829}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6,.giga,.mega,.kilo{color:#222;font-family:"Helvetica","Arial",sans-serif;line-height:1.25em}h1 small,h1 .small,h2 small,h2 .small,h3 small,h3 .small,h4 small,h4 .small,h5 small,h5 .small,h6 small,h6 .small,.h1 small,.h1 .small,.h2 small,.h2 .small,.h3 small,.h3 .small,.h4 small,.h4 .small,.h5 small,.h5 .small,.h6 small,.h6 .small,.giga small,.giga .small,.mega small,.mega .small,.kilo small,.kilo .small{color:#666;font-weight:lighter;vertical-align:0}h1,h2,h3,.h1,.h2,.h3,.giga,.mega,.kilo{margin:20px 0 10px}h1 small,h1 .small,h2 small,h2 .small,h3 small,h3 .small,.h1 small,.h1 .small,.h2 small,.h2 .small,.h3 small,.h3 .small,.giga small,.giga .small,.mega small,.mega .small,.kilo small,.kilo .small{font-size:65%}h4,h5,h6,.h4,.h5,.h6{margin:10px 0}h4 small,h4 .small,h5 small,h5 .small,h6 small,h6 .small,.h4 small,.h4 .small,.h5 small,.h5 .small,.h6 small,.h6 .small{font-size:75%}h1,.h1{font-size:2.25em}@media(min-width:48em){h1,.h1{font-size:3em}}h2,.h2{font-size:1.6875em}@media(min-width:48em){h2,.h2{font-size:2.25em}}h3,.h3{font-size:1.3125em}@media(min-width:48em){h3,.h3{font-size:1.75em}}h4,.h4{font-size:1.125em}h5,.h5{font-size:1em}h6,.h6{font-size:.875em}.giga{font-size:3.75em}@media(min-width:48em){.giga{font-size:5em}}.mega{font-size:3em}@media(min-width:48em){.mega{font-size:4em}}.kilo{font-size:2.4375em}@media(min-width:48em){.kilo{font-size:3.25em}}.nonresponsive h1,.nonresponsive .h1{font-size:3em}.nonresponsive h2,.nonresponsive .h2{font-size:2.25em}.nonresponsive h3,.nonresponsive .h3{font-size:1.75em}.nonresponsive .giga{font-size:5em}.nonresponsive .mega{font-size:4em}.nonresponsive .kilo{font-size:3.25em}ul,ol{padding-left:1.5em;margin-bottom:10px}ul ul,ul ol,ol ul,ol ol{margin-bottom:0}ul ul{list-style-type:square}ul ol{list-style-type:lower-roman}ol ol{list-style-type:lower-roman}ol ul{list-style-type:square}.list--unstyled{list-style:none;padding-left:0}.list--unstyled li{padding-left:0}.list--inline{padding-left:0}.list--inline li{display:inline;list-style:none;padding-left:1.5em}.list--inline li:first-child{padding-left:0}dl{margin-bottom:24px}dt{font-weight:bold}dt,dd{margin-bottom:10px}@media(min-width:60em){.dl--horizontal dt{clear:left;float:left;overflow:hidden;text-align:right;text-overflow:ellipsis;white-space:nowrap;width:150px}.dl--horizontal dd{margin-left:165px}.dl--horizontal dd:before,.dl--horizontal dd:after{content:"";display:table}.dl--horizontal dd:after{clear:both}}.nonresponsive .dl--horizontal dt{clear:left;float:left;overflow:hidden;text-align:right;text-overflow:ellipsis;white-space:nowrap;width:150px}.nonresponsive .dl--horizontal dd{margin-left:165px}.nonresponsive .dl--horizontal dd:before,.nonresponsive .dl--horizontal dd:after{content:"";display:table}.nonresponsive .dl--horizontal dd:after{clear:both}@media print{@page{margin:.5cm}*,*:before,*:after{background:transparent!important;color:black!important;-webkit-filter:none!important;filter:none!important;text-shadow:none!important}:root{background-color:white;color:black;font:11pt/1.3 "Georgia","Times New Roman","Times",serif}img{max-width:100%!important;page-break-after:avoid;page-break-inside:avoid}.show--print{display:block;visibility:visible}.hide--print,video,audio,object,embed,nav,footer,a[href^="#"]:after{display:none;visibility:hidden}p,h2,h3,.h2,.h3{orphans:3;widows:3}h2,h3,.h2,.h3{page-break-after:avoid}a,a:visited{color:black;font-size:.57em;text-decoration:underline;word-wrap:break-word}a[href]:after,a:visited[href]:after{content:" (" attr(href) ")";font-size:smaller}q:after{content:" (Source: " attr(cite) ")"}abbr[title]:after{content:" (" attr(title) ")"}a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,code{background-color:none;border:1px solid #e0e0e0;page-break-inside:avoid}blockquote{border:0;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}ol{padding-left:1.25em}ul{padding-left:0;list-style:none}ul ul,ul ul ul{padding-left:1.5em}ul li,ol li{content:"» "}}@media print and (min-width:30em){table{page-break-inside:avoid;width:100%!important}table th,table td{line-height:40px!important}}@media print{.badge,.badge:before,.badge *:after,.label,.label:before,.label *:after,.spinner,.spinner:before,.spinner *:after,.tooltip,.tooltip:before,.tooltip *:after,[data-hint],[data-hint]:before,[data-hint] *:after,.progress,.progress:before,.progress *:after,.breadcrumbs,.breadcrumbs:before,.breadcrumbs *:after,.modal,.modal:before,.modal *:after,.alert,.alert:before,.alert *:after{display:none;visibility:hidden}}table{border:1px solid #e0e0e0;border-collapse:collapse;border-spacing:0;empty-cells:show;margin-bottom:24px;width:100%}table caption{color:#555;font-size:85%;font-style:italic;line-height:48px;text-align:center}table thead{background-color:#f5f5f5;text-align:left}table tfoot{background-color:#fbfbfb;border-top:1px solid #e0e0e0}table th,table td{border-right:1px solid #e0e0e0;line-height:24px;overflow:visible;padding:8px 1em}@media(min-width:30em){table th,table td{line-height:48px}}table th:last-child,table td:last-child{border-right:0}table tr,table td{-webkit-transition:background-color 150ms;transition:background-color 150ms}@media(min-width:30em){table{width:auto}table th,table td{padding:0 2.5em}}.nonresponsive{width:auto}.nonresponsive th,.nonresponsive td{padding:0 2.5em}.nonresponsive th,.nonresponsive td{line-height:48px}.table--responsive{overflow:auto;width:100%}.table--responsive::-webkit-scrollbar{height:14px;width:14px;-webkit-appearance:none}.table--responsive::-webkit-scrollbar-thumb{background-color:rgba(50,50,50,0.2);border:3px solid white;border-radius:8px}.table--responsive table{margin-bottom:0}.table--full{width:100%}.table--border{border:1px solid #e0e0e0}.table--border thead,.table--border td{border-bottom:1px solid #e0e0e0}.table--borderOuter{border:1px solid #e0e0e0}.table--borderOuter th,.table--borderOuter td{border-right:0}.table--borderHorizontal thead,.table--borderHorizontal td{border-bottom:1px solid #e0e0e0}.table--borderHorizontal th,.table--borderHorizontal td{border-right:0}.table--flat{border:0}.table--flat td{border-bottom:0}.table--flat th,.table--flat td{border-right:0}.table--fillEven tbody tr:nth-child(even){background-color:#f5f5f5}.table--fillOdd tbody tr:nth-child(odd){background-color:#f5f5f5}.table--hoverRow tbody tr:hover{background-color:#f5f5f5}.table--hoverCell tbody td:hover{background-color:#f5f5f5}i,em,.italic{font-style:italic}b,strong,.bold{font-weight:bold}small,.small{font-size:75%;vertical-align:text-bottom}sup,sub{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}s{text-decoration:line-through}p:not(:last-child){margin-bottom:20px}a{background-color:transparent;color:#4591aa;cursor:pointer;text-decoration:none;-webkit-transition:150ms;transition:150ms}a:hover,a:focus{color:#2f6374}h1 a,h2 a,h3 a,.h1 a,.h2 a,.h3 a{color:#555}h1 a:hover,h1 a:focus,h2 a:hover,h2 a:focus,h3 a:hover,h3 a:focus,.h1 a:hover,.h1 a:focus,.h2 a:hover,.h2 a:focus,.h3 a:hover,.h3 a:focus{color:#4591aa;text-decoration:none}abbr[title]{border-bottom:1px dotted #e0e0e0;cursor:help}code,pre,kbd,samp{font-family:"Consolas",monospace;font-size:.875em}pre{padding:16px 1.5em}code{vertical-align:middle;white-space:nowrap}code,pre{background-color:#f5f5f5;border:1px solid #e0e0e0;border-radius:3px;color:#484848;margin-bottom:24px}code{padding:2px 3px}pre code{background-color:transparent;border:0;padding:0;vertical-align:inherit;white-space:pre}.pre--flat{background-color:transparent;border:0;border-radius:none;padding:0}kbd{background-color:transparent;border:1px solid #e0e0e0;border-radius:3px;box-shadow:0 2px 0 -1px white,0 2px 0 gainsboro;display:inline-block;line-height:1.75;margin:-3px 2px 0;padding:2px 6px 0;white-space:nowrap}samp{vertical-align:bottom}address{font-style:normal}[container]{box-sizing:border-box;margin:0 auto;max-width:1200px;padding-left:15px;padding-right:15px;width:100%}[row]{margin-left:-15px;margin-right:-15px;margin-bottom:0}[row]:before,[row]:after{content:"";display:table}[row]:after{clear:both}[column]{box-sizing:border-box;float:left;margin-bottom:0;width:100%;padding-left:15px;padding-right:15px}@media(min-width:48em){[column~="1"]{width:8.33333%}[column~="2"]{width:16.66667%}[column~="3"]{width:25%}[column~="4"]{width:33.33333%}[column~="5"]{width:41.66667%}[column~="6"]{width:50%}[column~="7"]{width:58.33333%}[column~="8"]{width:66.66667%}[column~="9"]{width:75%}[column~="10"]{width:83.33333%}[column~="11"]{width:91.66667%}[column~="12"]{width:100%}[column~="+1"]{margin-left:8.33333%}[column~="+2"]{margin-left:16.66667%}[column~="+3"]{margin-left:25%}[column~="+4"]{margin-left:33.33333%}[column~="+5"]{margin-left:41.66667%}[column~="+6"]{margin-left:50%}[column~="+7"]{margin-left:58.33333%}[column~="+8"]{margin-left:66.66667%}[column~="+9"]{margin-left:75%}[column~="+10"]{margin-left:83.33333%}[column~="+11"]{margin-left:91.66667%}}.nonresponsive [column~="1"]{width:8.33333%}.nonresponsive [column~="2"]{width:16.66667%}.nonresponsive [column~="3"]{width:25%}.nonresponsive [column~="4"]{width:33.33333%}.nonresponsive [column~="5"]{width:41.66667%}.nonresponsive [column~="6"]{width:50%}.nonresponsive [column~="7"]{width:58.33333%}.nonresponsive [column~="8"]{width:66.66667%}.nonresponsive [column~="9"]{width:75%}.nonresponsive [column~="10"]{width:83.33333%}.nonresponsive [column~="11"]{width:91.66667%}.nonresponsive [column~="12"]{width:100%}.nonresponsive [column~="+1"]{margin-left:8.33333%}.nonresponsive [column~="+2"]{margin-left:16.66667%}.nonresponsive [column~="+3"]{margin-left:25%}.nonresponsive [column~="+4"]{margin-left:33.33333%}.nonresponsive [column~="+5"]{margin-left:41.66667%}.nonresponsive [column~="+6"]{margin-left:50%}.nonresponsive [column~="+7"]{margin-left:58.33333%}.nonresponsive [column~="+8"]{margin-left:66.66667%}.nonresponsive [column~="+9"]{margin-left:75%}.nonresponsive [column~="+10"]{margin-left:83.33333%}.nonresponsive [column~="+11"]{margin-left:91.66667%}.text--muted{color:#aaa!important}.bg--muted{background-color:#aaa!important}.text--primary{color:#4591aa!important}.bg--primary{background-color:#4591aa!important}.text--success{color:#45ca69!important}.bg--success{background-color:#45ca69!important}.text--warning{color:#ffb800!important}.bg--warning{background-color:#ffb800!important}.text--error{color:#ca4829!important}.bg--error{background-color:#ca4829!important}.show--xsm,.hide--sm,.hide--md,.hide--lg,.hide--xlg,.hide--print,.hide--hd{display:block;visibility:visible}.hide--xsm,.show--sm,.show--md,.show--lg,.show--xlg,.show--print,.show--hd{display:none;visibility:hidden}@media(min-width:48em){.show--sm,.hide--xsm,.hide--md,.hide--lg,.hide--xlg{display:block;visibility:visible}.hide--sm,.show--xsm,.show--md,.show--lg,.show--xlg{display:none;visibility:hidden}}@media(min-width:60em){.show--md,.hide--sm,.hide--xsm,.hide--lg,.hide--xlg{display:block;visibility:visible}.hide--md,.show--sm,.show--xsm,.show--lg,.show--xlg{display:none;visibility:hidden}}@media(min-width:70em){.show--lg,.hide--xsm,.hide--sm,.hide--md,.hide--xlg{display:block;visibility:visible}.hide--lg,.show--xsm,.show--sm,.show--md,.show--xlg{display:none;visibility:hidden}}@media(min-width:80em){.show--xlg,.hide--xsm,.hide--sm,.hide--md,.hide--lg{display:block;visibility:visible}.hide--xlg,.show--xsm,.show--sm,.show--md,.show--lg{display:none;visibility:hidden}}@media only screen and (-moz-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3 / 2),only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){.show--hd{display:block;visibility:visible}.hide--hd{display:none;visibility:hidden}}.text--left{text-align:left}.text--center{text-align:center}.text--right{text-align:right}.text--justify{text-align:justify}.float--none{float:none}.float--right{float:right}.float--left{float:left}.clearfix:before,.clearfix:after{content:"";display:table}.clearfix:after{clear:both}.center--all{left:50%;position:absolute;text-align:center;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.media--fluid{max-width:100%;height:auto}.screenreader{border:0 none;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.screenreader:active,.screenreader:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.alert{background-color:#f5f5f5;border:1px solid #e0e0e0;border-radius:3px;color:inherit;font-size:.875em;margin:20px 0;padding:8px 1em;position:relative}.alert a{color:#222}.alert a:hover{text-decoration:underline}.alert-close{color:inherit;float:right;opacity:.5;-webkit-transition:opacity 150ms;transition:opacity 150ms}.alert-close:hover{opacity:1}.alert-close:hover,.alert-close:focus{text-decoration:none}a.alert-close:hover{text-decoration:none}.alert--muted{background-color:rgba(170,170,170,0.15);border-color:rgba(170,170,170,0.2);color:#919191}.alert--muted a{color:#777}.alert--primary{background-color:rgba(69,145,170,0.15);border-color:rgba(69,145,170,0.2);color:#367286}.alert--primary a{color:#285361}.alert--success{background-color:rgba(69,202,105,0.15);border-color:rgba(69,202,105,0.2);color:#31ab52}.alert--success a{color:#25843f}.alert--warning{background-color:rgba(255,184,0,0.15);border-color:rgba(255,184,0,0.2);color:#cc9300}.alert--warning a{color:#996e00}.alert--error{background-color:rgba(202,72,41,0.15);border-color:rgba(202,72,41,0.2);color:#a03920}.alert--error a{color:#752a18}.badge{background-color:#4591aa;border-radius:25px;color:white;display:inline-block;font-size:.75em;line-height:24px;padding:0 .75em}.breadcrumbs{background-color:#f5f5f5;border:1px solid #e0e0e0;border-radius:3px;font-size:.75em;margin-bottom:24px;padding:8px .5em}.breadcrumbs li{display:inline;list-style:none;padding-left:.75em}.breadcrumbs li:after{color:#c7c7c7;content:"\002f";padding-left:.75em}.breadcrumbs li:last-child:after{content:"";padding-left:0}.breadcrumbs li.is-active,.breadcrumbs li.is-active a{color:#4d4d4d}.breadcrumbs--flat{background-color:transparent;border:0;border-radius:0;padding:0}.button--bordered{background-color:transparent;border:1px solid #4591aa;color:#4591aa}.button--bordered:hover,.button--bordered:focus{background-color:#4591aa;color:white}.border--muted{border-color:#aaa;color:#aaa}.border--muted:hover,.border--muted:focus{background-color:#aaa;color:white}.border--muted:active{background-color:#c4c4c4}.border--primary{border-color:#4591aa;color:#4591aa}.border--primary:hover,.border--primary:focus{background-color:#4591aa;color:white}.border--primary:active{background-color:#63a8bf}.border--success{border-color:#45ca69;color:#45ca69}.border--success:hover,.border--success:focus{background-color:#45ca69;color:white}.border--success:active{background-color:#6dd589}.border--warning{border-color:#ffb800;color:#ffb800}.border--warning:hover,.border--warning:focus{background-color:#ffb800;color:white}.border--warning:active{background-color:#ffc633}.border--error{border-color:#ca4829;color:#ca4829}.border--error:hover,.border--error:focus{background-color:#ca4829;color:white}.border--error:active{background-color:#db674b}.button--prefix{padding-left:0}.button--prefix .prefix{background-image:-webkit-linear-gradient(top,rgba(0,0,0,0.15),rgba(0,0,0,0.15));background-image:linear-gradient(to bottom,rgba(0,0,0,0.15),rgba(0,0,0,0.15));display:inline-block;margin-right:1.25em;padding:0 1em;vertical-align:0}.button--prefix.button--bordered .prefix{background-image:none;border-right:1px solid currentColor}.button--affix{padding-right:0}.button--affix .affix{background-image:-webkit-linear-gradient(top,rgba(0,0,0,0.15),rgba(0,0,0,0.15));background-image:linear-gradient(to bottom,rgba(0,0,0,0.15),rgba(0,0,0,0.15));display:inline-block;margin-left:1.25em;padding:0 1em;vertical-align:0}.button--affix.button--bordered .affix{background-image:none;border-left:1px solid currentColor}.card{background-color:white;border:1px solid #e0e0e0;margin-bottom:24px;overflow:hidden;position:relative}.card-content{padding:24px 1.5em}.card-title{display:block;margin-top:10px}.card-footer{border-top:1px solid #e0e0e0;font-size:.875em;padding:16px 1.5em}.card-image{position:relative}.card-image img{bottom:0;left:0;position:relative;right:0;top:0;width:100%}.card-image .card-title{bottom:0;color:white;left:0;padding:0 1em;position:absolute}.collection{border:1px solid #e0e0e0;border-radius:3px;list-style-type:none;margin:24px 0;padding:0}.collection-item,.collection-header{border-bottom:1px solid #e0e0e0;display:block;margin:0;padding:8px 1em}.collection-item:last-of-type,.collection-header:last-of-type{border-bottom:0}.collection-item.is-active,.collection-header.is-active{background-color:#f5f5f5}a.collection-item:hover{background-color:#f5f5f5}.collection-header{padding:0 1em}.dropdown{cursor:auto;display:inline-block;outline:0;position:relative}.dropdown:focus{pointer-events:none}.dropdown:focus .dropdown-content{opacity:1;visibility:visible}.dropdown.no-pointer-events{pointer-events:auto!important}.dropdown.no-visibility .dropdown-content{display:none;visibility:visible!important}.dropdown.no-visibility:focus .dropdown-content{display:block}.dropdown.no-opacity .dropdown-content{opacity:1!important}.dropdown-content{background-color:white;border:1px solid #e0e0e0;color:#555;left:0;margin-top:8px;opacity:0;padding:8px 1em;pointer-events:auto;position:absolute;text-align:left;-webkit-transition:all 150ms;transition:all 150ms;visibility:hidden;width:200px;z-index:1}.dropdown-content:before,.dropdown-content:after{border:solid transparent;bottom:100%;content:"";height:0;left:1.5em;pointer-events:none;position:absolute;width:0}.dropdown-content:before{border-color:rgba(255,255,255,0);border-bottom-color:#e0e0e0;border-width:7px;margin-left:-7px}.dropdown-content:after{border-color:rgba(255,255,255,0);border-bottom-color:white;border-width:6px;margin-left:-6px}.dropdown-content li{font-size:.875em;list-style-type:none;margin:0;padding:8px 1em;-webkit-transition:background-color 150ms;transition:background-color 150ms;white-space:nowrap}.dropdown-content li:hover{background-color:#f5f5f5}ul.dropdown-content,ol.dropdown-content{padding:0}.dropdown--hover:hover{pointer-events:none}.dropdown--hover:hover .dropdown-content{opacity:1;visibility:visible}.dropdown--small .dropdown-content{width:150px}.dropdown--large .dropdown-content{width:300px}.dropdown--top .dropdown-content{bottom:100%;margin-top:0;margin-bottom:8px}.dropdown--top .dropdown-content:before,.dropdown--top .dropdown-content:after{top:100%}.dropdown--top .dropdown-content:after{border-color:rgba(255,255,255,0);border-top-color:white}.dropdown--top .dropdown-content:before{border-color:rgba(255,255,255,0);border-top-color:#e0e0e0}.group{display:inline-block;margin-bottom:24px;padding:0}.group:before,.group:after{content:"";display:table}.group:after{clear:both}.group span{margin-top:0}.group-item{border:1px solid #e0e0e0;display:inline-block;float:left;font-size:.875em;line-height:32px;list-style:none;padding:0 1em;-webkit-transition:background-color 150ms;transition:background-color 150ms}.group-item:not(:first-child){margin:0 0 0 -1px}.group-item:hover{background-color:#f5f5f5}.group-item:first-child{border-radius:3px 0 0 3px}.group-item:last-child{border-radius:0 3px 3px 0}.group-item.is-active{background-color:#f5f5f5}.label{background-color:#4591aa;border-radius:3px;color:white;display:inline-block;font-size:.75em;line-height:24px;padding:0 1em}.modal{background-color:rgba(40,46,49,0.5);bottom:0;left:0;margin:0;opacity:0;overflow:scroll;pointer-events:none;position:fixed;right:0;top:0;-webkit-transition:opacity ease-in 150ms;transition:opacity ease-in 150ms;z-index:1000002}.modal:target{opacity:1;pointer-events:auto}.modal-container{box-shadow:0 1px 3px 0 rgba(0,0,0,0.1);margin:16px auto;position:relative;width:90%}@media(min-width:48em){.modal-container{width:526px}}@media(min-height:30em){.modal-container{margin:10% auto}}@media(min-height:48em){.modal-container{margin:15% auto}}.modal-header{background-color:#4591aa;color:white;padding:16px 1.5em}.modal-header h1,.modal-header h2,.modal-header h3,.modal-header h4,.modal-header h5,.modal-header h6,.modal-header .h1,.modal-header .h2,.modal-header .h3,.modal-header .h4,.modal-header .h5,.modal-header .h6,.modal-header .giga,.modal-header .mega,.modal-header .kilo{color:inherit;display:inline}.modal-body,.modal-footer{background-color:white;margin-top:0}.modal-body{padding:32px 2.5em}.modal-footer{border-top:1px solid #e0e0e0;font-size:.875em;margin:0;padding:24px 2.5em}.modal-close{color:white;float:right;margin:0;opacity:.5;-webkit-transition:opacity 150ms;transition:opacity 150ms}.modal-close:hover{opacity:1}.modal-close:hover,.modal-close:focus{text-decoration:none}.modal:target .modal-close--background{display:block;height:100%;pointer-events:all;position:absolute;width:100%}.modal:target .modal-close--background:hover{border-bottom:0;text-decoration:none}@media(min-width:48em){.modal--small .modal-container{width:360px}}@media(min-width:48em){.modal--large .modal-container{width:760px}}@media(min-width:48em){.modal--full .modal-container{width:90%}}.modal--flat .modal-header{background-color:white;color:#555;padding:1.5em 2.5em 0}.modal--flat .modal-header h1,.modal--flat .modal-header h2,.modal--flat .modal-header h3,.modal--flat .modal-header h4,.modal--flat .modal-header h5,.modal--flat .modal-header h6,.modal--flat .modal-header .h1,.modal--flat .modal-header .h2,.modal--flat .modal-header .h3,.modal--flat .modal-header .h4,.modal--flat .modal-header .h5,.modal--flat .modal-header .h6{color:inherit}.modal--flat .modal-close{color:#555;line-height:1;margin:0}.progress{background-color:#f5f5f5;border-radius:3px;box-shadow:inset 0 1px 1px rgba(224,224,224,0.25);box-sizing:initial;color:white;font-size:.6875em;height:14px;line-height:1.2;margin-bottom:24px;position:relative;text-align:center;width:100%}.progress>span{background-color:#4591aa;border-radius:3px;box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);display:block;height:100%;overflow:hidden;position:relative;width:auto}.progress--small{font-size:.5625em;height:10px;line-height:1.2}.progress--large{font-size:1em;height:25px;line-height:1.7}.progress--stacked>span{border-radius:0;display:inline-block;float:left;margin-top:0}.progress--stacked>span:first-of-type{border-radius:3px 0 0 3px}.progress--stacked>span:last-of-type{border-radius:0 3px 3px 0}.progress--striped>span:after,.progress--striped>span>span{background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(0.25,rgba(255,255,255,0.2)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.2)),color-stop(0.75,rgba(255,255,255,0.2)),color-stop(0.75,transparent),to(transparent));background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,0.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.2) 50%,rgba(255,255,255,0.2) 75%,transparent 75%,transparent);background-size:50px 50px;bottom:0;content:"";left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:1}.progress--striped.progress--animate>span:after,.progress--striped.progress--animate>span>span{-webkit-animation:move 2s linear infinite;animation:move 2s linear infinite}@keyframes move{0%{background-position:0 0}100%{background-position:50px 50px}}@-webkit-keyframes move{0%{background-position:0 0}100%{background-position:50px 50px}}.spinner{-webkit-animation:rotate .8s infinite linear;animation:rotate .8s infinite linear;border:3px solid #b5b5b5;border-radius:50%;border-right-color:transparent;height:30px;margin:24px auto;width:30px}@-webkit-keyframes rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.tooltip,[data-hint]{display:inline-block;position:relative}.tooltip:before,.tooltip:after,[data-hint]:before,[data-hint]:after{border-radius:2px;opacity:0;position:absolute;pointer-events:none;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-transition:100ms;transition:100ms;-webkit-transition-delay:0ms;transition-delay:0ms;visibility:hidden;z-index:1000000}.tooltip:before,[data-hint]:before{background-color:transparent;border:8px solid transparent;content:"";position:absolute;z-index:1000001}.tooltip:after,[data-hint]:after{background-color:#282e31;color:white;content:attr(data-hint);font-size:.75em;padding:.25em .5em;text-decoration:none;white-space:nowrap}.tooltip:hover:before,.tooltip:hover:after,.tooltip:focus:before,.tooltip:focus:after,[data-hint]:hover:before,[data-hint]:hover:after,[data-hint]:focus:before,[data-hint]:focus:after{opacity:1;visibility:visible}.tooltip:hover:before,.tooltip:hover:after,[data-hint]:hover:before,[data-hint]:hover:after{-webkit-transition-delay:100ms;transition-delay:100ms}.tooltip--top:before{border-top-color:#282e31;margin-bottom:-12px}.tooltip--top:after{margin-left:-18px}.tooltip--top:before,.tooltip--top:after{bottom:100%;left:50%}.tooltip--top:hover:after,.tooltip--top:hover:before{-webkit-transform:translateY(-8px);transform:translateY(-8px)}.tooltip--top:focus:after,.tooltip--top:focus:before{-webkit-transform:translateY(-8px);transform:translateY(-8px);-webkit-transition:150ms;transition:150ms}.tooltip--bottom:before{border-bottom-color:#282e31;margin-top:-12px}.tooltip--bottom:after{margin-left:-18px}.tooltip--bottom:before,.tooltip--bottom:after{left:50%;top:100%}.tooltip--bottom:hover:after,.tooltip--bottom:hover:before,.tooltip--bottom:focus:after,.tooltip--bottom:focus:before{-webkit-transform:translateY(8px);transform:translateY(8px)}.tooltip--right:before{border-right-color:#282e31;margin-bottom:-8px;margin-left:-12px}.tooltip--right:after{margin-bottom:-12px}.tooltip--right:before,.tooltip--right:after{bottom:50%;left:105%}.tooltip--right:hover:after,.tooltip--right:hover:before,.tooltip--right:focus:after,.tooltip--right:focus:before{-webkit-transform:translateX(8px);transform:translateX(8px)}.tooltip--left:before{border-left-color:#282e31;margin-bottom:-8px;margin-right:-12px}.tooltip--left:after{margin-bottom:-12px}.tooltip--left:before,.tooltip--left:after{bottom:50%;right:100%}.tooltip--left:hover:after,.tooltip--left:hover:before,.tooltip--left:focus:after,.tooltip--left:focus:before{-webkit-transform:translateX(-8px);transform:translateX(-8px)}.tooltip--always:before,.tooltip--always:after{opacity:1;visibility:visible}.tooltip--always .tooltip--top:before,.tooltip--always .tooltip--top:after{-webkit-transform:translateY(-8px);transform:translateY(-8px)}.tooltip--always .tooltip--right:before,.tooltip--always .tooltip--right:after{-webkit-transform:translateY(8px);transform:translateY(8px)}.tooltip--always .tooltip--bottom:before,.tooltip--always .tooltip--bottom:after{-webkit-transform:translateX(-8px);transform:translateX(-8px)}.tooltip--always .tooltip--left:before,.tooltip--always .tooltip--left:after{-webkit-transform:translateX(8px);transform:translateX(8px)}
--------------------------------------------------------------------------------
/08/css/masthead.css:
--------------------------------------------------------------------------------
1 | .btn {
2 | /*border-radius: 4px;*/
3 | /*transition: all .3s;*/
4 | }
5 |
6 | .siteHeader {
7 | border-bottom: 1px solid #eee;
8 | }
9 |
10 | .logo {
11 | font-size: 22px;
12 | margin-bottom: 0;
13 | }
14 |
15 | .nav { text-align: right; }
16 |
17 | .nav li {
18 | display: inline;
19 | line-height: 4;
20 | margin-left: 25px;
21 | }
22 | .nav li:first-of-type {
23 | margin-left: 0;
24 | }
25 |
26 | .masthead {
27 | background-color: #eee;
28 | padding: 50px 0;
29 | }
30 | @media (min-width: 48em) {
31 | .masthead {
32 | padding: 100px 0;
33 | }
34 | }
35 |
36 | .masthead-title {
37 | margin-top: 0;
38 | }
39 |
40 | .siteContent {
41 | padding: 50px 0;
42 | }
43 | .siteFooter {
44 | border-top: 1px solid #eee;
45 | font-size: .875em;
46 | padding-top: 15px;
47 | }
--------------------------------------------------------------------------------
/08/index.php:
--------------------------------------------------------------------------------
1 |
9 |
10 | Welcome to a J.D. Salinger Fan Club!
11 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
12 |
13 |
--------------------------------------------------------------------------------
/08/login.php:
--------------------------------------------------------------------------------
1 | Login Form
10 | Users who are logged in can take advantage of certain features like this, that, and the other thing.
';
11 |
12 | // Check if the form has been submitted:
13 | if ($_SERVER['REQUEST_METHOD'] == 'POST') {
14 |
15 | // Handle the form:
16 | if ( (!empty($_POST['email'])) && (!empty($_POST['password'])) ) {
17 |
18 | if ( (strtolower($_POST['email']) == 'me@example.com') && ($_POST['password'] == 'testpass') ) { // Correct!
19 |
20 | print 'You are logged in! Now you can blah, blah, blah...
';
21 |
22 | } else { // Incorrect!
23 |
24 | print 'The submitted email address and password do not match those on file! Go back and try again.
';
25 |
26 | }
27 |
28 | } else { // Forgot a field.
29 |
30 | print 'Please make sure you enter both an email address and a password! Go back and try again.
';
31 |
32 | }
33 |
34 | } else { // Display the form.
35 |
36 | print '
37 | Email Address:
38 | Password:
39 |
40 | ';
41 |
42 | }
43 |
44 | include('templates/footer.html'); // Need the footer.
45 | ?>
--------------------------------------------------------------------------------
/08/register.php:
--------------------------------------------------------------------------------
1 | Registration Form
10 | Register so that you can take advantage of certain features like this, that, and the other thing.
';
11 |
12 | // Check if the form has been submitted:
13 | if ($_SERVER['REQUEST_METHOD'] == 'POST') {
14 |
15 | $problem = false; // No problems so far.
16 |
17 | // Check for each value...
18 | if (empty($_POST['first_name'])) {
19 | $problem = true;
20 | print 'Please enter your first name!
';
21 | }
22 |
23 | if (empty($_POST['last_name'])) {
24 | $problem = true;
25 | print 'Please enter your last name!
';
26 | }
27 |
28 | if (empty($_POST['email'])) {
29 | $problem = true;
30 | print 'Please enter your email address!
';
31 | }
32 |
33 | if (empty($_POST['password1'])) {
34 | $problem = true;
35 | print 'Please enter a password!
';
36 | }
37 |
38 | if ($_POST['password1'] != $_POST['password2']) {
39 | $problem = true;
40 | print 'Your password did not match your confirmed password!
';
41 | }
42 |
43 | if (!$problem) { // If there weren't any problems...
44 |
45 | // Print a message:
46 | print 'You are now registered! Okay, you are not really registered but...
';
47 |
48 | // Clear the posted values:
49 | $_POST = [];
50 |
51 | } else { // Forgot a field.
52 |
53 | print 'Please try again!
';
54 |
55 | }
56 |
57 | } // End of handle form IF.
58 |
59 | // Create the form:
60 | ?>
61 |
62 |
63 | First Name:
64 |
65 | Last Name:
66 |
67 | Email Address:
68 |
69 | Password:
70 | Confirm Password:
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/08/script_08_10/register.php:
--------------------------------------------------------------------------------
1 | Registration Form
10 | Register so that you can take advantage of certain features like this, that, and the other thing.
';
11 |
12 | // Check if the form has been submitted:
13 | if ($_SERVER['REQUEST_METHOD'] == 'POST') {
14 |
15 | $problem = false; // No problems so far.
16 |
17 | // Check for each value...
18 | if (empty($_POST['first_name'])) {
19 | $problem = true;
20 | print 'Please enter your first name!
';
21 | }
22 |
23 | if (empty($_POST['last_name'])) {
24 | $problem = true;
25 | print 'Please enter your last name!
';
26 | }
27 |
28 | if (empty($_POST['email']) || (substr_count($_POST['email'], '@') != 1) ) {
29 | $problem = true;
30 | print 'Please enter your email address!
';
31 | }
32 |
33 | if (empty($_POST['password1'])) {
34 | $problem = true;
35 | print 'Please enter a password!
';
36 | }
37 |
38 | if ($_POST['password1'] != $_POST['password2']) {
39 | $problem = true;
40 | print 'Your password did not match your confirmed password!
';
41 | }
42 |
43 | if (!$problem) { // If there weren't any problems...
44 |
45 | // Print a message:
46 | print 'You are now registered! Okay, you are not really registered but...
';
47 |
48 | // Send the email:
49 | $body = "Thank you, {$_POST['first_name']}, for registering with the J.D. Salinger fan club!'.";
50 | mail($_POST['email'], 'Registration Confirmation', $body, 'From: admin@example.com');
51 |
52 | // Clear the posted values:
53 | $_POST = [];
54 |
55 | } else { // Forgot a field.
56 |
57 | print 'Please try again!
';
58 |
59 | }
60 |
61 | } // End of handle form IF.
62 |
63 | // Create the form:
64 | ?>
65 |
66 |
67 | First Name:
68 |
69 | Last Name:
70 |
71 | Email Address:
72 |
73 | Password:
74 | Confirm Password:
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/08/script_08_13/login.php:
--------------------------------------------------------------------------------
1 | Login Form
10 | Users who are logged in can take advantage of certain features like this, that, and the other thing.
';
11 |
12 | // Check if the form has been submitted:
13 | if ($_SERVER['REQUEST_METHOD'] == 'POST') {
14 |
15 | // Handle the form:
16 | if ( (!empty($_POST['email'])) && (!empty($_POST['password'])) ) {
17 |
18 | if ( (strtolower($_POST['email']) == 'me@example.com') && ($_POST['password'] == 'testpass') ) { // Correct!
19 |
20 | // Redirect the user to the welcome page!
21 | ob_end_clean(); // Destroy the buffer!
22 | header('Location: welcome.php');
23 | exit();
24 |
25 | } else { // Incorrect!
26 |
27 | print 'The submitted email address and password do not match those on file! Go back and try again.
';
28 |
29 | }
30 |
31 | } else { // Forgot a field.
32 |
33 | print 'Please make sure you enter both an email address and a password! Go back and try again.
';
34 |
35 | }
36 |
37 | } else { // Display the form.
38 |
39 | print '
40 | Email Address:
41 | Password:
42 |
43 | ';
44 |
45 | }
46 |
47 | include('templates/footer.html'); // Need the footer.
48 | ?>
--------------------------------------------------------------------------------
/08/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Raise High the Roof Beam!
9 |
10 |
11 |
12 |
13 |
14 |
28 |
29 |
30 |
31 | Welcome to a J.D. Salinger Fan Club
32 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
33 |
34 |
35 |
36 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/08/templates/footer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |