ad

Friday, 22 May 2015

Mini web based chatting application in PHP - NO database required!

I've been getting couple of requests about a chat application that doesn't require database to work.

Here it is, you may ask what're the requirements and setup to make it work? Well.. None! All you do is upload the file to your server and you're good to go!

So what this script offers; it allows you to chat, that's pretty much it's for sake of simplicity, there's no nickname option, your messages are anonymous unless you decide to tell who you are in chat. This script will delete old messages, for example as soon as there's 25 messages in the file, it will erase em all! No login, not registration nothing, it's as simple as it gets!

Although I must admit it's not the most secure way, but it's what it is, if you're looking for more secure system, try the chatting system in my samforum script. It's a free forum made from scratch in PHP.

Couple screenies?


Files

https://dl.dropboxusercontent.com/u/28490184/webdevtown/mini%20chat%20application%20no%20database%20needed.rar

Share if you like!

Thursday, 21 May 2015

How to spoof referrals tutorial

In this quick tutorial I'll be showing you guys how referral spoofing works and then ultimately give you an example of it in action.

First lemme tell you guys what spoofing is, spoofing it something, that masquerades/changes itself to something else. Or in lay mans terms.. lets say you gotta be 18+ to go to club but cant enter since you're just 17.. your friend has an idea that he can make you look 18+, so what he does is he puts some weird makeup on your face and voila! you're looking just like 18+ dude! It's spoofing! you've made yourself look like something that you're not.

Before we go further, I recommend reading this tutorial. HTTP the very basics

Alright! now lets get some practical example, there's couple types of spoofing, here's some of them. In this particular tutorial we'll be talking about referral spoofing. But before that those who just popped on this tutorial lemme explain what referral is.. and yeah if you read my HTTP the very basics it's gonna be easy as a pie!

You know whenever you open a page, there's data that's send to server, server's basically requesting some data, for example, website address, IP address.. and referral address! referral address is the previous website link, for example, if you've come to this site(www.webdevtown.com) form some forum, site will save that forum's address.

Here's example of couple request headers
Accept: Content-Types that are acceptable for the response.

Host: The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening. The port number may be omitted if the port is the standard port for the service requested.

Referer: This is the address of the previous web page from which a link to the currently requested page was followed. (The word “referrer” has been misspelled in the RFC as well as in most implementations to the point that it has become standard usage and is considered correct terminology)

User agent The user agent string of the user agent

Full list can be found here

So lets continue and.. and get to actual example. For this what you'll need is a server with PHP installed. What we're going to do is, save HTTP referral in a text file. So we know where the hits are coming from.
Here's the code for that.
    //error_reporting(0);
    $referer = $_SERVER["HTTP_REFERER"] . PHP_EOL;
    $opened_file = fopen("referers.txt", "ab");
    if(isset($referer)){
        echo "referer is set";
        fwrite($opened_file, $referer);
        fclose($opened_file);
    }else{
        echo "you aint being referer from any site";
    }
   
    echo $referer;


</br> <a href="index.php"> Click me! </a>


Post this on your webpage, make sure it's .php file. We're also going to download a plugin for firefox so we can send fake referrals! here's the plugin.

Alright, so you've the plugin and the file's been uploaded, lets open the site for first time. Loaded? Now open the referels file it's created on your server.. It shouldn't have anything in, since there was no referral.. now lets open our refcontrol plugin, choose custom and enter in custom referel URL.
spoof, fake referel










Press okay, then okay again and load the page. As expected page will load normally, however! it will show youtube as a referral! Magic!? and if you open referel file it should show www.youtube.com!

You've basically spoofed the referral. Now to make the process automatic, here's what you'll need to do, use cURL extension(little tutorial here) and send random referrals every time page refreshes!  You can even use proxy along with random referral! Here's auto proxy changing script.

Please share if you liked this tutorial!

Monday, 18 May 2015

Force visitors to go through adf.ly link!

Well this little idea come to my mind recently where anyone who visits your website will have to go through adf.ly link to get access to it. It will create a session, to check if user has already visited the site.. if user closes the browser it will make the user go through link again!

