Mushroom Risotto

Mushroom RisottoRecently I held a poll and asked what recipe would you like to see most. I was surprised that you chose Mushroom Risotto, but it was an excellent choice.

Mushroom Risotto is an amazing dish! It is extremely rich and filling.

The reason that it tastes unlike anything else is because Risotto, or Arborio rice is softer on the outside than on the inside. If you cook it properly, it will take on the flavor of the food that surrounds it.

Continue reading Mushroom Risotto

Portion Control

Hashbrown CasseroleOne of the biggest mistakes a person can make when dieting is to believe that portion control works!

What do you think about when I say portion control? Chances are you’re thinking about quantity. The problem is that if you concern yourself with the quantity you eat, you are more likely to eat a tablespoon of butter over a pound of mushrooms.

The pound of mushrooms is actually lower in calories and fat, cholesterol, sodium,…

Continue reading Portion Control

PHP Message Board Pt 5

PHP Message Board 5In part 5 of my PHP Message Board Tutorial, I show you how to create a proper login system.

This isn’t a simple system though. It is multi-layered and very secure. I specifically cover how to:

  • Secure against code injection and session hijacking
  • Change page elements based off of login status
  • Verify login status with cookies and sessions
  • Create a small compact captcha system
  • Search the database to verify identity and make changes to the data

And, a whole bunch more. All of the code follows the video like always.

This is a more advanced script and you may need help with the following topics:


Code From the Video

<?php

include(‘header.html’);

?>

<style>

#recaptcha_image img {

width: 185px;

height: 28.5px;

border: 1px solid gainsboro;

}

#recaptcha_widget {

height:400;

}

</style>

<script type=”text/javascript”>

// Changes the styling for the Captcha image

var RecaptchaOptions = {

theme : ‘custom’,

custom_theme_widget: ‘recaptcha_widget’

};

</script>

<?php

