Skip to content

Commit

Permalink
inital design and code
Browse files Browse the repository at this point in the history
  • Loading branch information
cbdevnet committed Feb 18, 2014
0 parents commit 6bf1dbb
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 0 deletions.
48 changes: 48 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
$HASH="f6108c60ba96a6e4a1bf27abf1f9ce138188e384";
$TRACKER="http%3A%2F%2Fdev.cbcdn.com%3A80%2Fipmagnet";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ipmagnet</title>
<link rel="icon" href="static/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="static/ipmagnet.css" />
<script type="text/javascript" src="static/ajax.js"></script>
<script type="text/javascript" src="static/ipmagnet.js"></script>
<meta name="robots" content="noindex,nofollow" />
<meta http-equiv="refresh" content="60; url=?hash=<?php print($HASH); ?>">
</head>
<body onload="ipmagnet.init();">
<div id="title-wrap">
<h1>ipMagnet</h1>
</div>
<div id="center-wrap">
<div id="content-main">
<div id="mission-statement">
ipMagnet allows you to see which IP address your BitTorrent Client is handing out to it's peers and trackers!
</div>
Add this <a href="magnet:?xt=urn:btih:<?php print($HASH); ?>&dn=ipMagnet+Tracking+Link&tr=<?php print($TRACKER); ?>">Magnet link</a> to your downloads and watch this page.
FYI, the address you've accessed this page with is <?php print($_SERVER["REMOTE_ADDR"]); ?>
<div id="current-connections">
<table id="conn-table">
<tr>
<th>Timestamp</th>
<th>IP address</th>
<th>User Agent</th>
</tr>
</table>
</div>
</div>

<div id="footer-text">
<span id="status-line">Status: n/a <span id="status-text"></span></span>
<span id="meta-footer">
<a href="https://github.com/cbdevnet/magnetip">[source]</a>
<a href="http://www.kopimi.com/kopimi/"><img src="static/kopimi.png"/></a>
<a href="http://wtfpl.net/"><img src="static/wtfpl.png"/></a>
</span>
</div>
</div>
</body>
</html>
Binary file added ipmagnet.db3
Binary file not shown.
113 changes: 113 additions & 0 deletions static/ajax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/**
The awesome
CodeBlue pseudo-cross-browser XHR/AJAX Code Library
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
*/

var ajax={
/**
Create a XHR Object.
IE Compat code removed.
*/
ajaxRequest:function(){
if (window.XMLHttpRequest){//every sane browser, ever.
return new XMLHttpRequest();
}
else{
return false;
}
},

/**
Make an asynchronous GET request
Calls /readyfunc/ with the request as parameter upon completion (readyState == 4)
*/
asyncGet:function(url,readyfunc,errfunc,user,pass){
var request=new this.ajaxRequest();
request.onreadystatechange=
function(){
if (request.readyState==4){
readyfunc(request);
}
};

request.open("GET",url,true,user,pass);
try{
request.send(null);
}
catch(e){
errfunc(e);
}
return request;
},

/**
Make an asynchronous POST request
Calls /readyfunc/ with the request as parameter upon completion (readyState == 4)
/payload/ should contain the data to be POSTed in the format specified by contentType,
by defualt form-urlencoded
*/
asyncPost:function(url,payload,readyfunc,errfunc,contentType,user,pass){
contentType=contentType||"application/x-www-form-urlencoded";

var request=new this.ajaxRequest();
request.onreadystatechange=
function(){
if (request.readyState==4){
readyfunc(request);
}
};

request.open("POST", url, true, user, pass);
request.setRequestHeader("Content-type", contentType);
try{
request.send(payload);
}
catch(e){
errfunc(e);
}
return request;
},

/**
Perform a synchronous GET request
This function does not do any error checking, so exceptions might
be thrown.
*/
syncGet:function(url,user,pass){
var request=new this.ajaxRequest();
request.open("GET", url, false, user, pass);
request.send(null);
return request;
},

/**
Perform a synchronous POST request, with /payload/
being the data to POST in the specified format (default: form-urlencoded)
*/
syncPost:function(url, payload, contentType, user, pass){
contentType=contentType||"application/x-www-form-urlencoded";

var request=new this.ajaxRequest();
request.open("POST", url, false, user, pass);
request.setRequestHeader("Content-type", contentType);
request.send(payload);
return request;
}
};
Empty file added static/favicon.ico
Empty file.
49 changes: 49 additions & 0 deletions static/ipmagnet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
body{
width:100%;
height:100%;
}

h1{
padding:0;
margin:0;
display:inline-block;
}

#center-wrap{
width:90%;
margin:auto;
}

#content-main{
border-radius:1em;
background-color:#ccc;
margin-top:1em;
padding:2em;
}

#title-wrap{
text-align:center;
}

#mission-statement{
font-style:italic;
margin-bottom:1em;
text-align:center;
font-size:90%;
}

#current-connections{
margin-top:2em;
}

#conn-table{
width:100%;
}

#meta-footer{
float:right;
}

#status-line{
float:left;
}
Empty file added static/ipmagnet.js
Empty file.
Binary file added static/kopimi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/wtfpl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6bf1dbb

Please sign in to comment.