PHP Language used for Faculty Site

6 downloads 21289 Views 259KB Size Report
language that is especially suited for web development and ... Some of these include CakePHP, ... Many functions familiar to C programmers such as those in.
PHP Language used for Faculty Site Claudiu Costea Department of Electrical Drives and Automation , University of Oradea , Faculty of Electrical Engineering and Information Technology , Str. Universităţii 1 ,410087 , Oradea , Romania Phone: +40 (0) 59 408-226 E-Mail: [email protected]

Abstract – This project gives us a very good example of the advantages of using php and also it can be used like a school site. Using this site the students can see the marks received at exams. Keywords: php , mysql , databases I. INTRODUCTION PHP (Hypertext Preprocessor) is a computer scripting language , originally designed for producing dynamic web pages. It is mainly used in server-side scripting, but can be used from a command line interface or in standalone graphical applications. While PHP was originally created by Rasmus Lerdorf in 1994, the main implementation of PHP is now produced by The PHP Group and serves as the de facto standard for PHP as there is no formal specification. PHP is a widely-used general-purpose scripting language that is especially suited for web development and can be embedded into HTML. It generally runs on a web server, taking PHP code as its input and creating web pages as output. It can be deployed on most web servers and on almost every operating system and platform free of charge. PHP is installed on more than 20 million websites and 1 million servers, although the number of websites with PHP installed has declined since August 2005. It is also the most popular Apache module among computers using Apache as a web server. PHP is a general-purpose scripting language that is especially suited for web development. It is the fourth most popular computer programming language, ranking behind Java, C, and Visual Basic. PHP generally runs on a web server, taking PHP code as its input and creating web pages as output. It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most web servers, many operating systems and platforms, and can be used with many relational database management systems. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use. PHP primarily acts as a filter, taking input from a file or stream containing text and/or PHP instructions and outputs another stream of data; most commonly the output will be HTML. From PHP 4, the PHP parser compiles input to produce bytecode for processing by the Zend Engine, giving improved performance over its interpreter predecessor.

