Web dev - 2019
The exercise

When I study in CIM-UPC I had to make a work in php. The exercise was to make a contact agenda.
To give a little fun to work, I thought about making a Cylon agenda. I'm a big fan of the Battlestar Gallactica serie and I wanted to give it a little homage.


My first step was design in HTML and CSS the different pages (this is the easy part).

2: JavaScript

My first step was design in HTML and CSS the different pages (this is the easy part).

Afterwards, I validated two forms in JavaScript:

  • Log in: On login, I validated that this area had 3 letters minimun.

  • Add a new Cylon: Validations in the text fields also required 3 letters minimun. In the serial number the validation is for 8 numbers + 1 letter caracteristic of the Spanish DNI. In the phone number the condition was that it had 9 digits and start with 6, 7 or 9. And finally in the mail area, the required validation was started with test, had a @ and "." followed by whatever text.

3: PHP

And this is where the exercise began to complicate. In this exercise the "database" was two simple txt, one for login and other with agenda functions.

To start, the login should communicate with the txt "users" in read mode and return a response. In case the user did not exist it gave a funny failure of "You're are a human!". When the session is started, the user's name has been displayed in the header.

To close session, I do “session_destroy and redirect to index.


The function of the second way was to add a new record to the txt of "Cylons".
To do this, I collected the entered data and communicated the code with the txt in writing mode with the option fopen + a, in this way, I would not erase the information in the txt and I would add the data below the rest of the information.

To "delete" I collected the selected data using $ _POST in an array and to delete them I used the fopen + w option.
In the case of "delete all" I did with the fopen + w over the entire file and then through an "echo" I entered the image "fraking toaster".



  • Video

- Music by OST Battlestar Gallactica 2003. Title intro.



  • In exercise (images)


- Cylon: http://getwallpapers.com/collection/battlestar-galactica-wallpapers-and-screensavers

- Resurrection ship: https://www.themoviedb.org/tv/1972-battlestar-galactica/season/2/episode/11/images/backdrops

- Toaster: This funny image is made by Luke Surl https://www.lukesurl.com/archives/comic/487-do-the-robot