if (isset($_POST[‘submitted’])) { // Check if the form has been submitted.

// Security check for a valid username

if (preg_match (‘%^[A-Za-z0-9]\S{8,20}$%’, stripslashes(trim($_POST[‘userid’])))) {

// Scrub username with function in header.php

$u = escape_data($_POST[‘userid’]);

} else {

$u = FALSE;

echo ‘<p><font color=”red” size=”+1″>Please enter a valid User ID!</font></p>’;

}

// Security check for a valid password

if (preg_match (‘%^[A-Za-z0-9]\S{8,20}$%’, stripslashes(trim($_POST[‘pass’])))) {

// Scrub password with function in header.php

$p = escape_data($_POST[‘pass’]);

} else {

$p = FALSE;

echo ‘<p><font color=”red” size=”+1″>Please enter a valid Password!</font></p>’;

}

// PHP Code for the CAPTCHA System

$captchchk = 1;

$privatekey = “Public Key Here”;

$resp = recaptcha_check_answer ($privatekey,

$_SERVER[“REMOTE_ADDR”],

$_POST[“recaptcha_challenge_field”],

$_POST[“recaptcha_response_field”]);

if (!$resp->is_valid) {

// What happens when the CAPTCHA was entered incorrectly

echo ‘<p><font color=”red” size=”+1″>The CAPTCHA Code wasn\’t entered correctly!</font></p>’;

$captchchk = 0;

}

// Query the database. Verify the username, password and captcha

if ($u && $p && $captchchk) {

$query = “SELECT user_id, first_name, last_name, email, username, passwd, active FROM users WHERE username=’$u’ AND passwd=SHA(‘$p’)”;

$result = mysql_query ($query) or trigger_error(“Either the Userid or Password are incorrect 1”);

if (mysql_affected_rows() == 1) { // A match was made

$row = mysql_fetch_array ($result, MYSQL_NUM);

mysql_free_result($result);

// If they haven’t activated the account redirect

if ($row[6] != NULL)

{

header(“Location: http://localhost/msgbrd/mbforgotpass.php”);

mysql_close(); // Close the database connection.

exit();

}

$_SESSION[‘first_name’] = $row[1];

$_SESSION[‘userid’] = $row[4];

// Create Second Token for security

$tokenId = rand(10000, 9999999);

$query2 = “update users set tokenid = $tokenId where username = ‘$_SESSION[userid]'”;

$result2 = mysql_query ($query2);

$_SESSION[‘token_id’] = $tokenId;

// Reset session id for security

session_regenerate_id();

// Redirect the user

header(“Location: http://localhost/msgbrd/mblogin.php”);

mysql_close(); // Close the database connection.

exit();

}

} else { // No match was made.

echo ‘<br><br><p><font color=”red” size=”+1″>Either the Userid or Password are incorrect 2</font></p>’;

mysql_close(); // Close the database connection

exit();

}

} // End of SUBMIT

?>

<body>

<div id=”header”><h2>Message Board</h2></div>

<div id=”login”>

<?php

echo ‘<h1>Welcome’;

if (isset($_SESSION[‘first_name’])) {

echo “, {$_SESSION[‘first_name’]}!”;

}

echo ‘</h1>’;

// Display links based upon the login status

// If user is on the logout page disable the login

if (isset($_SESSION[‘userid’]) AND (substr($_SERVER[‘PHP_SELF’], -10) != ‘logout.php’)) {

echo ‘<a href=”logout.php”>Logout</a><br />

<a href=”change_password.php”>Change Password</a><br />’;

} else { // Not logged in.

echo ”

<form action=’mblogin.php’ method=’post’>

<p><b>Userid:</b> <input type=’text’ name=’userid’ size=’20’ maxlength=’20’ /></p>

<p><b>Password:</b> <input type=’password’ name=’pass’ size=’16’ maxlength=’30’ /></p>”;

// Captcha stuff from Google

echo ”

<div id=’recaptcha_widget’ style=’display:none’>

<div id=’recaptcha_image’></div>

<div class=’recaptcha_only_if_incorrect_sol’ style=’color:red’>Incorrect please try again</div>

<span class=’recaptcha_only_if_image’>Enter the words above:</span><br />

<span class=’recaptcha_only_if_audio’>Enter the numbers you hear:</span>

<input type=’text’ id=’recaptcha_response_field’ name=’recaptcha_response_field’ />

<div><a href=’javascript:Recaptcha.reload()’>Get another CAPTCHA</a></div>

<div class=’recaptcha_only_if_image’><a href=’javascript:Recaptcha.switch_type(\’audio\’)’>Get an audio CAPTCHA</a></div>

<div class=’recaptcha_only_if_audio’><a href=’javascript:Recaptcha.switch_type(\’image\’)’>Get an image CAPTCHA</a></div>

<div><a href=’javascript:Recaptcha.showhelp()’>Help</a></div>

</div>

<script type=’text/javascript’

src=’http://www.google.com/recaptcha/api/challenge?k=Public Key Here’>

</script>

<noscript>

<iframe src=’http://www.google.com/recaptcha/api/noscript?k=Public Key Here’

height=’300′ width=’500′ frameborder=’0′></iframe><br>

<textarea name=’recaptcha_challenge_field’ rows=’3′ cols=’40’>

</textarea>

<input type=’hidden’ name=’recaptcha_response_field’

value=’manual_challenge’>

</noscript>

“;

echo “<div align=’left’><input type=’submit’ name=’submit’ value=’Login’ /></div>

<input type=’hidden’ name=’submitted’ value=’TRUE’ />

</form>”;

echo ‘<a href=”register.php”>Register</a><br />

<a href=”forgot_password.php”>Forgot Password</a><br />’;

}

?>

</div>

</body>

</html>

Best Sandwich Recipe

Veggie DietWhen I set out to create the perfect diet over a year ago I knew I needed to create an awesome sandwich!

Everybody loves sandwiches. I consider this sandwich to be one of the main reasons I lost 80 pounds in 5 months.

It tastes awesome. It is extremely filling. And, it measures in at just 200 calories. That means that since I’m 6’3″ I could eat over 6 of these a day and still finish below my required 1400 calorie max.

Continue reading Best Sandwich Recipe

PHP Message Board Pt 3

PHP Message Board 3In the last part of this tutorial PHP Message Board Part 2 I set up the database access file, some security stuff and a user registration page. In this part of my message board tutorial I finish off the user registration page.

In this tutorial I’ll show you how to do the following:

  • Using Regular Expressions to Secure your Website
  • How to Perform Form Validation
  • Implement a Captcha System
  • Issue MySQL Common Queries
  • Generate Random Numbers
  • How to Generate a Email Verification System

Continue reading PHP Message Board Pt 3

PHP Message Board Pt 2

PHP Message BoardA few articles ago I started creating a PHP Message Board, but then I got side tracked. Here is the original video PHP Message Board. You must watch it before you watch this one.

In this video tutorial I’ll start explaining how to create a new user registration system for the message board. You can also use this as a review of all I taught on PHP, MySQL, CSS, HTML, JavaScript and JQuery. If you click on those links you can see all of my tutorials on those subjects as well.

Continue reading PHP Message Board Pt 2

All My Video Tutorials

YouTube LogoWell hello Internet! I have done 260 Video Tutorials on YouTube over the last year. This video will allow you access to all of them in one place.

I started off trying to provide job training, but along the way it has gone in numerous directions based off of your tutorial requests.

Not only do I have numerous videos on programming and web programming, but I’ve also spent a lot of time on:

Continue reading All My Video Tutorials

JQuery Video Tutorial Pt 8

JQuery lightboxIn this part of the JQuery Video Tutorial I show you how to create all kinds of cool things using the JQuery UI and plugins.

I’ll show you how to create a really nice JQuery Lightbox using fancybox. It has all the bells and whistles you want.

I’ll then show you how to create a tab interface that is: draggable, resizeable, sortable, and more.

Continue reading JQuery Video Tutorial Pt 8

JQuery Video Tutorial Pt 7

Learn AjaxIn this part of the JQuery Video Tutorial I will show you how to retrieve information from your server dynamically. It is amazingly easy to implement AJAX concepts using JQuery.

By the end of this tutorial you’ll be able to retrieve plain text and XML. You’ll also be able to access PHP code that can access databases, or any other type of information on your server. And, yes this works dynamically!

Continue reading JQuery Video Tutorial Pt 7

Career Help

Guidance CounselorJohn sent me an email asking for career help. He was specifically looking for a test that would tell him which job was best suited for him.

A while back I actually went to local school guidance counselors and got some nice career tests. I actually created an online version that you can see here Career Help Test.

In this video tutorial I present the best test I found. After the test you’ll find a brief description on the different career types and the best careers for each.

Continue reading Career Help

JQuery Video Tutorial Pt 5

JQuery AnimationIn this JQuery video tutorial I introduce the JQuery UI library. I also show you numerous ways to animate elements using JQuery. I cover hide, show, toggle, fadeOut, fadeTo, slideUp, slideDown, animate and effect. I also cover numerous other properties.

If you missed part 1 of this tutorial watch it first JQuery Video Tutorial.

If you want the JQuery UI library, it can be found here JQuery UI Library

Continue reading JQuery Video Tutorial Pt 5

JQuery Video Tutorial Pt 4

JQuery The DOMI’ve received many requests to cover Document Object Model manipulation with JQuery. So, in this JQuery Video Tutorial I’ll show you numerous ways to add and delete elements to the DOM.

JQuery provides numerous ways to add elements and precise ways to delete others. I’ll specifically cover the following functions: before(), insertBefore(), prependTo(), appendTo(), append(), insertAfter(), after() and remove().

Continue reading JQuery Video Tutorial Pt 4

JQuery Video Tutorial Pt 3

JQuery Event HandlingIn this JQuery Video Tutorial I will cover numerous topics with a focus on Event Handling. If you missed part 1 check it out first JQuery Video Tutorial.

I’ll show you below how to:

  • Bind Events to an Element in a Web Page
  • Change Content Dynamically Based off of Events being Triggered
  • Track Mouse Movements
  • Monitor Keyboard Presses
  • Track Every Event with 1 Function

Continue reading JQuery Video Tutorial Pt 3

JQuery Video Tutorial Pt 2

JQuery Ajax TutorialWow, did the last JQuery Video Tutorial generate a lot of emails! I’m glad you guys and gals are interested in JQuery. Yes I will cover everything there is to know about the JQuery Framework in this tutorial.

If you missed the past tutorial it is here JQuery Video Tutorial.

In this video I’ll answer many of the questions I received such as:

Continue reading JQuery Video Tutorial Pt 2

JQuery Video Tutorial

JQuery Ajax TutorialThis is the first part of my JQuery Video Tutorial. I will also cover all of the techniques that go into implementing a dynamic site using Asynchronous JavaScript and XML (AJAX).

It is extremely easy to use AJAX techniques with JQuery. First you must understand that AJAX is not a language, it is just a series of techniques used to dynamically change websites with out page reloads.

If you’d prefer to read about AJAX, here is another article Ajax What is it?

Continue reading JQuery Video Tutorial

Enchantment Guy Kawasaki Book Review

Enchantment Guy KawasakiI don’t do book reviews, but when I’m asked to do something I feel obligated. About a month ago Guy Kawasaki sent me his new book Enchantment and asked me what I thought.

If you don’t know who Guy Kawasaki is he:

  • Was involved in creating the classic Apple 1984 commercial
  • Started Alltop.com
  • Is extremely popular on Twitter
  • Is a marketing genius

Continue reading Enchantment Guy Kawasaki Book Review