DMD – GED

Digital Media Design

Menu

Skip to content
  • D4DME
  • Development & Realisation
  • Concept and Ideation
  • About

function

PHP in WEB Application

April 5, 2015April 20, 2015gediminasg D4DME Tags: connect, d4dme, function, login, logout, mysql, php, register, session Leave a comment

PHP in WEB Application 

In this blog post I will explain some of most important PHP  script used in our “Bored in Bournemouth” Web Application. I will show the code and explain what it does and why.

Connection to MySQL phpMyadmin database 

rsz_connect secure

This PHP scripts is used to define database server, user of the server, user password for the server and the database name in which user account it is created. If the information is correct the script connects to the database  if not the if statement executes the code stating “Database connection failed”.

Account Registration 

rsz_register

The PHP script requires scripts that are already created by using the command”require_once”. In this case the registration requires the connect.php in order to connect to the database for infroamtion out put. The session.php is used to execute message if the users logged or if something went wrong. The function.php redirect the user to the page which is stated in the “redirectTo(“index.php”) ; “. The register.php requires the user to input the details then by clicking submit it connect to the database and if everything is fine it executes a messsage. It also check the values in the database if the exist  e.g {$username}. After successfully creating an account user can log in  and is redirected through function.php to the index page.

Log In 

rsz_log_in

 

login.php is similar to register..php it requires same scripts that are already created (connect.php, session.php and function.php). log.in php requires the user to input their username and password they created. log.in pages connect to the database and check if the user is created by checking the user id.  If the registered user is found on the database the session.php will execute a message “Success, welcome back {$user[“username”]}” with the user name at the end. It will redirect the user to submit your day out page. If the information is not found on the database the session.php will execute the message “Wrong username/password” and redirect the user to index.php to try again.

Submit Your Day Out 

rsz_day_out

 

submit-day.php requires the same PHP scripts. This time there is more information needed and more information needs to be checked. The submit-day.php requires the user to input the name, description, location and the rating of the day out he wish to submit. If any of the values are empty session.php will execute the message in regard of what missing. So if the user does not rate the activity a message “Please rate your activity” will be executed. If all the values are inserted then the submit-day.php connect to the database and inserts the date in the table that has the value names. It the success event a message of “Your day was added” will be execute if there is something wrong a message of “something went wrong” will be executed. The empty values will be displayed to the user if he does not put one or many of the information requested.

Log Out 

rsz_log_out

 

logout.php does not require connect.php as it does not need to connect to the database. Instead it destroys the session.php of message execution and uses function.php to redirect the user to dayout.php where all the day outs are posted by the administrator.

Function 

 

rsz_function

 

function.php is quite a simple PHP scripts which was used in other PHP scripts mentioned above. It simply runs a function of redirecting the user to the stated page and the exits the function.

Session 

rsz_session

session.php is another PHP script that was used in all the PHP scripts mentioned above. It used to execute the message if some of the data is missing or is not correct.

 

 

 

Advertisements

Recent Posts

  • Task 3 – Motion Graphics
  • Joiner Image, Long & Short Exposure Images.
  • Task 2 – Temporal Expression
  • Task 2 – D. Hockney & Cubism
  • My Photo Alphabet

Archives

  • August 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • November 2014
  • October 2014

Social Media

Facebook Youtube Instagram Email Tumblr
Blog at WordPress.com.
Cancel