if (!empty($_SERVER['HTTP_CLIENT_IP']))
$ip=$_SERVER['HTTP_CLIENT_IP'];
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
else
$ip=$_SERVER['REMOTE_ADDR'];
?>
Here I’ll introduce a simple example of how client side processing works in ZK 5, which I believe the JavaScript developers would enjoy.
In this case input data is sent with the event to the server side; however, you may also opt to handle events right at the client if it makes sense to do so.
For example, we could implement a form validation mechanism at the client (other then the built in ZK InputElement constraints).
The event processing stages at client side is the following in ZK:
DOM Event -> Widget (JS object) Event -> Component (Java object) Event
Hence, if we intercept and handle the widget event at the client side, the component event will never be sent to the server side for processing.