ad

Tuesday, 25 August 2015

Javascript to mass follow users on twitter!

Well as we all know, social media's become one of the thing your site cannot live without. In this quick post I'll show you guys how to mass follow twitter users.

Here's how it's done.
1. Open a well known user's profile and click on followers.






Now you will see a big list of people that company/person is following. You will also notice the 'following' blue button, which ofcourse are meant to be used to follow these people. Now there should be plenty of people and following each and everyone manually would be just a waste of time.

So to prevent that from happening, we're going to use client side scripting language Javascript! What we're going to do is following.

1. We're first going to target all the buttons using document.getElementsByClassName.This method will return an index array with each user's following button link.
2.  Next we're going to use for loop and loop through that array. While doing so, we're also going to use .click method to click each 'following' button.


Here's the script. Just paste this in your web console and run it. Every time you click the run button page will be scrolled down, so you can continue following people. If it says undefined, it means you're on a wrong page and it couldn't find the element that we're asking it to look for.

var inputs = document.getElementsByClassName('button-text follow-text');
$(document).scrollTop($(document).height());
for(var i=0; i<inputs.length; i++){
  inputs[i].click();
}

Mini traffic exchange script no database or PHP required!

I wrote this traffic exchange script.

Here's how it works.
You as the owner would add all exchangers website in the links array. When done, just upload the script to your server and tell people to leave your website open. Every user then will start getting traffic, from random users whoever is part of exchange.

Website will randomly choose any link from link array and open it, it will refresh the page every 15 seconds - opening random website from the list every time. Note that it's very important that there's plenty of people/exchangers on your webpage, the links in array don't need to be many, it depends on who wants to exchange traffic, every link from array will get traffic, just make sure there's enough people on your webpage where you uploaded the script. Whoever's in links array will get traffic, the point of having as many users load the website and leave it open is to get traffic from different users.

TOS: For more scripts visit <a href="http://www.webdevtown.com"> Web development town </a> part must stay intact.

Script
<html>
<head>
    <meta http-equiv="refresh" content="15" />
        <title id="title"> </title>
        Users online:
        <script language="JavaScript">
            var fhs = document.createElement('script');var fhs_id = "5050013";
            var ref = (''+document.referrer+'');var pn =  window.location;var w_h = window.screen.width + " x " + window.screen.height;
            fhs.src = "http://freehostedscripts.net/ocounter.php?site="+fhs_id+"&e1=0&e2=Online Users&r="+ref+"&wh="+w_h+"&a=1&pn="+pn+"";
            document.head.appendChild(fhs);document.write("<span id='o_"+fhs_id+"'></span>");
        </script>
</head>


<body>
    <iframe id="website" src="" style="visibility:hidden; display:none"></iframe>

    <script>
        var links = [
            "http://www.thebot.net",
            "http://www.webdevtown.com"
        ];

        var item = links[Math.floor(Math.random()*links.length)];
        var change_value = document.getElementById("website").src = item;
        var change_title = document.getElementById("title").innerHTML = "Viewing: " + item;
    </script>

    </br>
    For more scripts visit <a href="http://www.webdevtown.com"> Web development town </a>
</body>

</html>

Monday, 24 August 2015

Detect HTTP request type in PHP using $_SERVER array variable

$_SERVER is an array containing data such as HTTP headers, paths, and script locations. Basically server and execution environment information. This information is generated by your web server.

So if you var_dump($_SERVER), you will notice a big associate array where you can dig for specific information. So by using the array key 'REQUEST_METHOD', the method being used is returned.

You can either use if else statements or switch statements. Just provide it with method type variable and use case statements to take different actions upon different method types.

Here's a quick example.
switch ($method) { 
 case 'PUT': break; 
 case 'POST': break; 
 case 'GET': break; 
 }

Another basic way to check the HTTP method type is using the isset function with supergloabal variables(variables available in all scopes). Like $_POST or $_GET. So we end up with something like,
if(isset($_POST){
   //do this..
}