473,626 Members | 3,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP+PEAR error catching and self validation

5 New Member
I have a simple login page with 2 fields (email and password), these details are then sent to another page which processes the inputs and sends them off to a PEAR server and awaits a response, it then comes back with one of 3 values: 5 values (NO_EMAIL, NO_PASSWORD, ACCOUNT_LOCKED, LOGIN_INVALID or a userID, a numerical value). What i really, REALLY want is all this on one page (my login page), instead of 2. So a user logs into a single page, if they mistype their password or something the error code is echoed on the SAME page. i've tried PHP_SELF which won't work for obvious reasons. I've attached a bit of my error checking code for people to look at and get a greater understanding of how the system works. It's just a conditional statement at the moment. The error code is received from a completely seperate PEAR server which we do not own...

Expand|Select|Wrap|Line Numbers
  1. $params = array('email' => $email,'password' => $password,'service' => 'API v1.0');
  2. $auth = $client->call('getAuthToken', $params);
  3.  
  4. // Check for a fault
  5. if ($client->fault) {
  6.    $fault = $auth['faultstring'];
  7.       switch ($fault) {
  8.          case "NO_EMAIL":
  9.          echo 'Email address missing';
  10.          break;
  11.      case "NO_PASSWORD":
  12.      echo "Password missing";
  13.      break;
  14.      case "LOGIN_INVALID":
  15.          echo "email or password is incorrect";
  16.      break;
  17.      case "ACCOUNT_LOCKED":
  18.         echo "The account has been locked.";}
  19. }else {
  20.     $err = $client->getError();
  21.     if ($err) {
  22.     echo 'There seems to be a server side error, please send a ticket along with this refereces: $err to the admin';} 
  23.         else {
  24.         echo header("Location: http://the_page_in_question.com");}
  25. }
  26.  
  27. exit;
Jul 11 '08 #1
1 1535
pbmods
5,821 Recognized Expert Expert
Heya, Slowpoke.

You can use $_SERVER['REQUEST_URI'] to have the form post to itself.
Jul 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
21206
by: Frank | last post by:
How do you turn on PHP error messages in PHP, So I can see what is happening when a php page fails ? Windows & Linux ??
2
25570
by: Scott Castillo | last post by:
I can't seem to find the PHP error log file on a Windows system. Does anybody know where it is? Thanks for the help.
3
2445
by: Ron King | last post by:
When I installed Mandrake 10.0 I thought I had Apache, PHP, and MySQL installed correctly. I could serve web pages, MySQL worked, and when I tried the phpinfo() function, I got a page that looked OK. I could create simple php pages and serve them up. Then I tried to install pear, and things started to be not OK after all. phpinfo() told me that the 'Configure Command' had both the following in it: --with-pear=/usr/share/pear
1
1866
by: O.B. | last post by:
I'm working on integrating some PHP code into a website hosted by catalog.com. It appears that PHP error handling is disabled. Other hosting services (that I have worked with) have this turned on such that when an error occurs in loading an HTML page, the error message is displayed to the screen. I've added "error_reporting(E_ALL);" to my PHP code and it has not made a difference. What must I do to enable this behavior?
3
3426
by: Pratchaya | last post by:
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array(): ============================================================== In the past i use my code/script work fine with Mandrake 9.1 - 10.1 ( + apache ,mysql ) Now i move to redhat EL4 with the same code/script
1
2770
by: James | last post by:
Hey everyone, I have a really obscure but impassable problem with a reasonably simple piece of php/PEAR DB/MySQL code When calling several stored procs the first call succeeds, but subsequent calls fail no matter which SP is called first it always works, and the rest fail... with: >>>
1
7039
by: newsbandit | last post by:
Hello All, is there a way to specify a php error log for each individual site on an IIS 6 server? If so how, when I turn on logging in the php.ini file it seems to be global and all sites dump to one file. Thank for any help!
2
3215
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString", $formName); // 06-22-07 - the next commands try to import all the functions that the
5
1429
by: openxmod | last post by:
hi, i am using WAMP in localhost... can anyone help about how to handle PHP error?
14
5170
by: fuchsia555 | last post by:
Is there anyway to hide php error messages? Because i have in my php code error but it redirecting after 1 sec and shows my hosting path and php error number, but this error doesn't effect anything.
0
8266
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.