Archive for the ‘PHP’ Category

Preventing Bad Grease Monkeys from changing your prices in eCommerce sites

Thursday, April 12th, 2007

Naughty Grease MonkiesI spoke with Gina Trapani on Wednesday about my concerns on this issue. The problem is that many online shops are using hidden fields in forms to pass information such as pricing, shipping, and quantity to their online checkout systems. Now I love Google Checkout for its sheer simple integration methods, but there is also an option to auto approve the payment and this concerns me. So I am writing to you today to illustrate some of the methods I have came up with which will hopefully prevent this sort of attack. Here are three ways you can circumvent this little flaw in many online stores.
(more…)

Access your webserver with PuTTY

Thursday, July 13th, 2006

PuTTY is a free implementation of Telnet and SSH for Win32 and Unix platforms, along with an xterm terminal emulator. It is written and maintained primarily by Simon Tatham.

I use putty alot and really find it usefull. Download PuTTY here

–Tim Matheson

Introduction to PHP - Mini tutorial on the basics of PHP

Saturday, February 11th, 2006

PHP Hypertext Preprocessor is an advanced scripting language that is very usefull for web developers. I am some what new to the PHP syntax but I will try to write some helpfull tutorials on it as I learn.

Ok, Let’s get started …

PHP is used in conjunction to HTML or XHTML and other flavors of hyper-text-markup languages. PHP enables static html web pages to contain dynamic content and preform many usefull functions when it comes to user interactivity. For a full resource guide on PHP please visit PHP Resources for a more indepth look at PHP syntax and functions. The most common reason to use PHP in your web pages is the ability to interact with databases such as SQL.

SQL is beyond the scope of this post however I plan to add another section to cover SQL in the near future.

Anyone who has ever programmed anything is probably familiar with the “Hello World” program. It is usually the first thing you learn to do when learning a new language. So here is how to write a simple “Hello World” program using PHP.

To initiate a PHP script you first tell the browser that you are using PHP with the PHP script open command < ?php will tell the browser that any code after the and the parser will stop parsing the code as PHP and render the rest of the document as standard HTML.

Hello World

< ?php

echo “Hello World”;

?>

In the above script we used the PHP begin tag < ?php the echo command and the php close tag ?> .

The echo command will echo the data between the quotes to the screen.

Strings - php like many other scripting languages offers the ability to store information in a string. A string is simply some unique name begining with the $ by placing a $ before the string name it tells php to create a string using the name following the $ . To define a string you would simply write.

< ?php

$mystring = “Hello World”;

?>

Ok so lets take a look at what has been done here. We simply made a string called mystring and gave it a value of Hello World then we terminated using the ever so familiar ;

Now that we have a variable defined let’s use it to run a script.

< ?php

$mystring = “Hello World”;

echo = $mystring ;

?>

The above script would return Hello World to the screen where ever you place the code.

Pretty basic so far right. Ok so what if you have more than one string and you would like to echo them both to the screen using one echo statement. You would do in programming what is called concate the two strings using the . to concate the two strings. Example

< ?php

$firstname = “Tim”;

$lastname = “Matheson”

echo $firstname . $lastname;

?>

The above script would return Tim Matheson to the screen at the location of the script within the document. Now moving forward say we want to echo a string and some text at the same time. Simple just use the ” ” and the . to seperate each piece of information. Example

< ?php

$firstname = “Tim”;

$lastname = “Matheson”;

echo “Hello” . $firstname . ” ” . $lastname . ” ” . “, welcome to my PHP mini tutorial.”;

?>

Lets take our echo statement and break it down first echo tells php to put the contents to the screen. Anything in quotes will be displayed as text so dont quote your strings or you will get plain text output to the screen. (i.e. echo “$firstname” ; returns $firstname but echo $firstname; would return Tim) Ok moving forward the period’s seperate strings and text and are required for the script to work. The period will concate two strings or two pieces of text together. However to concate two pieces of text together would be a bit redundant. (i.e. echo “Hello” . “World” ;) would work but could be stated as echo “Hello World”; and save some kilobytes in the file size. Remember the larger the file the longer the parse time and the longer the delay from server to client. There for save yourself the agony of long parse times and also write clean code and only use whats needed.

Well that about wraps it up for this tutorial next time I will get into $_POST['string']; and $_GET['string']; and how to use them in conjunction to a form.

I hope you enjoyed this tutorial and found it usefull. If so please provide a link to my site so that others can find it usefull also.

Happy Coding Cheers!