VOOZH about

URL: https://www.geeksforgeeks.org/php/project-idea-anonymous-message-prank-game-in-php/

⇱ Project Idea | Anonymous Message Prank Game in PHP - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Project Idea | Anonymous Message Prank Game in PHP

Last Updated : 29 Nov, 2022

In this article, we are going to learn concepts of database, how to make a simple game using PHP and MySQL, how can we implement a database in which we send secret messages for a particular user, how to arrange tables in the database and Also we learn some security issues that how can we save our web apps from these security issues. 

Domain: Web application using PHP and MySQL database.

Features:

  • Sign Up
  • Login
  • Secret Messages to a particular user by using a URL provided by Sign up user
  • Sending messages by Ajax Requests
  • Database

It is a simple game in which users send secret messages for a particular user by using a link. Through this game we learn a lot of things like how to sign up and login to a user by creating a session and destroying session, How can we store data of users and secret messages in the database for a particular user who has created a link for his name.

Tools and Technologies:

Front-End: 

  1. BOOTSTRAP CDN
  2. HTML and CSS

Back-End: 

  1. PHP
  2. JQuery
  3. Database - MySQL

Tools: 

  1. XAMP Server ( for creating server on Localhost )

Project Implementation: Make an empty Folder and create files According to this File structure   

👁 Image
File structure 

Assets folder: First, let us start from the assets folder. So we create this folder because of assets that we use in a project like images, videos, global CSS, and js file which is attached to all files in our project. we also create an index.php file for all folders because if someone is trying to access this folder then he sees only an index page not our directory 

if index.php file is not created then anyone can see our file structure of the whole project 

👁 Image
if index.php is not created in all folders 
👁 Image
After creating index.php in all folders 
👁 Image
assets

Utils Folder - make filename as protectXss.php - This file is Basically used to protect our web App from Cross-Site Scripting attacks. 

Partials Folder and make files according to file structure as shown: 

👁 Image
partials

Inside the partials folder make a folder named as modals to place all modals in it

Source Code 

Root Folder: Make files according to this structure.

👁 Image
Root folder

Filename - index.php

Create index.php which is the main page of the web app. In this page, we are creating a form that takes the name of the user as input to start the game.

File name - welcome.php 

We are creating this file for seeing messages that are come from other users and providing username and password to the signup user. Along with the username and password a link is also provided so that the signup user shares it with others and others send him anonymous messages. 

👁 Image
welcome.php

Filename - anonymous.php

We are creating this file for URL which we provided to our sign up users so that they share that URL with their friends and directing friends to this file using that URL

👁 Image
anonymous.php

Filename - logout.php

To logout users and destroying sessions.

Database: Start XAMP Server

👁 Image
Xamp Server Start apache and mySQL

Go to browser and type in the addressbar

Go to phpmyadmin and create a new database named as "anonymousdb" 

Database Structure 

👁 Image

Make tables according to this below structures shown 

Table name - "an_users"

To make a column unique click on "more" near "drop" and select "unique"

👁 Image
an_users

Table name -  "an_messages"

👁 Image
an_messages

Output

Comment