Tuesday, October 25, 2011

Page Redirection Using PHP updated

Earlier, I had asked for the entry level class of PHP students to create a Login Form and if the password is correct the user should be redirected to a members page or else the users should be redirected to the home page.  Generally we compare the login input from the user to the actual stored username and password in the database for authentication.  However, in this particular section, I'm going to hard code the password through a variable for learning purposes only.  The new thing to learn for beginners is how the form and the results can be  coded on the same page, using $_SERVER[ 'SCRIPT_NAME ' ] system global.  Here's the code for this below:


<?php

if(isset($_POST['submit'])){
$authorized = "abcotechnology";
//if statement to check the password
if($_POST['password']==$authorized){
header('Location: ProcessFileUpload.php');
} else {
header('Location: index.php');
}

}else { //else of post-submit

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login Form Assignment</title>
</head>

<body>
<h2> Login Page </h2>
<form name="frm_login" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'];?>">
<table width="200" border="0" cellpadding="0" cellspacing="0">
    <tr>
  <td align="right"><strong> Username:</strong></td>      
        <td align="left"><input type="text" name="username" size="35" /></td>
        </tr>
            <tr>
  <td align="right"><strong> Password:</strong></td>      
        <td align="left"><input type="password" name="password" size="35" /></td>
        </tr>
       
        <tr>
        <td colspan="2" align="center"><input type="submit" name="submit" value="Login" />
        </tr>
    </table>
</form>
</body>
</html>
<?php
}
?>

Friday, October 7, 2011

Create Dynamic HTML Pages using PHP

One of the most interesting things of PHP is that it can be used on different types of operating systems including Microsoft Windows, Unix variants, RISC OS, Mac OS X, Linux and several others. Apart from this, PHP supports almost every web servers. Some of them are Microsoft Internet Information Server, Apache, Netscape, Personal Web Server, OmniHTTPd, Oreilly Website Pro server, Xitami and Caudium.


In most of the time PHP uses object oriented programming or a procedural programming for server-side scripting, writing desktop application and command line interface. However, for using PHP in a server-side scripting, one require a PHP parser, a web browser and a web server. But in this respect it should also be mentioned that PHP script could be run without a browser or a server. This type of usage is actually executed using Task Scheduler or cron. Moreover, these scripts can be used for the tasks of simple text processing.
Beside all these usages, PHP can be used for the creation of a desktop application with a graphical user interface. On the other hand, with PHP-GTK one will be able to write cross-platform applications. There is no doubt in the fact that since PHP websites have more features, they are considered to be better than the regular websites.
While discussing about PHP, it should also be mentioned that PHP allows for the outputting of PDF files, Flash movies and even images. If you want you can also output text in different forms, such as, XHTML as well as any other XML file. PHP basically auto generates those files and saves them in the file system.
PHP supports a wide variety of databases, such as, Postgre SQL, Adabas D, InterBase, FrontBase,SQLite, dBase, Empress, mSQL, Direct MS-SQL, Solid, FilePro, Velocis, Sybase, Hyperwave, MySQL, Informix, Oracle, ODBC (Open Database Connection), Unix dbm, Ovrimos and Ingress.
PHP also uses several protocols (such as, NNTP, POP3, IMAP, SNMP, HTTP, COM, LDAP). Apart from this, PHP has support for the WDDX complex data exchange between different web programming languages and instantiation of Java objects. On the other hand, for accessing and parsing XML documents, PHP 4 supports the DOM and SAX standards, whereas, PHP 5 standardizes most of the XML extensions on libxml2.
Nowadays, most of the programmers of a reputed web development company are expected to know PHP, otherwise they may face trouble while delivering quality web development services.




Check Us Out We Are All Over The Web!!






Check Out Our Website