Html5 Contact Form & Contact Us Page Templates PHP 8

Html5 Contact Form & Contact Us Page Templates PHP 8


Fixing the Deprecated __autoload() Function

1. Locate the PHP File

  • Find the PHPMailerAutoload.php file in your TestLink installation directory.

    • It should be in: C:\xampp\htdocs\testlink\third_party\phpmailer\PHPMailerAutoload.php

2. Modify the Deprecated Function

  • Replace this code:

    function __autoload($classname) { PHPMailerAutoload($classname); }
  • With this updated version:

    spl_autoload_register(function ($classname) { PHPMailerAutoload($classname); });
  • This change ensures compatibility with PHP versions 5.3 and newer.

3. Restart Apache

  • Stop and start the Apache server in XAMPP to apply the changes.

4. Verify the Fix

  • Reload the TestLink login page and ensure there’s no blank page or error message.

Fixing Issues in Your PHPMailer Implementation

Your contact form is using PHPMailer, but there are a few areas for improvement:

1. Security Issue: Avoid Hardcoding Credentials

  • Instead of:

    $mail->Username = "Your mail"; $mail->Password = 'Your password mail';
  • Use environment variables (.env) to store credentials securely.

2. Fix the Contact Form Submission

  • The form is missing method="POST" The button does not have a name="submit" attribute.

Fix: Update the form tag like this:

<form class="contact1-form validate-form" method="POST">

And add the name="submit" attribute to the button:

<button class="contact1-form-btn" name="submit">

3. Debugging PHPMailer Errors

  • Add error debugging to capture SMTP issues:

    $mail->SMTPDebug = 2; // Set to 0 for production

More Information

  • What PHP version are you using? You can check with:

    phpinfo();
  • Is your TestLink installation up to date?

Soeng Souy

Soeng Souy

Website that learns and reads, PHP, Framework Laravel, How to and download Admin template sample source code free.

1 Comments

CAN FEEDBACK
  1. batcha
    batcha
    Wow! It is a great coding Thank you!
close