Originally designed to create dynamic web pages, PHP's principal focus is server-side scripting , and it is similar to other server-side scripting languages that provide dynamic content from a web server to a client, such as Microsoft’s ASP.NET system, Sun Microsystems' JavaServer Pages, and mod_perl. PHP has also attracted the development of many frameworks that provide building blocks and a design structure to promote rapid application development (RAD). Some of these include CakePHP, PRADO, Symfony and Zend Framework, offering features similar to other web application frameworks. The LAMP architecture has become popular in the web industry as a way of deploying web applications. PHP is commonly used as the P in this bundle alongside Linux, Apache and MySQL, although the P can also refer to Python or Perl. PHP includes free and open source libraries with the core build. PHP is a fundamentally Internet-aware system with modules built in for accessing FTP servers, many database servers, embedded SQL libraries such as embedded MySQL and SQLite, LDAP servers, and others. Many functions familiar to C programmers such as those in the stdio family are available in the standard PHP build. PHP has traditionally used features such as "magic_quotes_gpc" and "magic_quotes_runtime" which attempt to escape apostrophes (') and quotes (") in strings in the assumption that they will be used in databases, to prevent SQL injection attacks. This leads to confusion over which data is escaped and which is not, and to problems when data is not in fact used as input to a database and when the escaping used is not completely correct. To make code portable between servers which do and do not use magic quotes, developers can preface their code with a script to reverse the effect of magic quotes when it is applied. PHP allows developers to write extensions in C to add functionality to the PHP language. These can then be compiled into PHP or loaded dynamically at runtime. Extensions have been written to add support for the Windows API, process management on Unix-like operating systems, multibyte strings (Unicode), cURL, and several popular compression formats. Some more unusual features include integration with Internet relay chat, dynamic generation of images and Adobe Flash content, and even speech synthesis. The PHP Extension Community Library (PECL) project is a repository for extensions to the PHP language.

127

As with many scripting languages, PHP scripts are normally kept as human-readable source code, even on production web servers. While this allows flexibility, releasing scripts in source form is undesirable for commercial software developers, and can raise issues with security of web servers; as an example, if a hacker acquires control of a server, database passwords may be quickly discovered, and undesirable changes to scripts may be made that remain undiscovered indefinitely. Various encoding tools are available for PHP to offer code protection. Code optimizers improve the quality of the compiled code by reducing its size and making changes that can reduce the execution time and improve performance. The nature of the PHP compiler is such that there are often opportunities for code optimization and an example of a code optimizer is the Zend Optimizer PHP extension. PHP accelerators can offer significant performance gains by caching the compiled form of a PHP script in shared memory to avoid the overhead of parsing and compiling the code every time the script runs. They may also perform code optimization to provide increased execution performance.

MySQL is more than just a database. It is a system that manages databases. It controls who can use them and how they are manipulated. It logs actions and runs continously in the background. III. PRESENTATION OF THE APPLICATION File used: index.tpl is the only html file used ; preload.php – inside it are loaded the required libraries ; general_functions.php – inside are all functions who select tables from database ; db.php – database connection variables: host , type , name , user ; inside style.css are defined stylesheet properties. How the applications works: we have four access levels : the level of the student ; the teacher level ; the librarian level and the level of the database administrator . For all levels is require a username and a password to login. The student level allow to see the marks received for each exam and also allow to see the books who are borrowed from library.

II. PHP AND MySQL PHP (Hypertext Preprocessor) is truly crossplatform. It run on the Windows operating system , most versions of UNIX including Linux and even the Macintosh. Support is provided for a range of Web servers including Apache (it self open source and cross-platform) , Microsoft Internet Information Server , WebSite Pro , the iPlanet Web Server and Microsoft’s Personal Web Server. The latter is useful if you want to test your scripts offline on a Windows machine , although Apache can also be run on Windows. You can also compile PHP as a standalone application. You can then call it from the command line. PHP is designed to integrate easily with databases. This feature is one of the factors that make the language such a good choice for building sophisticated Web applications. Many databases are directly supported , including Adabas D , InterBase , Solid , dBASE , mSQL , Sybase , Empress , MySQL , Velocis , FilePro , Oracle , UNIX dbm , Informix and PostgreSQL . PHP also supports ODBC. MySQL is an open source , Enterprise-level , multithreaded , relational database management system. MySQL was developed by a consulting firm in Sweden called TcX. They were in need of a database system that was extremely fast and flexible. MySQL is a program that manages databases , much like Microsoft’s Excel manages spreadsheets. SQL is a programming language that is used by MySQL to accomplish tasks within a database , just as Excel uses VBA ( Visual Basic for Applications ) to handle tasks with spreadsheets and workbooks. Other programs that manage databases include Microsoft’s SQL Server , Sybase Adaptive Server and DB2.

Fig. 1 Marks received

Fig. 2 Books borrowed

The teacher level allow to submit marks. The marks are submitted for that subject wich the teacher has the right. Also this level , like the student level , allow to see all books borrowed from library.

Fig.3 Teacher select a subject

128

Fig. 8 Add a new book in database

Fig. 4 Teacher give marks to students

The administrator’s level allow to add a new user , to update a user account (has the possibility to modify: type , username , password , first name , last name).

The librarian level allow to search for everybody what books have borrow from library ; allow to add a new book who is borrow by a student or a teacher and also allow to add a new book in database.

Fig. 5 The librarian search

Fig. 9 Add a new user

Fig. 6 The search response

Fig. 10 Update a user account

Fig. 7 A book is borrow from a person

Some of the possible operation are the: - view – each user can see what books are borrowed from the library ; - add – every teacher can add marks to their subject ; the librarian can add a book to a user , when this borrow a book ; also the librarian can add a new book in database , when is a new book in the school library ; the administrator can to add a new user;

129

- delete – when a user return to library a book who was borrowed , then the librarian delete this book from this user ; - edit – the administrator can update a user account: he can modify: type , username , password , first name , last name ; also the administrator can change the username who teaching a certain subject. IV. CONCLUSION This portal gives us a very good example of the advantages of using php. REFERENCES [1] [2] [3] [4]

www.php.net www.wikipedia.org www.apache.org Gilmore, W. Jason , Beginning PHP and MySQL 5: From Novice to Professional , 2006 [5] Lerdorf, Rasmus , Programming PHP , 2006

130