How it works.
- Someone goes to your website
- Script will check if they've already clicked on adf.ly link and finished the AD. NOTE: If web browser is closed, script will forget everything and make user go through adf.ly again.

How to use this script.
I've two files, index.php and callback.php, index.php contains the code you should post in your website's main page. Just copy paste the code. Don't forget the PHP tags though. I've also got callback.php file there's not much you need to know about it, if you're a developer have a look.

What changes you need to make for this script to work.
All you need to do is, where it says $adf_link change it to your adf.ly link. And in callback.php file where it says $secret_key change it to whatever key you wish.

For this script to work you need to shrink adf.ly link in a certain way, here's what needs to be shinked.
www.websitename.com/callback.php?secret_ley=your_secret_key Just shrink it!

Once shrinked, just do whatever I said above about replacing the link and key.. and you're done!

Download:
https://dl.dropboxusercontent.com/u/28490184/webdevtown/Adf%20force%20visit.rar

How it works.
- Someone goes to your website
- Script will check if they've already made clicked on adf.ly link and finished the ad. NOTE: If web browser is closed, script will forget everything and make user go through adf.ly again.

How to use this script.
I've two files, index.php and callback.php, index.php contains the code you should post on your website's main page. Just copy paste the code. I've also got callback.php file there's not much you need to know about it, if you're a developer have a look.

What changes you need to make for this script to work.
All you need to do is, where it says adf_link change it to your adf.ly link. And in callback.php file where it says secret_key change it to whatever key you wish.

For this script to work you need to shink adf.ly link in a certain way, here's what needs to be shinked.
www.websitename.com/callback.php?secret_ley=your secret key

Once shrinked, just do whatever I said above about replacing the link and key.. and you're done!
Well this little idea come to my mind recently where anyone who visits your website will have to go through adf.ly link to get access to it. It will create a session, if user closes the browser it will make the user go through link again!

How it works.
- Someone goes to your website
- Script will check if they've already made clicked on adf.ly link and finished the ad. NOTE: If web browser is closed, script will forget everything and make user go through adf.ly again.

How to use this script.
I've two files, index.php and callback.php, index.php contains the code you should post on your website's main page. Just copy paste the code. I've also got callback.php file there's not much you need to know about it, if you're a developer have a look.

What changes you need to make for this script to work.
All you need to do is, where it says adf_link change it to your adf.ly link. And in callback.php file where it says secret_key change it to whatever key you wish.

For this script to work you need to shink adf.ly link in a certain way, here's what needs to be shinked.
www.websitename.com/callback.php?secret_ley=your secret key

Once shrinked, just do whatever I said above about replacing the link and key.. and you're done!
Well this little idea come to my mind recently where anyone who visits your website will have to go through adf.ly link to get access to it. It will create a session, if user closes the browser it will make the user go through link again!

How it works.
- Someone goes to your website
- Script will check if they've already made clicked on adf.ly link and finished the ad. NOTE: If web browser is closed, script will forget everything and make user go through adf.ly again.

How to use this script.
I've two files, index.php and callback.php, index.php contains the code you should post on your website's main page. Just copy paste the code. I've also got callback.php file there's not much you need to know about it, if you're a developer have a look.

What changes you need to make for this script to work.
All you need to do is, where it says adf_link change it to your adf.ly link. And in callback.php file where it says secret_key change it to whatever key you wish.

For this script to work you need to shink adf.ly link in a certain way, here's what needs to be shinked.
www.websitename.com/callback.php?secret_ley=your secret key

Once shrinked, just do whatever I said above about replacing the link and key.. and you're done!
Well this little idea come to my mind recently where anyone who visits your website will have to go through adf.ly link to get access to it. It will create a session, if user closes the browser it will make the user go through link again!

How it works.
- Someone goes to your website
- Script will check if they've already made clicked on adf.ly link and finished the ad. NOTE: If web browser is closed, script will forget everything and make user go through adf.ly again.

How to use this script.
I've two files, index.php and callback.php, index.php contains the code you should post on your website's main page. Just copy paste the code. I've also got callback.php file there's not much you need to know about it, if you're a developer have a look.

