credits:
IDEA COMES FROM------> [url]http://theftalk.com/t34319-How-to-Inject-JavaScript-via-PHP.html[/url]
[b]WHY HIDE JS FILE?[/b]
>> to protect your own codes from rippers.
[b]WHY LOAD JS FILE FASTER?[/b]
>> to save time of your profile viewer of waiting for your js file to load.
[b]WHY SIGN-UP TO [url=http://christers.net46.net/freehost.php]000WEBHOST?[/url][/b]
>> when you reach a large traffic in your profile, [i]example your viewer today is 2000[/i] then, your bandwidth on ripway will be not enough, although their service is fast and good.
[b]WHY BAN RIPPER?[/b]:
>> 85%++ of javascripters around the world hate rippers.
[b]WHY NOT ONLY HIDE JAVASCRIPT, BUT BAN RIPPER?[/b]:
>>some javascript expert knows how to retrieve your js file even if it is encoded, hidden by a script like PHP.
[color=red] they are typing something in the ADDRESS_BAR above your browser to hack your file. ([i]I have tried it once and it worked so I edited this tutorial for much more security[/i][/color]).
{ [color=blue] * I will not show you how to hack files here.[/color] }
>>In the first time they take a rip to your file, they should be banned (by saving his/her IP Address into a database).
[b]HOW SHOULD THEY BE BANNED?[/b]
>> then run a code snnipet using PHP,! Follow the Instruction below if you are interested.
[b]HIDE JS FILE + BAN RIPPERS IP ADDRESS + LOAD JS FILE FASTER[/b]:
1.) You need a Hosting site that have support to PHP.
[i]I recommend this free and best hosting site [url=http://christers.net46.net/freehost.php]000WEBHOST[/url][/i]
[color=red][b]Warning[/b][/color]: don't signup just to save files only. If you decided to signup, you must make your website like mine [url]http://christers.net46.net[/url]
SIGN-UP TO 000webhost.com, FOLLOW THESE SUB-Procedures OR ELSE, prefer to use your [url=http://ripway.com]ripway account[/url]
1.a)
Sign up and choose your own domain name.
1.b)
Open your account (Log In) by going to [url]http://members.000webhost.com[/url]
[img]http://h1.ripway.com/lkjh0987/img/login.bmp[/img]
1.c)
GO to CPANEL AND Click FILE-MANAGER
[img]http://h1.ripway.com/lkjh0987/img/cpanel.bmp[/img]
1.d)
Log In to your file-manager:
[img]http://h1.ripway.com/lkjh0987/img/login2.bmp[/img]
1.e)
GO TO [color=red]public_html[/color] Directory
this is where you should save all your file so it will be seen on internet.
2.) Create your database (SAVE RIPPERS IP ADDRESS)
2.a)
log-in to your cpanel [url]http://members.000webhost.com[/url]
2.b)
create database:
>>click to mySQL icon
[img]http://christers.net46.net/sample/sql.bmp[/img]
fill the info about your database
>>name your database [color=green]ripper[/color]
[img]http://christers.net46.net/sample/dbase.bmp[/img]
copy the plain text that will auto config your created database (open up a new notepad and paste them)
[img]http://christers.net46.net/sample/crdb.bmp[/img]
it is something like:
[b][color=red]
$mysql_host = "mysql2.000webhost.com";
$mysql_database = "xxx123_ripper";
$mysql_user = "xxx123_ripper";
$mysql_password = "abcd123";
[/color][/b]
3.) Then open a new note pad again.
4.) Paste this code in the notepad
[spoiler]<?php
$referer=$_SERVER['HTTP_REFERER'];
//replace this colored text below with the text you have pasted in the first notepad you have opened
//or fill up the configuration below if you have another sql server like ->>>> [url]http://www.freesql.org[/url]
[color=orange]
$mysql_host = "[b]SERVER[/b]";
$mysql_database = "[b]DATABASE_NAME[/b]";
$mysql_user = "[b]DATABASE_USER_NAME[/b]";
$mysql_password = "[b]DATABASE_PASSWORD[/b]";
[/color]
$con=mysql_connect($mysql_host,$mysql_user,$mysql_password);
mysql_select_db($mysql_database);
if(!$con){die();}
$create = <<<CREATE
create table rippers(
IP varchar(100),
DateVisit varchar(200)
)
CREATE;
@mysql_query($create,$con);
function IP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
//check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
//to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$rip=false;
$ip=IP();
$rippersIP=mysql_query("select * from rippers",$con);
$r_ar=array();
while($res=@mysql_fetch_array($rippersIP)){
$r_ar[]=$res[IP];
}
foreach($r_ar as $ips){
if($ip==$ips){
$rip=true;
}
}
if($referer!==""){
//WE WILL CATCH THE RIPPER'S IP ADDRESS HERE AND INSERT HIS/HER DATA TO YOUR DATABASE
$catch= "insert into rippers(IP,DateVisit)values('$ip','".date('r')."')";
if(!$rip){
@mysql_query($catch,$con);
}
header('location:http://friendster.com/');
?>
<script>
u='GODLOVESYOU';
while(u=='GODLOVESYOU'){
alert('forbidden!');
}
</script>
<?php
} else {
header("Content-type:text/javascript;charset:UTF-8");
ob_start("gz_handler"); // THIS IS TO MAKE YOUR JAVASCRIPT TO LOAD FASTER 10x
if($rip){die("var th=0;while(th!==10){alert('ripper!');}");}
?>
[color=blue]REPLACE_THIS_WITH_YOUR_JAVASCRIPT_CONTENT[/color]
<?php } ?>[/spoiler]
[color=blue]* the [i]<?php ob_start("gz_handler");?>[/i] is the code so that your js file will load 10x faster than your old file (I think:lol:)
[/color]
[url=http://www.msxnet.org/fast-website]READ ARTICLE ABOUT ob_start('gz_handler')[/url]
5.) Copy your old JS file content and replace [b]REPLACE_THIS_WITH_YOUR_JAVASCRIPT_CONTENT[/b] with your js file content on the notepad.
>> Then save it as [color=green]jsfile.php[/color]
6.) Upload it to the hosting site.
[b]IF YOU SIGNED-UP in 000webhost.com, FOLLOW THESE Sub-Procedures OR ELSE JUST UPLOAD THE FILE TO Your RIPWAY Account.[/b]:
6.a
Go to public_html DIRECTORY and click upload button then upload your file.
[img]http://h1.ripway.com/lkjh0987/img/public_html.bmp[/img]
7.) GET direct url of the file.
[b]IF YOU SIGNED-UP in 000webhost.com, FOLLOW THESE Sub-Procedures[/b]:
7.a
After you upload, go back to public_html directory and....
[img]http://h1.ripway.com/lkjh0987/img/url2.bmp[/img]
right click to the word( [color=red]open[/color]) in the right side.
then click to "[b]Copy Shortcut[/b]" if you are using internet Explorer
or "[b]Copy Link Location[/b]" if you are using Mozilla Firefox
[b]IF YOUR HOST IS RIPWAY[/b],just simply.....
[img]http://h1.ripway.com/lkjh0987/img/url1.bmp[/img]
copy the direct link of your file.
8.) Open a note pad and paste it. Link it to your friendster with an existing JS linker code.
[b][color=#aaff00]EXAMPLE:[/color][/b]
[li]my old javascript file:[/li]
[spoiler]if ( ! attachOnLoadHandler(function () { onloadFunc();}))
window.onload = function () {
onloadFunc();};
function onloadFunc(){
//some block of codes
}[/spoiler]
[li]my generated database code [i]by 000webhost[/i]:[/li]
[spoiler]$mysql_host = "mysql2.000webhost.com";
$mysql_database = "xxx_ripper";
$mysql_user = "xxx_ripper";
$mysql_password = "abcd123";[/spoiler]
[li]my code should be:[/li]
[spoiler]<?php
$referer=$_SERVER['HTTP_REFERER'];
//replace this colored text below with the text you have pasted in the first notepad you have opened
//or fill up the configuration below if you have another sql server like ->>>> [url]http://www.freesql.org[/url]
[color=orange]
$mysql_host = "mysql2.000webhost.com";
$mysql_database = "xxx_ripper";
$mysql_user = "xxx_ripper";
$mysql_password = "abcd123";
[/color]
$con=mysql_connect($mysql_host,$mysql_user,$mysql_password);
if(!$con){die();}
mysql_select_db($mysql_database);
$create = <<<CREATE
create table rippers(
IP varchar(100),
DateVisit varchar(200)
)
CREATE;
@mysql_query($create,$con);
function IP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
//check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
//to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$rip=false;
$ip=IP();
$rippersIP=mysql_query("select * from rippers",$con);
$r_ar=array();
while($res=@mysql_fetch_array($rippersIP)){
$r_ar[]=$res[IP];
}
foreach($r_ar as $ips){
if($ip==$ips){
$rip=true;
}
}
if($referer!==""){
//WE WILL CATCH THE RIPPER'S IP ADDRESS HERE AND INSERT HIS/HER DATA TO YOUR DATABASE
$catch= "insert into rippers(IP,DateVisit)values('$ip','".date('r')."')";
if(!$rip){
@mysql_query($catch,$con);
}
?>
<script>
u='GODLOVESYOU';
while(u=='GODLOVESYOU'){
alert('forbidden!');
}
</script>
<?php
} else {
header("Content-type:text/javascript;charset:UTF-8");
ob_start("gz_handler"); // THIS IS TO MAKE YOUR JAVASCRIPT TO LOAD FASTER 10x
if($rip){die("var th=0;while(th!==10){alert('ripper!');}");}
?>
[color=blue]
if ( ! attachOnLoadHandler(function () { onloadFunc();}))
window.onload = function () {
onloadFunc();};
function onloadFunc(){
//some block of codes
}
[/color]
<?php } ?>[/spoiler]
PROOF OF CONCEPT: ([i]note: you will be banned if you go to this link [b]means you will not be able to load it again forever[/b][/i])
(Don't worry this is not my true js file)
JUST EXAMPLE: [url]http://christers.net46.net/js2.php[/url]
Last edited by zidaine_38 (2008-09-08 09:04:53)