ClassiPHPied – Open Source PHP Classified System

ClassiPHPied is a very simple PHP Classified Ads System. Yes, this is not a “we have a load of features, but you won’t even use half of them” kind of system. This is just a basic one, with the raw essentials to you started quickly – Be it for a small business, or expanding on top of it.

 

TABLE OF CONTENTS

Download & Notes How To Use Quick Reference
How To Develop Common Problems

 

 

DOWNLOAD & NOTES

First, here are the download links and a quick “setup guide” for the impatient folks who don’t have the patience to read through everything.

 

REQUIREMENTS

  • Apache Mod Rewrite
  • PHP PDO Extension
  • Best to have at least PHP 7.4
  • “Grade A” browser

ClassiPHPied has not been extensively tested, but it is developed and works on a WAMP8 (Apache MySQL PHP 8) server.

 

INSTALLATION

Just access your website and walk through the installer.

 

 

LICENSE & DOWNLOAD

ClassiPHPied is released under the MIT License. You are free to use it for your own personal and commercial projects, modify it as you see fit. On the condition that there the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.

Download ClassiPHPied | GitHub | SourceForge

 

HOW TO USE

So far so good? Let us now go through a quick crash course on how to use ClassiPHPied.

 

STEP 1) REGISTER CATEGORIES

Go to the “Manage Categories” section, register all your categories – Vehicles, jobs, properties, and whatever else you want.

 

STEP 2) UPLOAD IMAGES

Next, go to the “Manage Images” section and upload all your images.

 

 

STEP 3) CREATE CLASSIFIED ADS

Lastly, go to the “Manage Classifieds” section, register all the ads.

 

DONE!

That’s all! Head back to the front end and verify the listings.

 

QUICK REFERENCE

This section is for the developers, a quick walkthrough of the general system structures.

 

FOLDER STRUCTURE

  • api API handlers.
  • assets Public images, CSS, Javascript, and whatever else.
  • lib Core library files.
  • pages HTML pages.

Yes, there are only 4 folders in the entire system.

 

 

THE DATABASE

categories – Classified Categories
Field Description
cat_id Category ID, primary key.
cat_name Category name.
cat_desc Category description, if any.
classifieds – Classified Ads
Field Description
cla_id Classified ID, primary key.
cla_title Title (255 characters max).
cla_summary A short summary (255 characters max).
cla_text The body text.
cla_person Contact person (or company).
cla_email Contact email.
cla_tel Contact telephone number.
cla_images – Classified Ad Images
Field Description
cla_id Partial primary key and foreign key.
slot_id
Partial primary key.
img_file
Image file attached to the ad.
cla_to_cat – Classified To Category
Field Description
cla_id Partial primary key and foreign key.
cat_id
Partial primary key and foreign key.
users – The Users
Field Description
user_id The user ID, primary key.
user_name
The user name.
user_email
The user’s email address.
user_password
The password. Encrypted.

 

 

THE FRAMEWORKS & CREDITS

ClassiPHPied is built using:

Go ahead and check those out if you want… The other “pre-developed” modules of Core Boxx should also snap right in.

 

DEVELOPING CLASSIPHPIED

As simple as it may be, going through the entire system is still going to take some time. So instead of “explaining line-by-line”, here is a condensed version of “how to quickly customize and upgrade”.

 

STEP 1) CREATE/MODIFY DATABASE TABLES

Add your new tables or views, modify the existing ones.

 

STEP 2) ADD/UPDATE SYSTEM MODULE

core/LIB-Report.php
class Report extends Core {
  function getNewClassifieds () {
    return $this->DB->fetchAll(
      "SELECT * FROM `classifieds` ORDER BY `cla_date` DESC LIMIT 0, 20",
      null
    );
  }
}

To add a new module, create lib/LIB-Module.php. Define class Module extends Core, and add functions inside. In this example, we add a new report module – lib/LIB-Report.php and class Report extends Core.

That’s all. This new module can now be loaded via $_CORE->load("Report") and the function can be accessed via $_CORE->Report->getNewClassifieds().

 

STEP 3) ADD/UPDATE API ENDPOINT (OPTIONAL)

api/API-report.php
// (A) MUST BE SIGNED IN
if ($_USER===false) {
  $_CORE->respond("E", "Please sign in first", null, null, 403);
}
 
switch ($_REQ) {
  // (B) INVALID REQUEST
  default:
    $_CORE->respond(0, "Invalid request", null, null, 400);
    break;
 
  // (C) GET NEW CLASSIFIEDS REPORT
  case "getNewClassifieds":
    $_CORE->autoGETAPI("Report", "getNewClassifieds");
    break;
}

Create api/API-Module.php. For this example, access http://site.com/Report/getNewClassifieds/ to get the report – The API will reply with a JSON encoded string.

 

STEP 4) ADD/UPDATE HTML CSS JAVASCRIPT

  • Add your new pages in pages/.
    • For example, pages/PAGE-about.php will be accessed from http://site.com/about.
    • For admin pages, it is pages/APAGE-report.php and http://site.com/admin/report instead.
    • Take note – APAGE-name.php can only be accessed by users who are signed in.

That’s about it. Just reverse engineer and copy from the existing libraries, API, and pages… You will see the development pattern here.

 

 

COMMON PROBLEMS & FIXING THEM

Storage Boxx is “not working”? Here are a few of the common problems and how to “fix” them.

 

I FORGOT THE PASSWORD OR DELETED ALL ADMIN ACCOUNTS

recover.php
require "lib/GO.php";
$_CORE->load("Users");
$_CORE->Users->save("NAME", "EMAIL", "PASSWORD", OPTIONAL-USER-ID);

Just create an “account recovery” script to create a new account (or update an existing one). Run and delete this afterward.

 

MIGRATING TO A NEW DOMAIN OR CHANGING THE URL PATH

  • Simply update URL_BASE in lib/GO.php.
  • Update the path in /.htaccess and /api/.htaccess if necessary.
  • Clear the browser cache to prevent irritating cache redirects.

 

MANUAL INSTALLATION

  • Create a database and import lib/classiphpied.sql.
  • Rename lib/GO.foo to lib/GO.php.
  • Open lib/GO.php, update the settings to your own.
    • (A2) The host settings.
    • (A3) Database settings.
    • (A4) If you want to develop mobile apps, consider enabling CORS.
    • (A6) Generate your own secret key, set the issuer to your domain or company name.
  • You will need to manually create /.htaccess and /api/.htaccess. Open index.php – Check out (D7) and (D8).
  • Delete the installer script index.php… Or just move it somewhere else.
  • Rename index.foo to index.php.
  • Create your own admin user, see “forgot password” above.

 

NOT WORKING. DON’T KNOW WHY.

Open the developer’s console, reload the page and see the error message.

How To Debug Javascript – A Very Simple Guide

How to Debug PHP Code – A Very Simple Guide

Leave a Comment

Your email address will not be published. Required fields are marked *