Monday, December 7, 2009

Create login like Cpanel using PHP

Create login like Cpanel using PHP
Have you ever seen the display "login" as above? If so, maybe you wondered how to make it. Now, in this  PHP Tutorial i will show you how to create a login as above, it was very easy. The key lies in the Header. Header in PHP has the function of many once and can been tampered with. Okay, I'll explain how to make it. Create a file named index.php and then type the following script:

if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Login like Cpanel"');
echo 'You have canceled the login !';
} else {
echo "Your username is {$_SERVER['PHP_AUTH_USER']}.
echo "and your password is {$_SERVER['PHP_AUTH_PW']}.

A little explanation of the script above:
If (!isset PHP_AUTH_USER means if the variable has not / is not optional, it will show login dialog box. And if it is filled, it will show username and password that you entered.
How? Easy enough right? Welcome to the cool login

Related Posts by Categories


Anonymous said...

I always prefer Cpanel has some excellent features and in this we can manage our website according to our requirement,Register a Domain

Register Domain

Post a Comment

Maybe this is what you looking for


Subscribe Now


IT Skill is not enough... Copyright © 2009 Designed by Bie Blogger Template