Old 11-14-2004   #1 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
tutorials

Could I write some PHP tutorials for Bio Rust?
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-14-2004   #2 (permalink)
Moderator
 
ConceptualMind's Avatar
 
Join Date: Oct 2003
Location: BioRUST Design Community
Posts: 2,652

Sure! You're more than welcome to. Plus, as a bonus m0g will give you +Rep points!
__________________
ConceptualMind
ConceptualMind is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-14-2004   #3 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
lol ok, when i get some time i'll write a couple on encryption
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-14-2004   #4 (permalink)
Sheep Worrier
 
Man1c M0g's Avatar
 
Join Date: Sep 2003
Location: Portsmouth, UK.
Posts: 4,099
Blog Entries: 14

Send a message via ICQ to Man1c M0g Send a message via MSN to Man1c M0g Send a message via Skype™ to Man1c M0g
Yup! Exactly what S2f said! We are ALWAYS in need of more coding tutorials (mainly because my coding sucks ).
__________________
Man1c M0g is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #5 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
so whats this reputation thingy all about?
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #6 (permalink)
Moderator
 
ConceptualMind's Avatar
 
Join Date: Oct 2003
Location: BioRUST Design Community
Posts: 2,652

Below a user's post count is their user rating. You can click the + to give someone a positive rating or the - to give someone a negative rating. All users start with a rating of 10.

By helping BioRUST m0g will give you a lot of rating points. The more tutorials you right, the more reputation points you can gain.
__________________
ConceptualMind
ConceptualMind is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #7 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
sounds simple enough
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #8 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
md5() encryption using PHP

One of the many ways of encrypting data using PHP is a function called md5().

md5() converts a string of text into a 32-character hash, using a secret algorythm, so as to protect its source. md5() encrypted strings cannot be decrypted. When I first learnt this I thought to myself - "how the heck can I check to see if two md5'd strings are equal then?" and the answer is simple, so simple that it seriously annoyed me. Take a login system for example, instead of decrypting the string and comparing it to a regular password, you take the encrypted string and compare it to a string that has already been encrypted! Simple huh?

So let’s write ourselves a little test script:

<?php
$string = “string to be encrypted”;
$encstring = md5($string);

echo $encstring;
?>

This will produce a 32-character jumble of letters and numbers, which will not be anything like what the original string was. In this instance, the output would be – “fc8de8ee2c43a9ae2f9023f205d960d6”.

To use md5, simple enclose the string in md5( x ); by replacing the x demonstrated with your string name. E.g. md5($stringname);. Yes, it’s that simple!

Yes, you can use this method to protect pages like admin areas and member only pages, but it has limited reliability, I do not recommend using this function to protect administration areas for big businesses or important websites simply because it is not the most secure method, however, it is sufficient for small businesses and personal use by far.

Let’s write a quick login script to demonstrate my point above:

Expect that you have a form, which uses POST and points to login.php, with a field called “username” and a password field called “password”.

<?php

// login.php written by Robbie Averill for BioRUST on 15/11/04 at 8.28 PM

$username = $_POST[‘username’];
$password = $_POST[‘password’];

$encpassword = md5($password);

$checkpw = “fc8de8ee2c43a9ae2f9023f205d960d6”;

if($encpassword === $checkpw){

echo ‘User logged in successfully! Welcome ’.$username.’!’;

} else {

echo ‘Password was wrong!’;

}

?>

