Php-mysql Course

This is a PHP script to Register and Login users in a website, and shows the Online users.
It has option to Log in with Facebook, Yahoo, or with a Google account.

It is created with the method based on classes and objects (OOP). Uses PHP, MySQL and Ajax / JavaScript (with jQuery) [it can work also in browsers with JavaScript disabled]. The connection to MySQL is made with PDO.
The HTML code is valid HTML5, also, works in Internet Explorer browsers which don't recognise HTML5 tags.
The Admin can delete users, modify their data, adds /delete messages and favorite links, and change their Rank, from -1 to 9 (the Rank -1 means banned, 0 is unconfirmed account, and a Rank 9 gives to the user Administration privileges).
The script can easily be used in other language, just translate the texts in a single file ("texts.php" in "usrincls/" directory).

The script includes button "Remember" that gives the posibility to automaticaly login the users in the next visits.
If the user forgot the password, the script can send it to his e-mail.
By default, this script is set to send a message to the user's e-mail, after the registration, with a link to confirm the registration, but this setting can easily be reset to let the user to log in imediately after registration, without any confirmation.
The script can send the emails via a local mail server (with PHP mail() function), or through SMTP via an GMail account, with the PHPMailer class.
Each user has a personal page that contains: an image uploaded by the user, the registration date, the last visit date, the number of visits /logins, and other personal data (name, pronoun, birthday, personal website, occupation, hobby).
In his personal page, the user can receive messages added by other users (will be notified by email), and can add 12 favorite links.
The logged user can delete the messages in his page, can modify the password and the e-mail address used to registration, then he/she will receive an email with the new data.
The messages posted in the user's page are paginated, and can be included an image (displayed in full page when click on it), the text can be formated with Bold, Italic, Underline.
The user which writes the message can select the option to receive email notification when new message is added.
The script displays the total number of users, the last registered user and the Online users (updated with Ajax every 2 minutes) with link to their page.
The script contains a page that shows a list with all registered users, and users loged with Facebook, that are paginated and can be ordered by Name, Last Visit, Registration date, Visits number, and Rank.


The script is in two versions: Advanced, and Smiple.

Advanced Register /Login Users Script

The Advanced version uses PHP PDO to perform SQL queries, it has Admin functions.
• To Download it, click: Register / Login /Online Users Script

- To see how it looks the page of a user when a visitor visits it, click User page.
- To test the page of a user when he /she is logged in his /her personal page, click Logged user.
- To test the page of a user when Admin logs in, click Admin logged.

Simple Register /Login Users Script

• To Download it, click: Simple Register / Login /Online Users Script

- The Simple version uses PHP MySQLi to perform SQL queries. Not has Admin control, neither PHPMailer class.
- To see the page of a user when a visitor visits it, click User page.
- To test the page of a user when he /she is logged in his /her personal page, click Loged user.

Instructions about instalation, script structure (tables, files and their role) and other details can be found in the file "Read.html", in the ZIP archive that you can download from the link above (Register / Login /Online Users Script).

Security features


• How to display in your web page a content for visitors and another content for logged users:
- It can be made by checking the existence of the variable: $_SESSION['username'].
<?php
if(isset($_SESSION['username'])) {
  echo 'Execute some code for logged users';
}
else {
  echo 'Add another code for visitors';
}
?>

• How to display a content in your web page according to the user's rank.
- It can be made by checking the value of the variable: $_SESSION['rank'].
<?php
if(isset($_SESSION['rank']) && $_SESSION['rank']>2) {
  echo 'Content for users with rank greater than 2';
}
else if(isset($_SESSION['rank']) && $_SESSION['rank']==2) {
  echo 'Another content, for users with rank 2';
}
else if(isset($_SESSION['rank'])) {
  echo 'Code for logged users with rank 1';
}
?>

- This script is free (does not provide support or personal modifications).

It was successfully tested for a general configuration on localhost with XAMPP (Internet Explorer, Mozilla Firefox, and Opera), and also on the server of the website https://coursesweb.net. If on other systems does not work properly, depends on their configuration. Problems can appear especially on free hostings which have restrictions on the "session", or not support PDO (MySQLi for the version Simple).

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag create a highlighted bolded text?
<q> <strong> <em>
<p>Address: <strong>http://CoursesWeb.net/</strong> - Tutorials.</p>
Which of these CSS codes displays the text bolded?
text-size: 18px; font-style: italic; font-weight: 800;
#id {
  font-weight: 800;
}
What JavaScript function can be used to call another function multiple times, to a specified time interval?
setInterval() setTimeout() push()
function someFunction() { alert("CoursesWeb.net"); }
setInterval("someFunction()", 2000);
Click on the correctly defined variable in PHP.
var vname = 8; $vname = 8; $vname == 8;
$vname = 8;
echo $vname;
Script Users Register, Login, Online

Last accessed pages

  1. Pseudo-classes (447)
  2. Backgrounds (531)
  3. CSS Pseudo-elements (761)
  4. Pseudo-classes added in CSS3 (551)
  5. CSS Float and Clear (2306)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (309)
  2. Read Excel file data in PHP - PhpExcelReader (112)
  3. The Four Agreements (94)
  4. PHP Unzipper - Extract Zip, Rar Archives (90)
  5. The Mastery of Love (84)
Chat
Chat or leave a message for the other users
Full screenInchide