Simple PHP Tournament Script – PHP & AngularJS – Download Source Code

simple-php-tournament-script-angularjs
Important Note: This script is not updated in a while. But it still works. Download at your own risk.

Download and learn how this simple tournament script was made. Technologies used include PHP, MySQL, AngularJS, Material Design and jQuery.

Script Overview

This script is an addition to our tutorial: PHP, MySQL and AngularJS CRUD Tutorial – Step by Step Guide!

Studying this script will help you learn more coding techniques with PHP and AngularJS. Some include learning a better file structure, working with 4 objects, dynamic drop-down data (retrieved from database), routing and more.

We call this script "simple tournament script" because it features four objects related to a tournament: matches, countries, tournaments and teams.

Before you download, please make sure you have basic understanding of the following topics.

a. PHP, MySQL and OOP CRUD Tutorial – Step by Step Guide!
b. PHP, MySQL and AngularJS CRUD Tutorial – Step by Step Guide!

If you learned our tutorials above, this script should be easy to understand.

Output Preview

Below are some screenshots of our script's output. You can click an image to view the larger version of it.

Please note that the following images are just output previews. New features might be added already the time you are reading this.

[espro-slider id=5707]

If you need the live demo link, send a request to [email protected] with subject "DEMO Request: Tournament System Script", thank you!

Database Design

database-design-erd

File Structure

β”œβ”€ app/
β”œβ”€β”€β”€ countries/
β”œβ”€β”€β”€β”€β”€β”€ countries_controller.js
β”œβ”€β”€β”€β”€β”€β”€ countries_records.html
β”œβ”€β”€β”€β”€β”€β”€ country.html
β”œβ”€β”€β”€β”€β”€β”€ create_country.php
β”œβ”€β”€β”€β”€β”€β”€ delete_country.php
β”œβ”€β”€β”€β”€β”€β”€ delete_selected_contry.php
β”œβ”€β”€β”€β”€β”€β”€ export_countries_csv.php
β”œβ”€β”€β”€β”€β”€β”€ read_countries.php
β”œβ”€β”€β”€β”€β”€β”€ read_one_country.php
β”œβ”€β”€β”€β”€β”€β”€ update_country.php
β”œβ”€β”€β”€ matches/
β”œβ”€β”€β”€β”€β”€β”€ create_match.php
β”œβ”€β”€β”€β”€β”€β”€ delete_match.php
β”œβ”€β”€β”€β”€β”€β”€ delete_selected_matches.php
β”œβ”€β”€β”€β”€β”€β”€ export_matches_csv.php
β”œβ”€β”€β”€β”€β”€β”€ match.html
β”œβ”€β”€β”€β”€β”€β”€ matches_controller.php
β”œβ”€β”€β”€β”€β”€β”€ matches_records.html
β”œβ”€β”€β”€β”€β”€β”€ read_matches.php
β”œβ”€β”€β”€β”€β”€β”€ read_one_match.php
β”œβ”€β”€β”€β”€β”€β”€ update_match.php
β”œβ”€β”€β”€ shared/
β”œβ”€β”€β”€β”€β”€β”€ app.js
β”œβ”€β”€β”€β”€β”€β”€ dir_pagination.tpl.html
β”œβ”€β”€β”€ teams/
β”œβ”€β”€β”€β”€β”€β”€ create_team.php
β”œβ”€β”€β”€β”€β”€β”€ delete_selected_teams.php
β”œβ”€β”€β”€β”€β”€β”€ delete_team.php
β”œβ”€β”€β”€β”€β”€β”€ export_teams_csv.php
β”œβ”€β”€β”€β”€β”€β”€ read_one_team.php
β”œβ”€β”€β”€β”€β”€β”€ read_teams_by_country.php
β”œβ”€β”€β”€β”€β”€β”€ read_teams.php
β”œβ”€β”€β”€β”€β”€β”€ team.html
β”œβ”€β”€β”€β”€β”€β”€ teams_controller.js
β”œβ”€β”€β”€β”€β”€β”€ teams_records.html
β”œβ”€β”€β”€β”€β”€β”€ update_team.html
β”œβ”€β”€β”€ tournaments/
β”œβ”€β”€β”€β”€β”€β”€ create_tournament.php
β”œβ”€β”€β”€β”€β”€β”€ delete_selected_tournament.php
β”œβ”€β”€β”€β”€β”€β”€ delete_tournament.php
β”œβ”€β”€β”€β”€β”€β”€ export_tournaments_csv.php
β”œβ”€β”€β”€β”€β”€β”€ read_one_tournament.php
β”œβ”€β”€β”€β”€β”€β”€ read_tournaments_by_country.php
β”œβ”€β”€β”€β”€β”€β”€ read_tournament.php
β”œβ”€β”€β”€β”€β”€β”€ tournament.html
β”œβ”€β”€β”€β”€β”€β”€ tournaments_controller.js
β”œβ”€β”€β”€β”€β”€β”€ tournaments_records.html
β”œβ”€β”€β”€β”€β”€β”€ update_tournament.html
β”œβ”€β”€β”€ config/
β”œβ”€β”€β”€β”€β”€β”€ database.php
β”œβ”€β”€β”€ dev/
β”œβ”€β”€β”€β”€β”€β”€ readme.txt
β”œβ”€β”€β”€β”€β”€β”€ tournament_system.sql
β”œβ”€β”€β”€ libs/
β”œβ”€β”€β”€β”€β”€β”€ css/
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ materialize/
β”œβ”€β”€β”€β”€β”€β”€ js/
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ angular.min.js
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ dirPagination.js
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ jquery.js
β”œβ”€β”€β”€β”€β”€β”€ objects/
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ country.php
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ match.php
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ team.php
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ tournament.php
β”œβ”€β”€β”€β”€β”€β”€ index.html

Features List & Download

