samedi 27 juin 2020

PHP - Not to execute specific code on specific page

I have one common page: default.php

<?php 

________Some Codes________

?>

And my project has 100+ .php files. (Yes all files have require_once 'default.php'; on the first line of all pages)

Now, I am deciding to display alert in all the files except 2. (say 1.php & 2.php).

Of course, I'll add that alert in my default.php.

So now my default.php will look like:

<?php

________Some Codes_______


echo $comn_alert = "<script>alert('Hi');</script>";

?>

Question:

How can I stop $comn_alert from executing on 1.php & 2.php?

Aucun commentaire:

Enregistrer un commentaire