tags:

views:

50

answers:

1

I was wondering: what is the PHP equivalent of this JavaScript code:

window.onload = initAll;

function initAll() {
  document.getElementById("redirect").onclick = clickHandler;
}

function clickHandler() {

  if(this.toString().indexOf("wapcreate") < 0){
    window.location = "ex.html";
  }

  return false;
}

I want to get all the external links from my server and then direct the users to a disclaimer page

A: 

There is no PHP equivalent, because PHP is executed on the server, while Javascript is executed on the client-side. There is no way for PHP to to handle an onclick event.

But if you want to redirect a page, try to set a header like this:

header( 'Location: ex.html' );
Harmen
im not try to use onclick forget bout that part its is the principle of the javascript code not the trigger all i want is how to grab external links that redirect from my sever and trun the it eg. http://mysever.com/?external=http://externalsever.com. so http://mysever.com/?external=http://externalsever.com would be my disclaimer page
harry