FEATURESIMPLE PHP TOURNAMENT SCRIPT
Learn more techniques when coding with PHP, MySQL and AngularJSYES
Save your precious time searching about how to do the features below.YES
Single page application (SPA)YES
Material designYES
Create and update forms are in modal / pop-upYES
Action buttons are displayed with iconsYES
MATCHES
Create matchYES
Read matchesYES
Read one matchYES
Update matchYES
Delete matchYES
Delete selected matchesYES
Search matchesYES
Export matches to CSVYES
Matches paginationYES
Matches pagination in search resultsYES
Route to matches section with /tournament-system/#/ in URLYES
When creating or updating a match
Load tournaments based on selected countryYES
Load home teams based on selected countryYES
Load visitor teams based on selected countryYES
Countries drop-down data retrieved databaseYES
Automatically update countries drop-down when countries data were changedYES
Tournaments drop-down data retrieved databaseYES
Automatically update tournaments drop-down when tournaments data were changedYES
Home team drop-down data retrieved databaseYES
Automatically update home team drop-down when home team data were changedYES
Visitor team drop-down data retrieved databaseYES
Automatically update visitor team drop-down when visitor team data were changedYES
Horizontal table scroll were enabled because of several columns needed to be displayedYES
COUNTRIES
Create countryYES
Read countriesYES
Read one countryYES
Update countryYES
Delete countryYES
Delete selected countriesYES
Search countriesYES
Export countries to CSVYES
Countries paginationYES
Countries pagination in search resultsYES
Route to countries section with /tournament-system/#/countries in URLYES
TOURNAMENTS
Create tournamentYES
Read tournamentsYES
Read one tournamentYES
Update tournamentYES
Delete tournamentYES
Delete selected tournamentsYES
Search tournamentsYES
Export tournaments to CSVYES
Tournament paginationYES
Tournament pagination in search resultsYES
Route to tournaments section with /tournament-system/#/tournaments in URLYES
When creating or updating a tournament
Countries drop-down data retrieved databaseYES
Automatically update countries drop-down when countries data were changedYES
TEAMS
Create teamYES
Read teamsYES
Read one teamYES
Update teamYES
Delete teamYES
Delete selected teamsYES
Search teamsYES
Export teams to CSVYES
Teams paginationYES
Team pagination in search resultsYES
Route to teams section with /tournament-system/#/teams in URLYES
When creating or updating a team
Countries drop-down data retrieved databaseYES
Automatically update countries drop-down when countries data were changedYES
UPDATES AND SUPPORT
Free source code updates for 2 yearsYES
Free support for 6 monthsYES
BUY TO DOWNLOAD USING

 

* You can use your debit or credit card with PayPal.

Simple Set Up

If you download this source code. Here are the steps to run it.

1. You have to create your database using PhpMyAdmin
2. Database name is "tournament_system"
3. Import the SQL file called "tournament_system.sql" located in the "dev" folder.
4. You can ask me any questions related to this source code via:
a. Send me an email. My email address is [email protected]
b. Go to https://fb.com/codeofaninja and chat me up.

Thank You!

Thank you for reading about this tournament system script and supporting our projects here at codeofaninja.com!

If you have any questions, comments or suggestions, please do not hesitate to contact me.
a. Send me an email. My email address is [email protected]
b. Go to https://fb.com/codeofaninja and chat me up.

PHP Contact Form Module

simple-php-contact-form-script

Download and learn how this simple PHP Contact Form Script was made. Technologies used include PHP OOP, MySQL, Bootstrap and HTML5.

Script Overview

This source code will enable you to add a 'contact form' feature on your website. This source code is a very good starting point if you're trying to build your own 'Contact Form Script' from scratch and add some more complex features later.

This is because the basis of this source code are our step by step and easy to understand tutorial. Specifically this tutorial: PHP, MySQL and OOP CRUD Tutorial – Step by Step Guide!

The system looks simple. But I assure you that when you study the source code, you will learn a lot of useful PHP coding techniques.

Some include: How to send a message to a valid email address from a web form, use of settings for your contact form, collecting and storing customer messages on your own database, admin restrictions and more! You can see the detailed list of features on section 6.0 below.

Is This Code For Me?

The source code in this page is NOT for you if:

  • You are already an expert in PHP & MySQL programming.
  • You have a lot of time to code the listed features of our PHP contact form script
  • You are not that interested in learning PHP & MySQL programming.

