ClassiPHPied is a simple PHP Classified Ads System. This is not a “we have a load of features, but you won’t even use half of them” kind of system. Just a basic one, with the essentials to help you get started quickly – Be it for a small business, or expanding on top of it.
TABLE OF CONTENTS
DOWNLOAD & INSTALLATION
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.
LICENSE & DOWNLOAD
ClassiPHPied is released under the MIT License. You are free to use it for personal and commercial projects, and modify it as you see fit. On the condition that 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.
SORRY FOR THE ADS...
But someone has to pay the bills, and sponsors are paying for it. I insist on not turning Code Boxx into a "paid scripts" business, and I don't "block people with Adblock". Every little bit of support helps.
Buy Me A Coffee Code Boxx eBooks
REQUIREMENTS
- LAMP/WAMP/MAMP/XAMPP
- Apache Mod Rewrite
- PHP MYSQL PDO Extension
- PHP OpenSSL Extension
- At least PHP 8.0
INSTALLATION
Just access http://your-site.com
in your browser and walk through the installer. Login at http://your-site.com/admin
.
HOW TO USE
So far so good? Let us now go through a quick crash course on how to use ClassiPHPied.
[web_stories_embed url=”https://code-boxx.com/web-stories/classiphpied/” title=”ClassiPHPied Quickstart” poster=”https://code-boxx.com/wp-content/uploads/2023/06/STORY-PROJ-20230610.webp” width=”360″ height=”600″ align=”center”]
Fullscreen Mode – Click Here
CLASSIPHPIED FAQ
ClassiPHPied is “not working”? Here are a few of the common problems and how to “fix” them.
I DELETED ALL ADMIN ACCOUNTS
require "lib/CORE-Go.php";
$_CORE->load("Users");
$_CORE->Users->save("NAME", "EMAIL", "PASSWORD");
Just create an “account recovery” script to create a new account (or update an existing one). Run and delete this afterward.
CHANGED DOMAIN OR PATH
- Update
HOST_BASE
inlib/CORE-Config.php
. Make sure to include the path (with a trailing slash) if not deployed at the base URL. E.G.http://site.com/classiphpied/
- Delete the existing
.htaccess
file. - Create
init.php
.require "lib/CORE-Go.php";
$_CORE->Route->init();
- Access
http://site.com/init.php
, this will automatically regenerate the.htaccess
file. - Delete
init.php
. - Clear the service worker and browser cache if you want to be “totally safe”.
PAGES ARE NOT RESOLVING OR SHOWING PROPERLY
- Make sure that
MOD_REWRITE
is enabled in Apache. - Make sure that
AllowOverride
is set properly in Apache. - If using
https://
, make sure that your SSL cert and virtual host are properly set. - In Mac/Linux, make sure that Apache/PHP has permission to read the files and folders.
Here is a quick “working example” of a test site on my WAMP server:
<VirtualHost site.com:443>
DocumentRoot "D:\http"
ServerName site.com:443
SSLEngine On
SSLCertificateFile "C:/xampp/apache/conf/ssl.crt/server.crt"
SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"
<Directory "D:\http">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
MANUAL INSTALLATION
- Create a database and import all
lib/SQL-*.sql
in ascending order. - Open
lib/CORE-Config.php
, update the settings to your own.- The host settings.
- Database settings.
- If you want to develop mobile apps, consider enabling CORS.
- Set your own JWT secret key, and the issuer to your domain or company name.
- Run
$_CORE->Route->init()
to create.htaccess
. - Create your own admin user. See “deleted all admin accounts” above.
- Update
index.php
.require __DIR__ . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "CORE-Go.php";
$_CORE->load("Route");
$_CORE->Route->run();
I WANT TO CHANGE THE DATE FORMAT
Login > under system settings section > there are 4 “MYSQL date/time format” settings, change them accordingly. These are simply formats for the MYSQL DATE_FORMAT()
function.
NOT WORKING. DON’T KNOW WHY.
Open the developer’s console, reload the page and see the error message.
UNABLE TO GENERATE JSON WEB TOKEN KEYS
Make sure that your OpenSSL is properly installed.
- Linux
- It is as simple as
sudo apt-get install openssl
. - Or
yum install openssl
for the CentOS users. - Then,
php -i | grep -i openssl
.
- It is as simple as
- Windows – I am using XAMPP and OpenSSL is already included. But a hiccup got me stumped for a while.
- Start > Search for “system environment” > “Edit the system environment variables” > “Environment variables”.
- Add a new system variable called
OPENSSL_CONF
and point it to theopenssl.cnf
file. By default, it is located atxampp\php\extras\openssl\openssl.cnf
.
QUICK REFERENCE & DEVELOPMENT
This section is for the developers, a quick walkthrough of the general system structures.
BUILT ON CORE BOXX
Yep, Classified is built on Core Boxx. At least go through the very short 4 steps tutorial here.
FOLDER STRUCTURE
assets/
Public images, Javascript, CSS, etc…lib/
Core engine and library files.API-AAA.php
The API endpoints. Will be deployed athttp://site.com/api/AAA/
.CORE-CCC.php
Core engine files. Try not to mess with these.HOOK-HHH.php
Hooks to modify the behavior of some modules.LIB-LLL.php
Library files.SQL-SSS.php
SQL database files. Can actually delete these after installation.
pages/
HTML pages and template.PAGE-PPP.php
“Normal” pages. Will be deployed athttp://site.com/PPP/
.ADM-AAA.php
Protected admin pages. Will be deployed athttp://site.com/admin/AAA/
.TEMPLATE-TTT.php
HTML page template.MAIL-MMM.php
Email templates.
THE FRAMEWORKS
ClassiPHPied is built with:
- Bootstrap and Google Material Icons
- PHP JSON Web Token
- TinyMCE
- Core Boxx modular PHP framework.
- Core Boxx Users Module
- Heavily modified Core Boxx Dynamic Content module.
DATABASE TABLES
USERS
Field | Description |
user_id |
The user ID, primary key. |
user_level |
“U” for users, and “A” for admin. |
user_name |
The user name. |
user_email |
The user’s email address. |
user_password |
The password. Encrypted. |
Field | Description |
user_id |
User ID, primary and foreign key. |
hash_for |
“A” for account activation, “P” for password reset. |
hash_code |
Random hash code. |
hash_time |
Timestamp. For expiry and anti-spam. |
hash_tries |
Use this to limit the number of tries, or dish out “strikes”. |
SYSTEM
Field | Description |
setting_name |
Primary key. |
setting_description |
Description of the setting. |
setting_value |
The value of the setting. |
setting_group |
Setting group.
|
CLASSIFIEDS
Field | Description |
cat_id |
Category ID, primary key. |
parent_id |
Parent ID.
|
cat_name |
Category name. |
cat_desc |
Category description, if any. |
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_date |
Date when the ad is posted. |
cla_end |
Date when the ad expires. |
cla_person |
Contact person (or company). |
cla_email |
Contact email. |
cla_tel |
Contact telephone number. |
Field | Description |
cla_id |
Partial primary key and foreign key. |
slot_id |
Partial primary key. |
img_file |
Image file attached to the ad. |
Field | Description |
cla_id |
Partial primary key and foreign key. |
cat_id |
Partial primary key and foreign key. |
– lib/API-report.php
Why don’t you use (PHP 8) match ($_REQ), instead of switch ($_REQ)?
1) Match only does single-line expressions.
2) Backward compatibility.
3) If it’s not broken, don’t fix it. 😆
In lib/API-report.php, you’re just using single-line expressions. So, it would be:
match ($_REQ) {
“getNewClassifieds” => $_CORE->autoGETAPI(“Report”, “getNewClassifieds”),
default => $_CORE->respond(0, “Invalid request”, null, null, 400)
}
If there’s something better, use it! 😆
Match is not “better” in a few ways here –
1) Not every API handler across all my projects is a single line.
2) As an open source, match will only limit the customizations people can do to their API.
3) Supposedly, all API endpoints use match. Some form of “hooks” will have to be introduced into the “autoAPI” functions to handle customizations. That adds complexity and doesn’t help at all.
So yep. New is not always better. 🙂
First of all, this is great! Thank you. Got it working with the install script very easily on my local xampp server. Trying to install it on a live server, I am able to follow the steps until I reach:
run ‘$_CORE->Route->init() to create .htaccess. ‘
I have no idea where to ‘run’ this ~ is this through SSH? Sorry if it seems like a waste-of-time question, but I cannot find solutions online. I dont have a lot of XP working with .htaccess
Regards
FAQ updated, see above… You don’t actually need to regenerate
.htaccess
if the path remains the same, just changeHOST_BASE
and database settings in the config file. E.G. Migrating fromlocalhost/ads
tosite.com/ads
Whoops. I missed it. Thank you for pointing it out to me, and thanks for sharing this with us! I love your work.
It happened… Again…
Unable to connect to database – SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO)
As it is. Access and permission issues on your server. Read up on basic MYSQL account management on your own.
https://code-boxx.com/faq/#help “Answers can be found all over the Internet”
Preview of this software?
https://code-boxx.com/faq/#nodemo
its showing fetch error why??
EDIT: Small bug in the installer addressed,
HOST_BASE
is not updated properly.