DEV Community

Cover image for PHP Phone Book
ramoures
ramoures

Posted on • Edited on • Originally published at github.com

PHP Phone Book

php phonebook admin panel


Demo

UTC Timezone

username: admin
password: 123

Setup

  • 1.Clone or download: GitHub Repository
  • 2.Create a new MySQL database.
  • 3.Set your database information and your PROJECT_URL in config.php.
  • 4 & 5:
  • 4.Browse /setup to create the required tables and admin sign up.

Ex. https://localhost/PHP-Phone-Book/setup/

  • 5.Remove /setup directory.

OR

  • 4. Remove /setup directory.
  • 5. IMPORT php_phone_book.sql to your database table.

The username added after import is: admin , password: 123

  • 6.Set media directory permission to 777.

    sudo chmod -R 777 media


Requirement

  • Apache HTTP web server.
  • MySQL database
  • PHP ^8.2.4
  • Apache module mod-rewrite must be enabled.
  • mysqli, mysqlnd, pdo ,pdo_mysql PHP extensions must be enabled.

To check the above: <?php phpinfo(); ?> - PHPInfo

  • allowOverride must be set to All in the Apache configuration file.

Information

  • HTTP Server: Apache
  • Programming language: PHP 8.2.4
  • Programming paradigm: OOP
  • Architectural patterns: MVC
  • Template engine: TWIG 3.0
  • Database: MySQL
  • Licensed under MIT

I used:

  • URL Routing methods.
  • TWIG template engine.
  • PDO & Prepared Statements MySQL Connection.
  • Singleton design patterns for some required classes.
  • Multi language suppourt.
  • Many options for configuration. config.php
  • Sorting and pagination of items.
  • Client and server side captcha for sign in form.

    Optional config: Google reCaptcha or Cloudflare Turnstile

  • Errors handling method.

  • Bootstrap and jQuery.


HELP

Solutions

Enable the apache module mod_rewrite

$ sudo a2enmod rewrite

Set config allowOverride All

Edit the Apache config file:

$ cd /etc/apache2

$ sudo nano apache2.conf

Find:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
Enter fullscreen mode Exit fullscreen mode

And change it to:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
Enter fullscreen mode Exit fullscreen mode

/var/www/ : your root directory.

Press Ctrl + o (for save), then Ctrl + x (for exit).

Then,

$ sudo systemctl restart apache2

Apache mod_rewrite module


Add new language

  1. Create your language file in the lang folder.

Ex. fr.php or ar.php and develop similar to lang/fa.php.

  1. Add your new language for frontend pages.
<!-- Example: -->
<div class="changeLanguage">
     <button id="fr">Fr</button>
     <button id="en">En</button>
</div>
<!-- Look at: .changeLanguage click function on view/assets/js/app.js or backend.js  -->
Enter fullscreen mode Exit fullscreen mode

E-Mail: ramoures@gmail.com

Latest comments (8)

Collapse
 
reza_mard profile image
Reza Mard

سلام
ممنون از برنامه خوبی که نوشتی کار جالبی هست
یه سوال آیا امکان اضافه کردن کاربر وجود داره یا بشه کاربر اضافه کرد و اونم شماره ادد کنه

Collapse
 
ramoures profile image
ramoures

درود و سپاس از توجه شما.
خیر؛ متاسفانه همچنین امکانی وجود ندارد.

Collapse
 
rassul_gahramanzadeh_88ec profile image
Info Comment hidden by post author - thread only accessible via permalink
Rassul Gahramanzadeh

سلام و عرض ادب - مهندس پروژه دفترچه تلفن شما واقعا عالی هست فقط من به چند مورد برخورد کردم خوشحال میشم راهنمایی بفرمایید

  1. سرچ در پنل ادمین و صفحه اصلی کار نمی کند
  2. بعد از اضافه کردن یک مورد پیغام خطا مبنی بر تلاش دوباره میدهد ولی مورد به دیتابیس اضافه میشود و در صفحه نمایش داده میشود
  3. تغییر زبان غیرفعال است و با کلیک روی ان عملا هیچ اتفاقی نمیافتند مانند سرچ
Collapse
 
ramoures profile image
ramoures

درود. موارد را بررسی و ایرادهای احتمالی را برطرف خواهم کرد. سپاس برای دانلود، بررسی و گزارش ایراد⚘️

Collapse
 
rassul_gahramanzadeh_88ec profile image
Comment deleted
Thread Thread
 
ramoures profile image
ramoures • Edited

مواردی که اشاره کرده بودید را بررسی کردم و ایرادی در برنامه مشاهده نکردم.
باید در روند انتقال برنامه به سرویس خودتان و نحوه‌ی راه‌اندازی شما اشتباهی رخ داده باشد.
ایراد را در مورد زیر بیابید:

در لینکی که فرستاده‌اید فایلهای جاوااسکریپت موجود در پوشه‌ی مسیر:
view/assets/js
خوانده نمی‌شوند و با خطای ۴۰۳ مواجه هستند. همین مساله باعث تمام مشکلاتی است که ذکر کرده بودید.

Image description

سپاس

Collapse
 
cyberfiducia profile image
CyberFiducia

Well done. Just checked this out. Clean and simple.

Collapse
 
blossom profile image
Blossom Babs

This is such a fun project

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more