Can't get the following error handlers to be displayed to users

Hey guys!

I have the following error handlers and it should display the message on the screen but not sure why it doesn’t…

<?php
         $fullUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

         if (strpos($fullUrl, "signup2=error") == true) {
               echo "<br>";
               echo "<p class='error'>There is an error while completing the form!</p>";
               exit();
         }
         elseif (strpos($fullUrl, "signup2=wrongtoken") == true) {
               echo "<br>";
               echo "<p class='error'>There is an error while completing the form!</p>";
               exit();
         }
         elseif (strpos($fullUrl, "signup2=empty") == true) {
               echo "<br>";
               echo "<p class='error'>You did not complete all fields!</p>";
               exit();
         }
         elseif (strpos($fullUrl, "signup2=invalid") == true) {
               echo "<br>";
               echo "<p class='error'>First name and Last name contains invalid characters!</p>";
               exit();
         }
         elseif (strpos($fullUrl, "signup2=email") == true) {
               echo "<br>";
               echo "<p class='error'>E-mail contains invalid characters!</p>";
               exit();
         }
         
         elseif (strpos($fullUrl, "signup2=invalidlength") == true) {
               echo "<br>";
               echo "<p class='error'>Password has to be more than 5 characters!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=notalphanumeric") == true) {
               echo "<br>";
               echo "<p class='error'>Password needs to have both letters and numbers!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=mustchooselevel1plan") == true) {
               echo "<br>";
               echo "<p class='error'>Must choose a Level 1 price!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=mustchooselevel2plan") == true) {
               echo "<br>";
               echo "<p class='error'>Must choose a Level 2 price!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=mustchooselevel3plan") == true) {
               echo "<br>";
               echo "<p class='error'>Must choose a Level 3 price!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=mustchoosecountry") == true) {
               echo "<br>";
               echo "<p class='error'>Must choose a country!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=mustchoosesubscriptionplan") == true) {
               echo "<br>";
               echo "<p class='error'>Must choose a subscriptionplan!</p>";
               exit();
         }
         
         elseif (strpos($fullUrl, "signup2=usernametaken") == true) {
               echo "<br>";
               echo "<p class='error'>Username has already been taken!</p>";
               exit();
         }
         
          elseif (strpos($fullUrl, "signup2=emailnametaken") == true) {
               echo "<br>";
               echo "<p class='error'>E-mail has already been taken!</p>";
               exit();
         }
         
         elseif (strpos($fullUrl, "signup2=first&lastname_taken") == true) {
               echo "<br>";
               echo "<p class='error'>First name and Last name has already been taken!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=firstname_badwords") == true) {
               echo "<br>";
               echo "<p class='error'>Make sure there are no badwords in your first name!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=lastname_badwords") == true) {
               echo "<br>";
               echo "<p class='error'>Make sure there are no badwords in your last name!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=email_badwords") == true) {
               echo "<br>";
               echo "<p class='error'>Make sure there are no badwords in your e-mail address!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=username_badwords") == true) {
               echo "<br>";
               echo "<p class='error'>Make sure there are no badwords in your username!</p>";
               exit();
         }

         elseif (strpos($fullUrl, "signup2=password_badwords") == true) {
               echo "<br>";
               echo "<p class='error'>Make sure there are no badwords in your password!</p>";
               exit();
         }

      ?>

what is "echo "
"; echo " ? and what does "; mean of first of every line? you’ve to use semi colon on end of line like this

echo "Make sure there are no badwords in your username!"; 
exit();
 } elseif (strpos($fullUrl, "signup2=password_badwords") == true) { 
echo "";
  exit();

and you should put your codes in two of```

thanks for pointing that out… I will check my ;

I have checked and do have a semicolon at the end

@piano0011

what error that shows you? to display error show go to Alter PHP config and display errors :slight_smile:

Must I alter the php config? I thought that the errors should be in the error log but there are no errors

Yes, you must alter the PHP config to show errors. This is not a cPanel hosting, this is a VistaPanel hosting, and all the things on cPanel are different than on VistaPanel.

Maybe this should help me a lot with my coding… where is the php config file and what should I change? Because now I have a 502 bad gateway error…

I have updated my php config file… now will the errors be shown in the error log or somewhere else?

You may be able to see them while you visit the site through your browser, not in the error log. To solve the 502 Bad Gateway error use this article from the Knowledge Base.

The 502 error suddenly just happened but I am not using cloudfare at the moment…

Maybe your server is having troubles executing the code fast enough.

So for Vistapanel, the error logs will be shown on the screen if there are any and not in the error log as in Cpanel?

Maybe I should try it again tomorrow or hopefully once I have ssl, it will be faster or secure… I don’t think the 502 error has anything to do with my coding?

The 502 Error has nothing to do with coding, but has something to do with the server.

This is still weird because I got the message to be displayed at my previous webhost but can’t seem to get it working here… if I add the two dots infront of my folder, i get a 403 error but I think it should be the later coding:

if (empty($first) || empty($last) || empty($email) || empty($uid)|| empty($password)) {
header(“Location: …signup.php?signup2=empty”);
exit();

I think this is correct:

if (empty($first) || empty($last) || empty($email) || empty($uid)|| empty($password)) {
header(“Location: signup.php?signup2=empty”);
exit();

I don’t think this is a css issue but i will keep checking it

I am trying another method now to see if that is working instead of just wondering if the problem could be with this code: $fullUrl = “http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;

When using URLs, an easy and quite reliable way is to use absolute URLs. So if you do a Location: /signup.php, it means the visitor will be redirected to {your website}/signup.php, regardless of where they are on your site, which domain they are accessing it through or whether they use HTTP or HTTPS.

Another option is to define a constant for BASE_URL or something which you can set once for the entire website and then use everywhere.

thanks but I think my main problem is in my css file because the message is showing