In this instance, the encrypted value checks whether the posted password is equal to it (in this case the password would be “string to be encrypted”.

I hope this basic tutorial on md5() encryption has helped you, good luck!

For more information on the md5() function visit the following link:
http://nz2.php.net/manual/en/function.md5.php

Cya,
Robbie Averill
aka scrowler
__________________
BioRUST Tutorials - the birthplace

Last edited by scrowler; 11-15-2004 at 07:22 AM.
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #9 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
Basic tutorial to Sessions and Cookies

Sessions and cookies. What are they? Smoking marijuana and eating biscuits? Hell no, in the web development world these are very important things. The difference between sessions and cookies is basically just where they are stored.

Let’s start with sessions: They are pieces of data that are recorded by a web script that is stored on the server, and can be programmed to last for a certain amount of time, but usually gets erased when the user shuts their browser, although it is required that the function session_start() be called before ANY output is sent to the browser. To be on the safe side, I usually put it on the first line of code in a web script. The easiest way to create and manage sessions in PHP (4+) is as follows:

<?
session_start();
$_SESSION[‘session_name’] = ‘your data’;
?>

You can use this same variable to compare with other strings in if statements etc.

If for any reason you wish to erase a session before the user shuts their browser, you use session_destroy():

<?
session_destroy(‘session_name’);
?>

Let’s write a simple sessions script:

<?

session_start();

echo ‘Welcome to our sessions test! Your example username can be pogo!’;

$_SESSION[‘username’] = ‘pogo’;

echo ‘<a href=”page2.php”>Click here to have a session</a>’;

?>

And now for page 2:

<?

session_start();

echo ‘If all goes well, your username should show as “pogo”.’;

$username = $_SESSION[‘username’];
echo ‘Username: ‘.$username;

echo ‘Welcome pogo!’;

?>

Ofcourse this script has no user entered data, but that is only one modification away (adding an HTML form). I think this example is sufficient enough to demonstrate how sessions work.

Yep, that’s so simple even a monkey could do it, and people say sessions are hard! Pfft!

Now on to cookies (mmmmm). Cookies are the same thing as sessions basically except that they are stored locally (on your PC). If you are using M$ Windows then the chances are they are stored in [windows default folder]\Cookies, although if you have profiles they will be located in your personal profile’s cookie folder.

They are used the same way as the sessions are above, with SESSION replaced with COOKIE:

<?

$_COOKIE[‘cookie_name’] = ‘your data’;

$name = $_COOKIE[‘cookie_name’];

echo $name;
// this outputs “your data” on your page

?>

You can use the same example script as provided for the sessions tutorial above, replacing “SESSION” with “COOKIE”.

There are more complicated ways of registering cookies which I wont go into because this is a basic tutorial, although I will outline it. The function is the same function used except for PHP server versions that are version less than 4 (or 4+ aswell). They have extra attributes that allow you to set the timeout limit, domain, cookie name, data, etc.

For more imformation on sessions, follow the following link:
http://nz2.php.net/manual/en/functio...n-register.php

For more information on cookies, follow the following link:
http://nz2.php.net/manual/en/function.setcookie.php
__________________
BioRUST Tutorials - the birthplace

Last edited by scrowler; 11-17-2004 at 02:01 AM.
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #10 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
Lightbulb

both of those tutorials I would rate as being novice skill level

--edit-- sorry for the double double posting
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #11 (permalink)
Moderator
 
ConceptualMind's Avatar
 
Join Date: Oct 2003
Location: BioRUST Design Community
Posts: 2,652

It's best to e-mail the tutorials to m0g. mog@mogsoft.com

Just to make sure, those tutorials were COMPLETELY WRITTEN by you? You didn't use another tutorial as a "guide." Right?

Also, are you sending this tutorial to other sites? Or is it exclusive to BioRUST?
__________________
ConceptualMind
ConceptualMind is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-15-2004   #12 (permalink)
Sheep Worrier
 
Man1c M0g's Avatar
 
Join Date: Sep 2003
Location: Portsmouth, UK.
Posts: 4,099
Blog Entries: 14

Send a message via ICQ to Man1c M0g Send a message via MSN to Man1c M0g Send a message via Skype™ to Man1c M0g
Nice tutorials Scrowler! I'll publish the MD5 one right away, but can you embellish the cookies/sessions one with a few examples on how to store/retrieve values, and especially how this relates to PHP variables? I think this would make the tutorial much more worthwhile!

Oh, and if you fancy, how about creating an introduction tutorial on mysql/php that shows you how to change variable values, pull information and display it, etc. Its something I get asked all the darned time, and there is no tutorial out there that puts it in the beginner to intermediate setting - they usually talk about utter basics, or drone on with the advanced stuff...

Edit: md5() tutorial now online over at http://biorust.com/index.php?page=tu...etail&tutid=99
__________________
Man1c M0g is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-16-2004   #13 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
cool, yeah ill fix up the sessions one some time soon

s2f - yeah i wrote them myself

-edit- exclusive to biorust

--edit 17 november-- since its already posted i thought i may aswell update it here instead of emailing it, so the sessions and cookies tutorial is updated
__________________
BioRUST Tutorials - the birthplace

Last edited by scrowler; 11-17-2004 at 02:02 AM.
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-22-2004   #14 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
m0g, since i don't have a job and i have an 8 week holiday ahead of me, are there any specific topics you would like me to write tutorials on?
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-23-2004   #15 (permalink)
Red Dawn
 
BlodoPKNZ's Avatar
 
Join Date: May 2004
Location: Eastern Europe
Posts: 302

About the md5 tutorial: i heard that there is a possibility of generating the same hash strings for 2 or more different passwords. This is a potential vulnerability if the hacker would use brute force (always ups his chances some way). Because there is no way to decrypt an md5 hash to achieve a 100% match of a password, is there any way to be absolutely sure that the given password is correct with the one stored in the database?
__________________
BlodoPKNZ is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 04:55 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT