Archive for the 'PHP' Category

Looping Statement At PHP

Sunday, August 10th, 2008


Image Source: www.ariel.web.id
Looping statements, like Do-While looping statements, While looping statements, and For looping statements, makes programming very easy, even at making PHPs. But did you know that there is something that looping statements can’t loop? That’s right! There is something. Looping statements can’t loop If-Else statements. That’s because when the looping statement starts, it goes through the If-Else statement, and then, whatever the statement the If-Else statement supplies, it will be the new statement the looping statement loops, and the If-Else statement will be left aside. I’ve been creating PHPs in our school and I tell you, it’s very frustrating that your looping statements are not looping the whole statements you put inside it. Thus, your website will not work properly. The only solution that I find is that you have to use Switch statements. Switch statements are like If-Else statements, but the Switch statements are more specific. Try it! It works, even at other programming language

Good Features of the evolt PHP Login system

Tuesday, July 15th, 2008

Photobucket

As an example of secure PHP programming, the evolt PHP login system has a list of good features as follows:

Safety – Passwords are not saved in cookies

Levels – Users are identified by different levels (admin, user etc.)

Admin Center – As admin, you have full management of the users. View user profiles, delete and ban users, demote and upgrade user levels.

Tracking – You can now tell how many visitors and registered users are viewing your site. Also it will show how many users your site has.

Account Info – Registered users can edit and view their own information and also view other’s profile as well.

Error Form – If an error occurs, they are redirected to an error form page that they can fill out to inform that there is an error page and error that occurred are displayed.

Password – If users forget their password, they can have a new one generated and sent to their email.

Introduction to Functions in PHP

Wednesday, June 4th, 2008

First of all what is a Function? A Function is a small set of statements defined by the programmer to do a specific action. They take input values in the form of ‘arguments‘ and return values after execution. They can be written anywhere in the program. They are used to reduce the programming complexity and to handle the programming structures easily. The function takes an input, performs some operation with it and returns a value after successful execution. Functions are basically of two types, namely:

  • Functions with no return value
  • Functions with return values

-Source

Displaying Page Loading Time (Steps and Sample Code)

Monday, May 26th, 2008

stopwatch.gif

Here is how to display your page’s loading time:

1. Use the function microtime() to get the time in micro-seconds
2. Use the explode() function to turn the micro-time into an array.
3. Combine the two parts to the array (the micro-seconds to the seconds).
4. Repeat steps 1,2 and 3 for the bottom of the page
5. Take the time taken at the end of the page from the time taken at the top of the page to determine the total loading time.
6. After rounding the microtime, return it to the browser.

At the top of your page, place:

$m_time = explode(" ",microtime());
$m_time = $m_time[0] + $m_time[1];
$starttime = $m_time;
?>

At the bottom of your page, place:

$round = 3;// The number of decimal places to round the micro time to.
$m_time = explode(" ",microtime());
$m_time = $m_time[0] + $m_time[1];
$endtime = $m_time;
$totaltime = ($endtime - $starttime);
echo "Page loading took:". round($totaltime,$round) ." seconds";
?>

ASP vs PHP: Security

Wednesday, April 30th, 2008

In PHP, common tasks like ftp, encrypt passwords in MD5, or send email from a web page all are built in hidden code, and as PHP is Open source there is a lot
of free code available for PHP.

Unlike PHP there is no hidden code with ASP. If you need to upload files, then you would need a third party component like ASP upload, also if you need to send mail you need another component and so on.

Although PHP is better in many aspects, ASP offers more security than PHP.

ASP vs PHP: Price and Versatility

Monday, April 28th, 2008

Price Compared to ASP, PHP installations are absolutely cheaper to install. PHP perfectly runs on Linux (which is a free OS) and programmers use MySQL .(which also comes FREE) ASP runs on the IIS Server (Internet Information Server) which requires Windows N.T/2000/2003 Servers or better. Aside from that ASP mostly uses MS-SQL Server as the back end which is really expensive. PHP obviously is cheaper than ASP.

Cross Platform compatibility
PHP programs run on a wide variety of Operating Systems Unix, Linux, Solaris and Window’s.ASP on the other hand only works flawlessly with Windows and not with other platforms. PHP offers more versatility than ASP.

ASP vs PHP: Speed

Friday, April 25th, 2008

Speed
Relatively, PHP is much faster and stable than ASP, this is because ASP is built on a COM-based architecture so whenever a program tries to connect to a database or calls for a COM object, there is an overhead on the server, and this COM overhead adds up and slows things down.
While in PHP, everything runs in PHP’s memory space , this implies that PHP code will run faster because there is no overhead of communicating with different COM objects in different processes.
In addition to this ASP is slower and is a more memory intensive application than PHP’s model because each ASP language compiler runs in its own process.

PHP and ASP Comparison

Wednesday, April 23rd, 2008

What is PHP?
PHP or (PHP: Hypertext Preprocessor) is Open Source’s scripting language designed for the construction of dynamic web pages. PHP is largely used in server-side scripting, but can also be used from a command line interface or in standalone graphical applications.PHP commonly runs on a web server, taking the PHP code as its input and creating web pages as output. It can be set up on most web servers and on almost every operating system and platform for free.

What is ASP?
Active Server Pages (ASP) is Microsoft’s scripting language for building dynamic web sites, web applications and web services., First released in January 2002 , along with the version 1.0 of the .NET Framework, ASP.net is the successor to Microsoft’s Active Server Pages (ASP) technology. ASP.NET is made on the Common Language Runtime, allowing programmers to write ASP.NET code via any supported .NET language such as VBScript and Jscript.

Error reports

Sunday, April 13th, 2008

Photobucket

Learning PHP can be great however it can also be very frustrating to lessen that frustration know more about error reports.

One very important thing to know about PHP is the error reports. You need to have to turn on error reporting immediately preferably on Maximum Level. In this level it will be able to declare a variable ahead of time, reference a variable and use a define that is not set.

It will seem that this is not important but only until you develop structures programs with many functions and classes. It would help lessen the errors as well as long hours of fixing your work due to misspelled variables.

Put this line at the top of the PHP document: error_reporting(E_ALL); It places error reporting into highest level. You’ll be able to receive warning messages that will identify possible wrong elements of the document.

Learning PHP

Tuesday, April 8th, 2008

Photobucket

PHP Programming has become one of the trends today. To learn more about it, you can first start through the internet. Although you may also try books however internet provides more comprehensive information. Think what topics about PHP are you most interested about. You can visit and join forums discussing PHP programming. You can even ask questions in the forums. Friends who are into the field of programming might help.

If you want to know more about PHP Programming, it should not be limited to that there are also other areas that you need to learn about like JavaScript, HTML and CSS. It is helpful to always have knowledge on the latest trends and innovations regarding PHP Programming.


Bad Behavior has blocked 238 access attempts in the last 7 days.