But, this SOURCE CODE is FOR YOU if:

  • You want to SAVE a significant amount of development time.
  • You want to develop your own PHP contact form script from scratch.
  • You determined to learn how to make a this web application feature in PHP & MySQL.
  • You need some guidance in learning about this script (I'll personally support you & answer your questions)

But if you are an expert in PHP & MySQL programming and would like to take a look at our code, please do so! We’d love to hear your response and great insights! The comments section below is always open for anyone with questions and suggestions.

Pre-Requisite

Before you download, please make sure you have basic understanding of the following topics.

a. PHP, MySQL and OOP CRUD Tutorial – Step by Step Guide!
b. Apache .htaccess RewriteRule Examples

Once you learned our tutorials above, this source code should be easy to understand.

Output Preview

Below are some screenshots of our script's output. You can click an image to view the larger version of it.

Please note that the following images are just output previews. New features might be added already the time you are reading this.

[espro-slider id=6269]

Database Design

Our database name will be "php_contact_form", and we will have three tables: Messages, Settings and Users.

database-design-php-contact-form-script

File Structure

The following folders and files are included in our source code. It will have more meaning if you will see the code inside the folders and files.
β”œβ”€ admin/
β”œβ”€β”€β”€ delete_message.php
β”œβ”€β”€β”€ index.php
β”œβ”€β”€β”€ layout_foot.php
β”œβ”€β”€β”€ layout_head.php
β”œβ”€β”€β”€ login_checker.php
β”œβ”€β”€β”€ navigation.php
β”œβ”€β”€β”€ paging.php
β”œβ”€β”€β”€ read_message.php
β”œβ”€β”€β”€ read_message_template.php
β”œβ”€β”€β”€ search_messages.php
β”œβ”€β”€β”€ settings.php
β”œβ”€ config/
β”œβ”€β”€β”€ core.php
β”œβ”€β”€β”€ database.php
β”œβ”€ dev/
β”œβ”€β”€β”€ php_contact_form.sql
β”œβ”€β”€β”€ readme.txt
β”œβ”€ images/
β”œβ”€ libs/
β”œβ”€β”€β”€ css/
β”œβ”€β”€β”€β”€β”€β”€ bootstrap/
β”œβ”€β”€β”€β”€β”€β”€ font-awesome/
β”œβ”€β”€β”€ js/
β”œβ”€β”€β”€β”€β”€β”€ bootbox.min.js
β”œβ”€β”€β”€β”€β”€β”€ custom-script.js
β”œβ”€β”€β”€β”€β”€β”€ jquery.js
β”œβ”€β”€β”€ php/
β”œβ”€β”€β”€β”€β”€β”€ pw-hashing/
β”œβ”€β”€β”€β”€β”€β”€ utils.php
β”œβ”€ objects/
β”œβ”€β”€β”€ message.php
β”œβ”€β”€β”€ setting.php
β”œβ”€β”€β”€ user.php
β”œβ”€ .htaccess
β”œβ”€ contact.php
β”œβ”€ index.php
β”œβ”€ info.php
β”œβ”€ layout_foot.php
β”œβ”€ layout_head.php
β”œβ”€ login.php
β”œβ”€ logout.php
β”œβ”€ navigation.php

What People Say?

Here's what people feel about our work and source code downloads.

Features List & Download - PHP Contact Form Script

FEATUREPHP CONTACT FORM SCRIPT
Learn more techniques when coding with PHP, MySQL and OOPYES
Save your precious time coding and searching about how to do the features below.YES
PHP PDO and Prepared StatementsYES
jQuery enabledYES
Bootstrap enabledYES
Font-awesome enabledYES
Buttons are displayed with appropriate iconsYES
CONTACT FORM
Name fieldYES
Email fieldYES
Subject fieldYES
Message fieldYES
Client side validation (HTML5)YES
Server side validation (PHP)YES
Display contact email from settingsYES
Display contact number from settingsYES
Display contact person from settingsYES
Store customer message to databaseYES
Send message to contact email (email set in the settings)YES
Send confirmation email to customerYES
Sending email can work via localhost using the PhpMailer libraryYES
FORM SECURITY
Uses htmlspecialchars($_SERVER["PHP_SELF"]) for form actionYES
Made sure $_SERVER["REQUEST_METHOD"]=="POST"YES
Sanitize each submitted field with htmlspecialchars(), strip_tags() and trim() functionsYES
Require value for each fieldYES
Show an error message under input fields if value is missingYES
Validate email address formatYES
Keep values in the form if there are any errorYES
MESSAGES
List messages collected from customers using the contact formYES
Display name, subject, sent and action columnsYES
Unread messages in white row backgroundYES
Read messages in gray row backgroundYES
Pagination of messagesYES
Search messages by name, email, subject and message fieldsYES
Read a messageYES
Delete a messageYES
SETTINGS
Setting for contact firstnameYES
Setting for contact lastnameYES
Setting for contact genderYES
Setting for contact emailYES
Setting for contact numberYES
Decide if you'll show contact nameYES
Decide if you'll show emailYES
Decide if you'll show contact numberYES
USER
Login using email and passwordYES
Log out userYES
Hashed password stored in databaseYES
Logged-in user name display on the right side of navigation barYES
Log-out button displayed on drop-down when user name was clickedYES
Messages can be read by logged-in admin.YES
Messages can be deleted by logged-in admin.YES
SUPPORT AND UPDATES
Free support for 6 months.YES
Free source code updates.YES
[purchase_link id="16101" text="DOWNLOAD SOURCE CODE NOW" style="button" color="green"]

Simple Set Up

By now, you were able to download this (PHP Contact Form Script) source code. Here are the few instructions about how to run it.

1. Copy the extracted files to your localhost or upload it to your webserver.

2. You have to create your database using PhpMyAdmin, name of the database: php_contact_form

3. Import the SQL file called "php_contact_form.sql" located in the "dev" folder.

4. Change line 7 .htaccess file (No changes should be made if you put the files on the root directory of your localhost)

RewriteBase /YOUR_ROOT_DIRECTORY/

5. Run the login.php file on your browser, use the following user credentials.

Username: [email protected]
Password: [email protected]

6. To see the contact form, run contact.php

Thank You!

Thank you for reading about this PHP Contact Form Script source code and supporting our projects here at codeofaninja.com!

If you have any questions, comments or suggestions, please do not hesitate to contact me.
a. Send me an email. My email address is [email protected]
b. Go to https://fb.com/codeofaninja and chat me up.

PHP Content Management Module

php-web-page-content-management-system
Looking for PHP Contact Form Script? Click Here.

Download and learn how this simple PHP Web Page Content Management System was made. Technologies used include PHP OOP, MySQL, Bootstrap and jQuery.

Script Overview

This source code will enable you to manage a dynamic web page content. You can format the content the way you want it. Put links, files, images, texts and more on your web page.

The system looks simple. But I assure you that when you study the source code, you will learn a lot of useful PHP coding techniques.

Some include: How to use a rich text editor with a file manager and browser, coding an SEO-friendly web page, file upload and deletion, system user restrictions and more! You can see the detailed list of features on section 6.0 below.

This source code is a very good starting point if you're trying to build your own PHP Web Page Content Management System (CMS) and add some more complex features later.

Pre-Requisite

Before you download, please make sure you have basic understanding of the following topics.

a. PHP, MySQL and OOP CRUD Tutorial – Step by Step Guide!
b. Apache .htaccess RewriteRule Examples

Once you learned our tutorials above, this source code should be easy to understand.

Output Preview

Below are some screenshots of our script's output. You can click an image to view the larger version of it.

Please note that the following images are just output previews. New features might be added already the time you are reading this.

[espro-slider id=5990]

Database Design

Our database name will be "php_web_page_cms", and we will have two tables: Pages and Users.

database-design-php-web-page-content-management-system

File Structure

The following folders and files are included in our source code. It will have more meaning if you will see the code inside the folders and files.
β”œβ”€ admin/
β”œβ”€β”€β”€ create_page.php
β”œβ”€β”€β”€ delete_page.php
β”œβ”€β”€β”€ index.php
β”œβ”€β”€β”€ layout_foot.php
β”œβ”€β”€β”€ layout_head.php
β”œβ”€β”€β”€ login_checker.php
β”œβ”€β”€β”€ navigation.php
β”œβ”€β”€β”€ paging.php
β”œβ”€β”€β”€ remove_featured_image.php
β”œβ”€β”€β”€ search_page.php
β”œβ”€β”€β”€ update_page.php
β”œβ”€ config/
β”œβ”€β”€β”€ core.php
β”œβ”€β”€β”€ database.php
β”œβ”€ dev/
β”œβ”€β”€β”€ php_web_page_cms.sql
β”œβ”€β”€β”€ readme.txt
β”œβ”€ images/
β”œβ”€ libs/
β”œβ”€β”€β”€ css/
β”œβ”€β”€β”€β”€β”€β”€ bootstrap/
β”œβ”€β”€β”€β”€β”€β”€ font-awesome/
β”œβ”€β”€β”€ js/
β”œβ”€β”€β”€β”€β”€β”€ bootstrap-image-gallery/
β”œβ”€β”€β”€β”€β”€β”€ responsive_filemanager/
β”œβ”€β”€β”€β”€β”€β”€ tinymce/
β”œβ”€β”€β”€β”€β”€β”€ bootbox.min.js
β”œβ”€β”€β”€β”€β”€β”€ custom-script.js
β”œβ”€β”€β”€β”€β”€β”€ jquery.js
β”œβ”€β”€β”€ php/
β”œβ”€β”€β”€β”€β”€β”€ pw-hashing/
β”œβ”€β”€β”€β”€β”€β”€ utils.php
β”œβ”€ objects/
β”œβ”€β”€β”€ page.php
β”œβ”€β”€β”€ user.php
β”œβ”€ .htaccess
β”œβ”€ index.php
β”œβ”€ info.php
β”œβ”€ layout_foot.php
β”œβ”€ layout_head.php
β”œβ”€ login.php
β”œβ”€ logout.php
β”œβ”€ navigation.php
β”œβ”€ page.php

Features List & Download - PHP Web Page Content Management System

FEATUREPHP WEB PAGE CMS
Learn more techniques when coding with PHP, MySQL and OOPYES
Save your precious time coding and searching about how to do the features below.YES
PHP PDO and Prepared StatementsYES
jQuery enabledYES
Bootstrap enabledYES
Font-awesome enabledYES
TinyMCE enabledYES
Buttons are displayed with appropriate iconsYES
USER
Login using email and passwordYES
Log out userYES
Hashed password stored in databaseYES
Logged-in user name display on the right side of navigation barYES
Log-out button displayed on drop-down when user name was clickedYES
Page can be edited and deleted by the user who created itYES
When user tries to edit a page he did not created, he will be redirected to home pageYES
'View Page' nagivation bar will show 'Admin' if user is logged in, else it will be a link to login pageYES
CREATE A PAGE
Title fieldYES
Title is shown as page title when shared on FacebookYES
Slug fieldYES
Slug must be unique (validated when form was submitted)YES
Slug is formatted automatically via JavaScript when form not yet was submittedYES
Slug is formatted automatically via PHP when form was submittedYES
Fill out slug field automatically while you typeYES
Fill out slug field automatically when title field loses focusYES
Body fieldYES
Rich text editor using TinyMCE (like WordPress)YES
Upload and browse files using a file managerYES
Format your content with links, texts, images and more.YES
Meta Description fieldYES
Meta Description is shown as page description when shared on FacebookYES
Featured Image fieldYES
Featured Image is shown as page image when shared on FacebookYES
Featured Image allowed file types: JPG, PNG, GIFYES
Featured Image must be less than 1MB in sizeYES
Save Featured Image file in server directoryYES
Status fieldYES
Page 'Status' can be 'Draft' or 'Published'YES
Button link to read pagesYES
Only a logged in user can create a page, else he will be redirected to login pageYES
READ PAGES
Display list of pagesYES
Featured Image columnYES
Title columnYES
Status columnYES
Author columnYES
Created columnYES
Actions columnYES
Featured images can be clicked and shown in a lightboxYES
View page button to view page contentYES
Edit button to update page contentYES
Delete button to delete page contentYES
Clicking 'Delete' button will show confirmation pop upYES
Edit and Delete button will appear only if the logged-in user created that pageYES
Pagination for list of pagesYES
UPDATE A PAGE
Read Pages button to go back to list of pagesYES
Fields has almost the same features as the 'Create Page' section above, but the following are some differecesYES
View Page button to view page contentYES
Fill out form fields with data from database (based on given page ID)YES
Show uploaded featured image (if any) under Featured Image fieldYES
'Remove Featured Image' button under Featured ImageYES
Clicking 'Remove Featured Image' button will show confirmation pop upYES
Featured image can be clicked and shown in a lightboxYES
Highlight Bootstrap radio button based on selected 'Status'YES
'Slug' field is not fill out automatically when 'Title' field was changed. This is because it is not recommended to change a page URL.YES
DELETE A PAGE
Clicking 'Delete' button will show confirmation pop upYES
If user clicked 'No', pop up will disappear and nothing will be deletedYES
If user clicked 'Yes', it will post page ID to delete_page.php so it can be deletedYES
SEARCH PAGES
User can enter search term in search box, then press enter to searchYES
System will search page title, slug, body and meta description for the search termYES
Display list of pages with the search termYES
Pagination in search resultsYES
VIEW PAGE
Show page titleYES
Show featured imageYES
Clicking featured image will show it in a lightboxYES
Show page content / bodyYES
All images in the body can be clicked and shown in a lightboxYES
Show author and date createdYES
Show share buttons with iconsYES
Users can share the page to Facebook, Twitter or Google+YES
'Edit This Page' button will appear under 'Title' if user is logged inYES
SEO-friendly URL. Page URL does not have parameter like page ID. Page content is retrieved by slug.YES
Used Apache .htaccess file to make SEO-friendly URL workYES
Select 'Published' pages in navigation drop-downYES
SUPPORT AND UPDATES
Free support for 6 months.YES
Free source code updates.YES
[purchase_link id="16098" text="DOWNLOAD SOURCE CODE NOW" style="button" color="green"]

Simple Set Up

If you download this (PHP Web Page Content Management System) source code, here are the few instructions how to run this source code:

1. Copy the extracted files to your localhost or upload it to your webserver.

2. You have to create your database using PhpMyAdmin, name of the database: php_web_page_cms

3. Import the SQL file called "php_web_page_cms.sql" located in the "dev" folder.

4. Change line 7 .htaccess file (No changes should be made if you put the files on the root directory of your localhost)
RewriteBase /YOUR_ROOT_DIRECTORY/

5. Run the login.php file on your browser, use the following user credentials.

User #1
Username: [email protected]
Password: [email protected]

User #2
Username: [email protected]
Password: [email protected]

To make TinyMCE file manager / file browser work: (No changes should be made if you put the files on the root directory of your localhost)

Change line 71 of /libs/js/responsive_filemanager/filemanager/config/config.php

'upload_dir' => '/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/source/',


Change line 78-79 of /admin/layout_foot.php

external_filemanager_path:"/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/filemanager/",
external_plugins: { "filemanager" : "/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/filemanager/plugin.min.js"},

Thank You!

Thank you for reading about this PHP Web Page Content Management System source code and supporting our projects here at codeofaninja.com!

If you have any questions, comments or suggestions, please do not hesitate to contact me.
a. Send me an email. My email address is [email protected]
b. Go to https://fb.com/codeofaninja and chat me up.

PHP Product Catalog Module

php-product-catalog-script

Note

Before You Download, make sure you have basic understanding of these topics:

a. PHP Object Oriented CRUD Example with Bootstrap

b. Apache .htaccess RewriteRule Examples with PHP

Features List

FEATUREACCESS LEVELSource Code
USER MANAGEMENT
User type: AdminAdminYes
Interface for adminAdminYes
Login pageAdminYes
Log outAdminYes
PRODUCT MANAGEMENT
Create productAdminYes
Read productsAdminYes
Update productAdminYes
Delete productAdminYes
Search productAdmin & CustomerYes
Product lists with paginationAdmin & CustomerYes
View inactive productsAdminYes
View products under a categoryAdmin & CustomerYes
Product list under a category with paginationAdmin & CustomerYes
Upload product images, you can select many images at onceAdminYes
View product images with thumbnailsAdmin & CustomerYes
Delete product image with X iconAdminYes
Upload product PDFs , you can select many PDF files at onceAdminYes
List product PDFAdminYes
Delete product PDFAdminYes
View single product with related informationCustomerYes
View single product with add to cart buttonCustomerYes
View single product with image sliderCustomerYes
View single product with SEO friendly URL (.htaccess file used)CustomerYes
Rich text editor for product description when adding or editing productAdminYes
Quantity value must be more than 1CustomerYes
Sorting by fieldsAdminYes
CATEGORY MANAGEMENT
Create categoryAdminYes
Read categoriesAdminYes
Update categoryAdminYes
Delete categoryAdminYes
Search categoryAdminYes
Category list with paginationAdminYes
Category search result with paginationAdminYes
View products under a product categoryAdmin & CustomerYes
Auto update category drop down in create or update product formAdminYes
Auto update categories in navigation barAdmin & CustomerYes
Highlight selected category in navigationAdmin & CustomerYes
SECURITY
Login user with hashed password validationCustomer & AdminYes
Used PDO bindParam() to prevent SQL injection in all MySQL queriesDeveloperYes
Used PHP htmlspecialchars() and strip_tags() to prevent XSS attacksDeveloperYes
MORE REASONS TO DOWNLOAD IT
Object oriented programming source codeDeveloperYes
Bootstrap user interfaceDeveloperYes
PDO extension usedDeveloperYes
Page title navigation with linksDeveloperYes
Radio button looks like a switchDeveloperYes
Icon in all create, edit and delete buttonsDeveloperYes
All source code files organized by foldersDeveloperYes
Database configuration file in config folderDeveloperYes
SQL file and READ-ME.txt in β€œsql” folderDeveloperYes
SQL file and READ-ME.txt in "dev" folderDeveloperYes
Database design and data dictionary in "dev" folderDeveloperYes
Free source code updates / new features updateDeveloperYes
Free support for 6 monthsDeveloperYes
Buy once, use for unlimited number of sitesDeveloperYes
One-time payment, no recurring paymentDeveloperYes
[purchase_link id="16092" text="DOWNLOAD SOURCE CODE NOW" style="button" color="green"]

Simple Configuration

Source code simple configuration when you install:

1. This system works with PHP 5.4+

2. In your PhpMyAdmin, create a database "php_product_catalog"

3. Import the SQL file php_product_catalog.sql in the "dev" folder

4. Rewrite module must be enable in your apache server

5. Change rewrite base directory in line 7 of .htaccess file

6. Configure $home_url in /config/core.php

7. Configure database in /config/database.php

8. User Login
Admin Section Login
Username: [email protected]
Password: [email protected]

Thanks For Your Help!

Contact me if you have any questions about the code, I'll be more than happy to help and support you!

My email is [email protected], you can also contact me via our official Facebook page.

Thank you visiting our for PHP Product Catalog Script page!

PHP Shopping Cart Module

PHP Shopping Cart Module

This PHP shopping cart module has features of a shopping cart that works with a logged in user. This is a good starting point of developing your project. You can add your own features that is required for your project.

List of features

Admin features

The table below shows the features an admin can do in the system.

ADMIN FEATURES
User Management
Create, read, update, delete and search users
List users with pagination
Valid email format required
Password must be an uppercase letter, lowercase letter, number, and special character
Confirm password field
Password validation as you type
View customer order history
Deleting the first administrator account is not allowed
Edit profile of currently logged in user
Show name of currently logged in user
Login page and logout function
Product Management
Create, read, update, delete and search users
List products with pagination
View inactive products
View products under a category
List products under a category
Upload product images, you can select many images at once
View product images with thumbnails
Delete product image with the X icon
Upload product PDFs, you can select many PDF files at once
List and delete product PDF
Rich text editor enabled for product description when adding or editing product
Quantity value must be a number and greater than or equal to 1
Sort products by fields
Highlight the selected category in the navigation
Order Management
View pending and completed orders in separate tabs
Change status of an order (pending or completed)
Pagination on the list of orders
The latest order is seen at the top of the list
View details of an order
Auto-compute order totals

Customer features

The table below shows the features a customer can do in the system.

CUSTOMER FEATURES
User Management
Login page and logout function
Password must be an uppercase letter, lowercase letter, number, and special character
Valid email format required
Edit profile of currently logged in customer
Show name of currently logged in user
Product management
Product lists with pagination
Search products with paginated results
View products under a category
Product list under a category with pagination
View product images with thumbnails
Product page with related information, add to cart button, and image slider
View single product with SEO friendly URL (.htaccess file used)
Quantity value must be a number and equal to or greater than one
Highlight selected category in the navigation bar
Order Management
Make an order
Auto-generated unique transaction ID
Add to cart button (for each item) with specified quantity
Cart page with a list of products added to cart
Update quantity button for each item on the cart page
Compute subtotal and grand total on the cart page
Remove from cart button for each item in the cart
Empty cart button to remove all items in the cart
View customer order history with pagination
A checkout page with billing information
Payment via cash on delivery
Place order page – Thank you message
The latest order is seen at the top of the list
View details of an order

Developer features

The table below shows the features that developers like you will like.

DEVELOPER FEATURES
Hashed passwordsΒ stored in the database
Uses PDO bindParam() to prevent SQL injection in all MySQL queries
Uses PHP htmlspecialchars() & strip_tags() to prevent XSS attacks
Object oriented programming source code
Bootstrap user interface
PDO extension used
Radio button looks like a switch
All source code files organized by folders
Database configuration file in "config" folder
SQL file and READ-ME.txt in β€œdev” folder
Free support and code updates for 1 year

Before you download

Make sure you have a basic understanding of the our PHP OOP CRUD Tutorial and .htaccess RewriteRule Examples.

Our source code is provided as-is. We can support only the features listed above. We currently do not accept custom programming job. Thank you for understanding!

Download source code

Please use the button below to download our PHP Shopping Cart Module source code.

What People Say?

Here's what people feel about our work and source code downloads

"Wow, I love you guys! The best web programming tutorial I’ve ever seen. So comprehensive, yet easy to follow. I love how you combine all necessary elements in such a neat structure." ~ Olaug Nessa

"The fact that you’ve put it all together saves so much time and its worth buying the code. Makes me feel good supporting a developer like yourself. Keep up the good work!" ~ Dan Hudson

"Thanks for making these awesome tutorials! I bought your source codes. To be honest, it’s very readable code and helps me understand a lot of things and how it’s done in PHP. Thanks for that again." ~ Michael Lammens

Cart Data Storage

This source code takes advantage of PHP SESSIONS, PHP COOKIES, and MySQL when storing cart data.

  • We use PHP COOKIES to save site visitor's user_id locally.
  • We use PHP SESSIONS as back up just in case cookies are disabled in user's browser.
  • We use MySQL to store cart items in the database.
  • This way, cart items can be resurrected even if user closed his browser, logged out or logged in another computer.

Here's the logic:

IF cookies are enabled, AND if user is logged in, we save 'session user_id' to 'user_id variable'. The value of 'user_id variable' is very important because we use it to save 'user_id' both in PHP 'cookie' and 'session'.

IF cookies are enabled, AND if user is not logged in, AND if user already have a 'cookie user_id' token, we save 'cookie user_id' to 'user_id variable'.

IF cookies are enabled, AND if user is not logged in, AND if 'cookie user_id' is not set (it means, visitor never used the cart before), we get new token as 'user_id variable' value.

IF cookies are enabled, AND user is logged in OR not logged in, we set 'cookie user_id' and 'session user_id' with the final 'user_id variable' value. This will retrieve the cart data with the same 'user_id' from MySQL database.

IF cookies are disabled, AND user is logged in, we maintain 'session user_id'.

IF cookies are disabled, AND user is not logged in, we get new token and save it to 'session user_id'.

Important Note: The statements above can be understood more clearly if you will see the code implementation on /config/core.php line 26 onwards.

Simple Set Up

Source code simple set up when you install:

  1. Extract the ZIP file to your server directory.
  2. In your PhpMyAdmin, create a database "shop_cart_module"
  3. Import the "shop_cart_module.sql" SQL file in the "dev" folder
  4. Change rewrite base directory in line 7 of .htaccess file (if needed)
  5. Change $home_url in /config/core.php (if needed)
  6. Configure database in /config/database.php
  7. Run product.php - this is the main file, not index.php
  8. Admin account
    Username: [email protected]
    Password: [email protected]
  9. Customer account
    Username: [email protected]
    Password: [email protected]

How To Make TinyMCE File Manager / File Browser Work?

1. Change line 71 of /libs/js/responsive_filemanager/filemanager/config/config.php

'upload_dir' => '/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/source/',

2. Change line 42-43 of /admin/layout_foot.php

external_filemanager_path:"/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/filemanager/",
external_plugins: { "filemanager" : "/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/filemanager/plugin.min.js"},

I'll keep you updated via email with the updated information and download link. Download the source code by clicking the green button below. Once your payment was sent, you'll receive the download link in your email.

Need More Features?

If you think you now need more features, you can download our PHP Shopping Cart System instead. It has more features like web page content management, contact form, and more.

Get In Touch

Contact me if you have any questions about the code, I'll be more than happy to help and support you! My email is [email protected], you can also contact me via our official Facebook page.

Please subscribe as well to receive news and updates about our source codes and free tutorials. Fill out the form below.

Thank you for visiting our PHP Online Shopping Cart Source code download page!

PHP Login & Registration Module

php-login-system

This source code is about PHP Login System. It will help you understand how to login and logout functionality works. Sign up email verification, user registration, and forgot password features are included as well.

The basic idea is, we will have two user access levels: the 'Admin' and 'Customer'.

If the 'Customer' is logged in, he can access pages assigned for him to be accessed, like the edit profile and index page for 'Customer'.

If the 'Admin' is logged in, he can create, read list, update, delete and search users. See the full list of features in the table below.

Where's the tutorial? We call this a tutorial because if your download the source code, you can ask me anything related to it. I can personally teach you the code and other tips you need.

That's how we go about it for now. Formal tutorial or documentation of this code is coming soon. I'm currently working on it. Thanks for understanding!

PHP Login System Features

You can see the features and download it below.

FeatureLogin System
Login form with email and passwordYES
PHP Sessions are used to identify logged in and logged out users.YES
Hashed password stored in databaseYES
Register formYES
Password and confirm password fieldsYES
Check if password matchesYES
Sending of verification link to emailYES
Validation page of email linkYES
Check if password is strong enoughYES
Email sending works with remote host only.YES
Redirection to login page if not yet logged inYES
Forgot password pageYES
Password reset link sent to emailYES
Password reset pageYES
Customer access to index page when logged inYES
Customer access to edit profile page when logged inYES
Customer change password pageYES
Customer password and confirm password field when editing profileYES
Customer logoutYES
Admin create userYES
Admin read usersYES
Admin update userYES
Admin delete userYES
Admin change of user access level: Admin or CustomerYES
Admin search user by email addressYES
Admin users list pagingYES
Admin edit profileYES
Admin logoutYES
Admin change password pageYES
Admin can change user passwordsYES
Admin can manually change status of users (pending or approved)YES
Require login in admin index page, edit profile page and users CRUD pages.YES
Bootstrap enabled user interfaceYES
Free support for 6 months.YES
Free source code updates.YES
$50- Download source code

Some Notes

What students say?

Don't just take our word for it. See what our students have to say about our tutorials and source codes. We are proud to have helped many individuals and businesses to build their own applications. Here are a few of the testimonials from our satisfied students.

β˜…β˜…β˜…β˜…β˜… β€œWow, I love you guys! The best web programming tutorial I’ve ever seen. So comprehensive, yet easy to follow. I love how you combine all necessary elements in such a neat structure.” ~ Olaug Nessa

β˜…β˜…β˜…β˜…β˜… β€œThe fact that you’ve put it all together saves so much time and its worth buying the code. Makes me feel good supporting a developer like yourself. Keep up the good work!” ~ Dan Hudson

β˜…β˜…β˜…β˜…β˜… β€œThanks for making these awesome tutorials! I bought your source codes. To be honest, it’s very readable code and helps me understand a lot of things and how it’s done in PHP. Thanks for that again.” ~ Michael Lammens

β˜…β˜…β˜…β˜…β˜… β€œHey Mike, my name is Leonardo from Argentina. I’ve been reading your blog since like 4 months from now, and I really must say: your tutorials are very good, they has helped me in many of my works… Well, thank you very much man. I really admire your work.” ~ Leonardo

β˜…β˜…β˜…β˜…β˜… β€œWords can’t express how grateful I am for the work and the articles you post, had some troubles with doing somethings but your articles as per usual hit the hammer right on the head. They are a great way for expanding upon later too!” ~ Jeremy Smith

Got comments?

At codeofaninja.com, we strive to provide our readers with accurate and helpful PHP Login & Registration Module Your feedback is essential in helping us achieve this goal.

If you have encountered any issues with the code, have suggestions for improvement, or wish to provide praise, we welcome you to leave a comment below. Please be as descriptive as possible to address your concerns effectively and include any relevant error messages, screenshots, or test URLs.

We request that comments remain on-topic and relevant to the article above. If your question or comment pertains to a different topic, we recommend seeking assistance elsewhere.

Furthermore, we ask that you review our code of conduct before commenting to ensure that your feedback is constructive and respectful.

Thank you for taking the time to provide feedback and for supporting codeofaninja.com. Your contributions help us improve our tutorials and serve the developer community better.

Subscribe for FREE!

Improve your web development skills and stay ahead of the competition by subscribing to our tutorial series. Sign up for FREE and access exclusive, cutting-edge content delivered straight to your inbox.

Take advantage of the chance to elevate your skills and advance your web development career. Subscribe now.

Thank You!

We hope you've found our PHP Login & Registration Module helpful and informative. We understand that learning new programming concepts can be challenging, but we're glad we could make it easier for you.

Thank you for choosing to learn with us and for supporting codeofaninja.com! Consider sharing this tutorial with your friends and colleagues who may also be interested in learning about PHP Login & Registration Module

The more people know about our tutorials, the more we can help the developer community grow. Keep learning, keep coding, and keep growing as a developer. We can't wait to see what you'll create next!

Thanks for reading our PHP Login System Tutorial with Admin Features.

PHP PayPal Integration Module

paypal-integration-in-php

This code will solve your problem and answer your question: how to add PayPal and credit card on checkout? You can use this code on your PHP shopping cart script.

PayPal Integration In PHP - Output Preview

You can watch the demo video below to see how the source code works.

Demo is in sandbox (testing) mode, so please use your PayPal sandbox account. You can create a PayPal sandbox account using this PayPal developer link.

How To Set Up / Enable Auto Return?

With Auto Return for PayPal Website Payments, your buyers are redirected back to your site immediately after clicking the Pay button on the Payment Confirmation page. Best choce of web design company for you is royal palm beach web design.

Your buyers enjoy a streamlined checkout experience and are returned back to your site quickly!

Enable Auto Return In Your Test / Sandbox Account.

  1. Log into https://developer.paypal.com
  2. Click Applications
  3. Click Sandbox accounts
  4. Expand the account in question
  5. Click Sandbox site
  6. Login to the test account
  7. Copy and paste "https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments" into your browser
  8. Enable Auto Return and click Save
  9. Enter the Auto Return URL and click Save
  10. If ever you want to do simple marketing strategy locally, go to signmann.com

[Reference]

Setting Up Auto Return On Your Official / Real PayPal Account

  1. Log in and click the Profile subtab under My Account.
  2. Click the Website Payment Preferences link under Selling Preferences.
  3. Click the On radio button to enable Auto Return.
  4. Enter the Return URL. Note: You must meet the Return URL requirements in order to set up Auto Return. Learn more about Return URL.

[Reference]

Download Source Code

It is more convenient if you can just download the complete source code we used and play around with it. There's a small fee in getting the complete source code, it is small compared to the:

βœ” Value or skill upgrade it can bring you, orYES
βœ” Income you can get from your website project or business.YES
βœ” Precious time you save.YES
βœ” Expert advice you can get from us, just in case you have any questions related to the source code.YES

For a limited time, I will give you the source code for a low price. DOWNLOAD THE SOURCE CODE you desire by clicking its the BUY button below.

You can see the features list and download it below.

FeatureAdd On
Pay with PayPalYES
Pay with credit card (via PayPal)YES
Pay with debit card (via PayPal)YES
Set merchant email address / PayPal IDYES
Set currency and currency symbolYES
Set return URL (your site URL when user was done with the payment)YES
Set cancel URL (your site URL when user cancels order)YES
Support automatic redirect to your siteYES
Free support for 6 monthsYES
Free source code updates.YES

THANK YOU!

Thanks for viewing our source code about PayPal Integration In PHP!

If you have any questions, comments or suggestions, please do not hesitate to contact me.
a. Send me an email. My email address is [email protected]
b. Go to https://fb.com/codeofaninja and chat me up.

PHP Shopping Cart System – Download source code


Are you trying to learn how to build your own PHP shopping cart system? Do you need quick guidance and support while doing it? You're in the right place.

Google defines the word "system" as a set of connected parts forming a complex whole. We say this "PHP shopping cart source code" is a "system" because of that definition.

Each module of this source code is designed to be very simple and easy to understand. It is based on our PHP OOP CRUD Tutorial and PHP shopping cart tutorial.

You will be able to build a complex web application before you know it. You'll never get lost. It is your advantage. You can use the same knowledge to build another type of web application.

We are here to help you with anything you do not understand in this source code.

Download and learn how this PHP Shopping Cart System was made. Technologies used include PHP, MySQL, CSS, JavaScript, Bootstrap, Object-oriented programming, and more.

This project is not perfect. It is designed to be simple. This is a very good starting point for your development.

Output Preview

Below are some screenshots of our script’s output. Please note that the following images are just output previews. New features might be added already the time you are reading this.

Index page
Login page
Admin page and menus
User page and menus

Is This Code For Me?

The source code on this page is NOT for you if:

  • You are already an expert in PHP & MySQL programming.
  • You have a lot of time to code the listed features below.
  • You are not really interested in learning PHP & MySQL programming.

But, this source code is FOR YOU if:

  • You want to SAVE a significant amount of development time.
  • You want to develop your own PHP shopping cart system from scratch.
  • You determined to learn how to make a a web application in PHP & MySQL.
  • You need some guidance in learning about this script.

But if you are an expert in PHP & MySQL programming and would like to take a look at our code, please do so! We’d love to hear your response and great insights! The comments section below is always open for anyone with questions and suggestions.

Pre-Requisites

Before you download, make sure you have a basic understanding of these topics:

Features

Admin features

The table below shows the features an admin can do in the system.

ADMIN FEATURES
User Management
Create, read, update, delete, and search users with pagination
Deleting the first administrator account is not allowed
Valid email format required
Password must be an uppercase letter, lowercase letter, number, and special character
Confirm password field
Password validation as you type
View customer order history
Login page, sign up page, logout user
Edit profile of currently logged in user
Show name of currently logged in user
Forgot password page – the system can send unique reset password link via email
Reset password page – user can click the unique verification link and reset his password
Product Management
Create, read, update, delete, and search products with pagination
View inactive products
View products under a category with pagination
Upload product images, you can select many images at once
View product images with thumbnails
Delete product image with the X icon
Upload product PDFs, you can select many PDF files at once
List and delete product PDF
Rich text editor for product description when adding or editing product
Sorting by fields
Variation Management
Set variation name, price, and stocks
Stocks or inventory decreases when an order has been placed
Increase stock by updating the variation
Create, read, update, and delete variations
Category Management
Create, read, update, delete, and search categories with pagination
View products under a product category
Auto-update category drop-down in create or update product form
Auto-update categories in the navigation bar
Highlight the selected category in the navigation
Order Management
View order history of a customer
View pending and completed orders in separate tabs
Pagination on the list of orders
Latest order is seen at the top of the list
View details of an order
Compute the total cost of the order
Change status of an order (pending or completed)
Web Page Management
Create, read, update, delete, and search web pages with pagination
Pages search result with pagination
Rich text editor enabled
Contact Management
Display list of messages with pagination
Read and delete a message
Message list with pagination
Search message with pagination

Customer features

The table below shows the features a customer can do in the system.

CUSTOMER FEATURES
User Management
Valid email format required
Password must be an uppercase letter, lowercase letter, number, and special character
Confirm password field
Password validation as you type
Login page, signup page, and logout function
Edit profile of currently logged in user
Show name of currently logged in user
Forgot password – the system can send unique reset password link via email
Forgot password – user can click the unique verification link and reset his password
Product Management
Search products with pagination
View products under a category with pagination
View product images with thumbnails
View single product with related information, add to cart button, and image slider
Product page with SEO friendly URL (.htaccess file used)
Quantity value must be a number equal to or greater than 1
Category Management
View products under a product category
Highlight selected category in the navigation bar
Order Management
Make an order
Auto-generated unique transaction ID
Add to cart button (for each item) with specified quantity
Cart page with a list of products added to cart
Update quantity button for each product in cart
Compute total and grand total on the cart page
Remove from cart button for each product in the cart
Empty cart button to remove all products in the cart
View order history
A checkout page with billing information
Edit billing information button on the checkout page
Show payment information on the checkout page
Payment via cash on delivery or PayPal
Place order page – Thank you message
View list of orders with pagination
View details of an order
Web Page Management
Read web pages created by the admin
Contact Management
Send a message to Admin
Display other ways to contact Admin

Developer features

The table below shows the developer features of the source code.

Object-oriented programming source code
Bootstrap user interface
PDO extension used
Source code files organized by folders
The database configuration file in the config folder
One-time payment, no recurring payment
Hashed password stored in the database
Login user with hashed password validation
Used PDO bindParam() to prevent SQL injection attacks
Used PHP htmlspecialchars() to prevent XSS attacks
Free support and updates for 1 year

Download source code

Download our source code based on how many times you plan on using it. You can choose to download "1 website" if you're using this only once. You can also choose the 5 or 10 websites options.

What People Say

Here are some of the things people say about our source code downloads.

"Wow, I love you guys! The best web programming tutorial I’ve ever seen. So comprehensive, yet easy to follow. I love how you combine all necessary elements in such a neat structure." ~ Olaug Nessa

"The fact that you’ve put it all together saves so much time and its worth buying the code. Makes me feel good supporting a developer like yourself. Keep up the good work!" ~ Dan Hudson

"Thanks for making these awesome tutorials! I bought your source codes. To be honest, it’s very readable code and helps me understand a lot of things and how it’s done in PHP. Thanks for that again." ~ Michael Lammens

Cart Data Storage

This source code takes advantage of PHP SESSIONS, PHP COOKIES, and MySQL when storing cart data.

  • We use PHP COOKIES to save the site visitor's user_id locally.
  • We use PHP SESSIONS as back up just in case cookies are disabled in the user's browser.
  • We use MySQL to store cart items in the database.
  • This way, cart items can be resurrected even if the user closed his browser, logged out or logged in another computer.

Here's the logic:

IF cookies are enabled, AND if user is logged in, we save 'session user_id' to 'user_id variable'. The value of 'user_id variable' is very important because we use it to save 'user_id' both in PHP 'cookie' and 'session'.

IF cookies are enabled, AND if user is not logged in, AND if user already have a 'cookie user_id' token, we save 'cookie user_id' to 'user_id variable'.

IF cookies are enabled, AND if user is not logged in, AND if 'cookie user_id' is not set (it means, visitor never used the cart before), we get new token as 'user_id variable' value.

IF cookies are enabled, AND user is logged in OR not logged in, we set 'cookie user_id' and 'session user_id' with the final 'user_id variable' value. This will retrieve the cart data with the same 'user_id' from MySQL database.

IF cookies are disabled, AND user is logged in, we maintain 'session user_id'.

IF cookies are disabled, AND user is not logged in, we get new token and save it to 'session user_id'.

Important Note: The statements above can be understood more clearly if you will see the code implementation on /config/core.php line 26 onwards.

Database Design

Our database name will be "shop_cart_complete", and we will have twelve (12) tables.
database-design-php-shopping-cart-source-code

Simple Set Up

You can run this source code successfully with a few easy steps.

Run the Home Page

I assume you are installing this source code on localhost. In my case, I installed this code in this directory:

The reason for these multiple folders is that I have many projects and I need to organize them this way. I can access the system in this URL: http://localhost/CodeOfaNinja/SourceCodes/Systems/ShoppingCartSystem/

You will see an error, that's why we need to do the following steps.

1. In your PhpMyAdmin, create a database with the name "shopping_cart_system".

2. Import the "shopping_cart_system.sql" SQL file from the "dev" folder.

3. Change the rewrite base directory in line 7 of the .htaccess file.

RewriteBase RewriteBase /CodeOfaNinja/SourceCodes/Systems/ShoppingCartSystem/

4. Configure $home_url in line 72 of /config/core.php

$home_url = "http://localhost/CodeOfaNinja/SourceCodes/Systems/ShoppingCartSystem/";

5. Configure database in /config/database.php, example settings would look like:

// specify your own database credentials
private $host = "localhost";
private $db_name = "shopping_cart_system";
private $username = "root";
private $password = "";
public $conn;

6. Try to log in by running the login page.

http://localhost/CodeOfaNinja/SourceCodes/Systems/ShoppingCartSystem/login

Use the following login credentials.

Admin Section Login
Username: [email protected]
Password: [email protected]

Customer Account Login
Username: [email protected]
Password: [email protected]

How To Set Up / Enable Auto Return?

With Auto Return for PayPal Website Payments, your buyers are redirected back to your site immediately after clicking the Pay button on the Payment Confirmation page.

Your buyers enjoy a streamlined checkout experience and are returned back to your site quickly!

1. Enable Auto Return In Your Test / Sandbox Account.

  1. Log into https://developer.paypal.com
  2. Click Applications
  3. Click Sandbox accounts
  4. Expand the account in question
  5. Click Sandbox site
  6. Login to the test account
  7. Copy and paste "https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments" into your browser
  8. Enable Auto Return and click Save
  9. Enter the Auto Return URL and click Save

[Reference]

2. Setting Up Auto Return On Your Official / Real PayPal Account

  1. Log in and click the Profile subtab under My Account.
  2. Click the Website Payment Preferences link under Selling Preferences.
  3. Click the On radio button to enable Auto Return.
  4. Enter the Return URL. Note: You must meet the Return URL requirements in order to set up Auto Return. Learn more about Return URL.

[Reference]

3. How To Disable Sandbox Mode?

This source code is in sandbox mode by default, it means any PayPal transactions are for testing purposes only. To disable the PayPal Sandbox mode:

Open /libs/php/paypal_checkout.php

Change line 51, from

$form='<form id="paypal_checkout" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">';

to

$form='<form id="paypal_checkout" action="https://www.paypal.com/cgi-bin/webscr" method="post">';

Change the email address (line 5) to your real PayPal account email address. Payment will be sent to the specified PayPal account.

How To Make TinyMCE File Manager / File Browser Work?

1. Change line 71 of /libs/js/responsive_filemanager/filemanager/config/config.php

'upload_dir' => '/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/source/',

2. Change line 42-43 of /admin/layout_foot.php

external_filemanager_path:"/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/filemanager/",
external_plugins: { "filemanager" : "/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/filemanager/plugin.min.js"},

Some More Notes

1. This system works with PHP 5.5+

2. Rewrite module must be enabled in your apache server (this is enabled by default in most web servers and localhost)

Get In Touch

Contact me if you have any questions about the code, I'll be more than happy to help and support you! My email is [email protected].

Please subscribe as well to receive news and updates about our source codes and free tutorials. Fill out the form below. CLICK HERE TO SUBSCRIBE!

Thank you for visiting our PHP shopping cart source code download page!