Jump to content

PHP vs. Java


wattsup88

Recommended Posts

not by the way that your probably thinking...
php is finished processing by the time it hits the browser... however... php can echo out javascript... so you can automate many javascript functions through php... for example...

[code]<?
function status_decrypt($text, $link, $status){
global $statusdecrypt, $head;
if(!isset($statusdecrypt)){
  $statusdecrypt=1;
  $head .='
<SCRIPT LANGUAGE="JavaScript"><!--';
  $head .='var data="0123456789";';
  $head .='var done=1;';
  $head .='function statusIn(text){';
  $head .=' decrypt(text,2,1);';
  $head .='}';
  $head .='function statusOut(){';
  $head .=' self.status = \'\';';
  $head .=' done=1;';
  $head .='}';
  $head .='function decrypt(text, max, delay){';
  $head .=' if(done){';
  $head .='  done=0;';
  $head .='  decrypt_helper(text, max, delay, 0, max);';
  $head .=' }';
  $head .='}';
  $head .='function decrypt_helper(text, runs_left, delay, charvar, max){';
  $head .=' if(!done){';
  $head .='  runs_left = runs_left - 1;';
  $head .='  var status = text.substring(0, charvar);';
  $head .='  for(var current_char = charvar; current_char < text.length; current_char++){';
  $head .='  status += data.charAt(Math.round(Math.random()*data.length));';
  $head .='  }';
  $head .='  window.status=status;';
  $head .='  var rerun = "decrypt_helper(\'" + text + "\'," + runs_left + "," + delay + "," + charvar + "," + max + ");"';
  $head .='  var new_char = charvar + 1;';
  $head .='  var next_char="decrypt_helper(\'" + text + "\'," + max + "," + delay + "," + new_char + "," + max + ");"';
  $head .='  if(runs_left > 0){';
  $head .='  setTimeout(rerun, delay);';
  $head .='  }else{';
  $head .='  if(charvar < text.length){';
  $head .='    setTimeout(next_char, Math.round(delay*(charvar+3)/(charvar+1)));';
  $head .='  }else{';
  $head .='    done=1;';
  $head .='  }';
  $head .='  }';
  $head .=' }';
  $head .='}';
  $head .='--></script>';
}
return '<a href="'.$link.'" onMouseOver="statusIn("'.$status.'");return true;" onMouseOut="statusOut();">'.$text.'</a>';
}
?>[/code]
or to that effect :-)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.