Monthly Archives: December 2010
Calling Javascript functions from PHP
If you have designed websites using jQuery, you might have noticed that you are limited to showing certain sections/parts of your websites with direct URL. This is due to the fact that it is mostly user interaction of clicking, mouseover, etc..
This is a small function that will allow you to call certain Javascript functions passed in the URL parameters.
For example, if I would want a user to view the login screen I have on my website, they would visit:
http://www.azizsaleh.com/index.php/?js=login
To pass parameters (pipe delimited), use:
http://www.azizsaleh.com/index.php/ResumeAndPortfolio/?js=showSection&jsp=2
<script type="text/javascript"> $(document).ready(function() { // Check for JS by URL // by azizsaleh @ azzisaleh.com <?php // Check if there is a javascript function if(isset($_GET['js'])) { // set a time out @ 100 milliseconds $js = 'setTimeout("'; $js .= $_GET['js'].'('; // Check for function paramters if(isset($_GET['jsp'])) { // Print variables $jsParamters = explode('|',$_GET['jsp']); for($x=0;$x<count($jsParamters);$x++){ $js .= "'".$jsParamters[$x]."',";} if(strlen($js) > strlen($_GET['js'])+13 ){ $js = substr($js,0,-1);} } $js .= ')",100);'; echo $js; } ?> }); </script>
php_ssh2.dll VC6, VC7, VC8, VC9
Update: Sorry I have seemed to misplace the files on this post. I will try and regenerate them as soon as I can.
Just incase anyone needed it.They all are extracted from VC9 but used hex editor to fool PHP to think it was to which it is labeled.
I am using it as VC6 and it works great.
Hijacking, Bypassing, Defeating and Beating the Same Origin Policy
The same origin policy was created as a permission scheme for communication of websites on same/different servers using browser side languages, like Javascript.
You might have ran into a problem trying to access properties of an Iframe of an external server, for example getting an element by point x & y, which I was trying to achieve when working on the flash click tracker (link).
I then had to create an entirely new script, but still using virtually the same flash object and a PHP proxy that will allow me to control the iframe object to my needs. In my case, it will allow me to track the link click and get the actual link for processing (in case of advertisement, visiting the link).
This is the basic idea I had:
You can view an actual demo here (make sure your ad blocker is off) and if it doesn’t work refresh.
Demo
[wpdm_file id=8]
Flash Link Tracker Using Javascript and Jquery
The flash object then calls back a javascript function, also customizable, when a click event occurs on that object.
The only drawback is that the user must “double click” on the flash object. Since the first click is when the flash object is hidden.
[wpdm_file id=10]
Key Logger with Save, Email and Registry Save for Auto Load
This application allows you to store user input in x milliseconds, store the strokes in a file every x milliseconds, and email that file using SMTP email login and attachment every x milliseconds. You can create a dummy email account to send the information with in the event your application was decoded.
This application features another option that allows you to store the executable path in the system registry for automatic program load on system startup.
Part 1:
Part 2:
PHP Object Merge and In Object Functions – object_merge
These are two functions to manipulate PHP objects.
The first function is similar to array_merge function in that it merges two objects based on an index.
The second function in_object also acts like in_array to which it checks if a certain index exists in an array at a specific value.
Hopefully someone finds it helpful.
<?php // Object merge and in Object functions function object_merge($objectFrom,$objectTo,$indexUse) { $objectReturn = array(); foreach($objectFrom as $curObject) { $index = in_object($indexUse,$curObject->$indexUse,$objectTo,true); if(is_int($index)) { foreach($objectTo[$index] as $indexName => $indexValue) { $curObject->$indexName = $indexValue; } } $objectReturn[] = (object) $curObject; } return $objectReturn; } function in_object($searchFor,$searchValue,$objectSearch,$returnResult) { foreach($objectSearch as $index => $thisObject) { if($thisObject->$searchFor == $searchValue) { if($returnResult) { return $index; } else { return true; } } } return false; } // Usage $obj1[0] = (object) array('catId' => 1, 'catName' => 'Name'); $obj1[1] = (object) array('catId' => 2, 'catName' => 'Name2'); $obj2[0] = (object) array('catId' => 1, 'catDesc' => 'Desc'); $obj2[1] = (object) array('catId' => 2, 'catDesc' => 'Desc2'); $obj_merged = object_merge($obj1,$obj2,'catId'); print_r($obj_merged);