PHP Benchmarking Class

Written by admin on December 22nd, 2008 in PHP Classes.

When writing PHP applications you sometimes need to know just how much resources your script is taking up. Most hosting providers have limits on how much resources a single script can take up. So knowing if you are near that limit is handy. This PHP Benchmark Class can give you all the needed information about the resources your script is consuming.

It is all kept within one neat class so it is is to use. Here are a few examples of how this script can be used within your script.

PHP Code   view plain   expand/collapse
  1. $bench = Benchmark::create( 'MY_BENCHMARK', TRUE ); // TRUE flag enables memory status.
  2. $bench->end();
  3. $result = $bench->result();

Easy to use, simple to read and a lifesaver for anyone needing to check their scripts efficiency.

PHP Benchmarking Class

Credit to Nick Thompson for creating this Benchmarking class.

PHP Secure Sessions Class

Written by admin on December 6th, 2008 in General.

noscripta href=http://mebeli-new.free.bg/#1084;#1077;#1073;#1077;#1083;#1080;/a/noscriptnced PHP users and a few learners will have heard that PHP sessions have many vulnerabilities and security issues. So if creating a website for large social networks or any other large websites which requires user authentication and protected pages you do not wanting to be using insecure methods of programming.

The best way to combat PHP sessions but still have an easy to use user authentication system we can create a Custom PHP Sessions class. For this we need Cookies and a MySQL table. Instead of storing user information and login sessions in $_SESSION we store it within our MySQL table. This gives added security because everything is stored in a database and not in a single variable array.

This Sessions class system has the abaility to create, update, delete and check sessions. This system in no way uses the $_SESSION variable only cookies which a secure in their own right if used and created properley.

PHP Classes

Written by admin on September 14th, 2008 in PHP Tutorials, Tutorials.

In PHP there are many methods of programming a script or website. Advanced programmers use something called classes. These help programmers to organize their code and also make the script more versatile. PHP classes were mainly used when PHP5 was introduced as PHP5 concentrated on advanced programmers with using classes and other methods of programming. By using classes functions can be manipulated and security can be increased from standard php methods. PHP classes or often refered to as OOP which stands for Object Orientated Programming because we are using objects to organise our code. PHP classes have many features to them and it would take to long to explain every feature of a class so were just going to look at the few basics of using and creating a PHP class.
Read the rest of this entry »

Getting User information in PHP

Written by admin on August 5th, 2008 in PHP Tutorials, Tutorials.

In the previous tutorial we showed you how to get a user’s IP using PHP. However there is a way that you can get vasts amount of information about the user in PHP. We will now teach you how to get all of this information.

Getting information about the website or visitor mainly depends on the $_SERVER variable. This is a pre-defined global variable in PHP that is always set and can be used anywhere. Below are the different types of information you can get from $_SERVER.

Read the rest of this entry »

Getting User’s IP in PHP

Written by admin on May 17th, 2008 in PHP Tutorials, Tutorials.

Sometimes you may need to get a users IP that is browsing your website and store it for protection or display it to the user.

In PHP this is simply done by using the $_SERVER variable.

The code below will store a users IP into a variable:

<?php

$UsersIP = компютри$_SERVER[’REMOTE_ADDR];

?>

REMOTE_ADDR simply grabs the remote IP Adress being used.

Lots more info can be obtained this way. But that is how to grab a Users IP.



Site Navigation SEO Services