What changes you need to make for this script to work.
All you need to do is, where it says adf_link change it to your adf.ly link. And in callback.php file where it says secret_key change it to whatever key you wish.

For this script to work you need to shink adf.ly link in a certain way, here's what needs to be shinked.
www.websitename.com/callback.php?secret_ley=your secret key

Once shrinked, just do whatever I said above about replacing the link and key.. and you're done!

PHP login authentication script without any database

I've been receiving requests from people having issues with databases, connection, table creation.. just the word SQL is enough to scare them. So I decided to create this logging in script, for this script there is no requirements. I haven't documented my code since I wrote it in hurry. Though it's written in object oriented I haven't really done any hashing.

This is how you use it, upload your file, create a text file named admin.txt and put username one 1st and password on 2nd line. Then all you do is, open htaccess file and post this code in, and you're good to go!
<files "admin.php"> deny from all </files>

Code preview
class webdevtowncomAdfAutoLoad{

    static function fire()
    {
        $webdevtowncomAdfAutoLoad = new webdevtowncomAdfAutoLoad;
        return $webdevtowncomAdfAutoLoad;
    }

    public function file_handling()
    {
        $file_path = 'admin.txt';
        $file_read = file($file_path) or die('admin.txt file doesn\'t exist');
       
        $has_user_and_pass = count($file_read);
        if(( $has_user_and_pass <= 1 ) or ( $has_user_and_pass > 2 ) ){
            die('Please make sure you have username and password in your admin.txt file, and they\'re seperated by break, username in one line and password in another.');
        }else{
            $stored_username = $file_read[0];
            $stored_password = $file_read[1];
            if( (strlen($stored_username) > 5 ) and (strlen($stored_password) > 5) ){
                $this->stored_username = trim($file_read[0]);
                $this->stored_password = trim($file_read[1]);
            }else{
                die('Your username or password is too weak. Please open admin.txt file and check it');
            }

        }
    }
   
