Git Product home page Git Product logo

guest-php's Introduction

Title: PHP Guestbook

  • Repository: challenge-php-guestbook
  • Type of Challenge: Consolidation Challenge
  • Duration: 1 day
  • Deployment strategy : NA
  • Team challenge : solo

Learning objectives

  • Storing data in files
  • Converting complex constructs (array/objects) to string representation.
  • Deliver a project under a strict deadline

The Mission

It is time for our first php Consolidation challenge! Let's remember the internet of the 1990, and create a classic widget that every site in that decade had: a guestbook.

guestbook.jpg

Any visitor on te page can leave a message on your page that are then saved and showed (last message on top) for everybody who visits the page.

How to store the messages?

You can store the messages in a file on your system. You can use the brother of file_get_contents() for this: file_put_contents() .

You can either use json_encode() or serialize() to convert your array to a string to store.

Must-have features

  • Posts must have the following attributes:

    • Title
    • Date
    • Content
    • Author name
  • Use at least 2 classes: PostLoader & Post

  • The messages are sorted from new (top) to old (bottom).

  • Make sure the script can handle site defacement attacks: use htmlspecialchars()

  • Only show the latest 20 posts.

Nice to have features

  • Profanity filter: at the top of your script create an array of "bad" words. If somebody tries to enter a message with those words, their messages gets rejected.

  • When the user enters uses a "smily" like ":-)", ";-)", ":-(" replace it with an image of such a smily.

  • Have an input field where the user can enter how many message he wants to see displayed.

Tips & Advice

  • To keep a good overview of the code we recommend separating the view (html code) as much as possible from the PHP code, look at the example.php. If you want you can already look into more advanced theory for this separation, but it is not required in this exercise.

  • Write your footer and header HTML code and require() them in your template files in separate files to avoid repeating HTML code.

guest-php's People

Contributors

whitneyz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.