    public function show_form()
    {
       
        //session is already starting when calling funciton get data from admin file already
        if(!isset($_SESSION["logged_in"])){
            echo "<form method=\"POST\" action=\"{$_SERVER["PHP_SELF"]}\"> 



Download
https://dl.dropboxusercontent.com/u/28490184/webdevtown/loggin%20in%20script.rar

XML with examples for beginners

Lets talk about XML. XML strands for Extensible Markup Language. It's just like HTML, it has tags, however those tags are not predefined, you can make up any tag you wish. XML is used to store data, although you could use HTML for it, it'd be really hard to organize, manage and describe data using HTML tags.

Here's how a simple XML document look like.
<?xml version="1.0"?>
<note>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>
    <body> Don't forget me this weekend! </body>
</note>


Basic XML structure.
1. XML version declaration.
2. Root element, opening/closing. Also called parent.
3. Child elements and siblings..

So it's,
VERSION DECLARATION
<root opening>
    <child opening1> content </child closing1>
    <child opening2> content</child closing2>
    <more child opening> more content </more child closing>
<\root closing>


Know that all our structure goes inside the root elements and you cannot have more than one root element on a page.

Before we move any further, lemme tell you guys what parent, child and sibling is. We have child that's nested within parent element.
<parent>
    <child>Text</child>
</parent>


Here <root> is parent of <paragraph> and <paragraph> is parent to <sentence>. <sentence> is child of <paragraph>. And those two <sentence> are sibling to each other.
<root>     
    <paragraph>       
        <sentence>This is a sentence</sentence>     
        <sentence>This is another sentence</sentence>
    </paragraph>
</root>


These elements can also have attributes. Attributes provide additional information. Example below we've a <person> which is a parent element, with attribute gender and its value is 'female'.
<person gender="female">
  <firstname>Anna</firstname>
  <lastname>Smith</lastname>
</person>


We've covered the basics, now here's the fun part. You can fetch those information, or allow others to do it, different languages provide different extensions, in PHP we've SimpleXML parser. It allows you to get element name, attributes, text nodes etc..

For example, code below will return an object representation of languages.xml file, you can then iterate through it and display appropriate information,
$languages = simplexml_load_file("languages.xml");

Another practical example would be to load a website that provides content in XML format using file_get_contents() function and use simplexml_load_string() to then loop and get specific data. You then could even post that data on your site if allowed.

Thursday, 14 May 2015

SQL Structured Query Language is EASY - quick introduction!

Hello, I will not bother going into deep shit like its history and whatnot, so let's dive right into it!

Well first and most importantly you need to know what exactly SQL is and what how is it useful. SQL is sort of programming language designed to manage data that is in RDBMS

RDBMS relational database management system is a system designed to retrieve, extract and insert information into database. While doing so it's interacting with database. mySQL is one of the examples.

Database is a collection of organized information, for example, name, last_name, email etc.. You're accessing it using relational database management system(RDBMS)  Here is a list most popular DB engines.

Our data is stored in tables, this is how it would look like. Table is just a set of columns and rows.
database table sql







Column is often referred as field, in picture above there is 4 fields, titel, interpret, jahr and id. And row is also called record.

You may ask, alright now how can this be useful to me? Well it can be pretty damn useful. Lets say you have started working on a site index.php is a page for regular users/guest and premium.php is for VIP members only.. how would you distinguish VIP members from regular ones? Well you can do so by asking them to signup, you would store their username and password in the database.. you could write a registration system, which would use an extension(sqli, pdo etc) to connect to database and then use SQL queries to perform tasks.. you could insert their info, retrieve info to check if user of that name already exists etc.. check if user is VIP when user is logging in.

Let's say we are writing a login system we need to check if information user send us using POST(more about this here) is correct or not. This is what we do.
SELECT username, password FROM table_name WHERE username = $username and password = $password

We are essentially saying SELECT the username and password from the table table_name WHERE username is equal to $username variable AND password is equal to $password variable's value. $password and $username contains the value we received from user.

Lets talk a little more about table because this important.. usually you'd want to create different tables for different kind of information, you don't want to fill a single table with every single piece of info you have. Suppose you are writing a registration system, you would store, username, password, and email in one table and recovery questions in another.. I know this is getting confusing already, here's an example.

Table users:
username|password|email
jon           123456    jon@gmail.com
brown      3643554  brown@gmail.com

Table recovery:
Hm... we need a way to relate recovery questions to each user don't we? if we didn't do it how would we know which question belongs to user.. you could say why not just write username in front of the question.. well we could very well do it.. but then we aren't separating the information or if we're doing it in different table we're repeating information which we don't want. So solve this problem we just add an id field to our users table, whenever we insert anything using INSERT keyword INTO users table we also give it an id which increments automatically.. So changing a bit this is how our users table would look like this time.

Table users:
id|username |password|email
1  jon           123456    jon@gmail.com
2  brown      3643554  brown@gmail.com

Now when we're inserting data in users table we also insert data into recovery table.

Table users:
id                 |          recovery_question            |         recovery_answer
1                             Where were you born?                  usa
2                             Your favorite food?                      rice chicken

We now know that id 1 refers to jon and 2 to brown. We're creating relations here.

You also need to know that in SQL database there's certain data types. If you're storing a name you'd need to give it data type text, or varchar.. for number you'd need to give it integer. The list can be found here.

To finish this off, here's a few examples that will give you a better understand

Saturday, 9 May 2015

Proxy checker 1.0 - Saves working proxies from the list

Proxy checker 1.0
This proxy checker bot will check whether proxies in the provided proxy list are working or not, it will read proxies from proxy.txt file and save working ones in the working_proxies.txt file. This script can be used in combination with my other Proxy visitor 1.0 script. You can sort working proxies using this script and use them in proxy visitor 1.0. You can check proxy visitor here.

Bottom one was my original proxy list, and 2nd from bottom is new working list.




















How to use.
Well there is not much to say, just upload the proxy list and index.php file to your server and you should be good to go. Just make sure proxy's separated by breaks, not by commas. It should look something like this.

Example:
115.238.225.26:80
123.121.99.214:8118
201.209.235.241:8080
83.111.153.254:8081
60.216.225.157:8118
218.204.143.196:8118

https://dl.dropboxusercontent.com/u/28490184/webdevtown/proxy%20checker.rar