GAMA-Site/short/index.php

102 lines
2.8 KiB
PHP
Raw Normal View History

<title>URL Shortner</title>
<script language="javascript" type="text/javascript">
function showHide(shID) {
if (document.getElementById(shID)) {
if (document.getElementById(shID+'-show').style.display != 'none') {
document.getElementById(shID+'-show').style.display = 'none';
document.getElementById(shID).style.display = 'block';
}
else {
document.getElementById(shID+'-show').style.display = 'inline';
document.getElementById(shID).style.display = 'none';
}
}
}
</script>
<style type="text/css">
.api {
display: none;
border-top: 1px solid #666;
border-bottom: 1px solid #666; }
a.showApi, a.hideApi {
text-decoration: none;
color: #36f;
padding-left: 8px; }
a.showApi:hover, a.hideApi:hover {
border-bottom: 1px dotted #36f; }
</style>
2012-10-07 23:52:44 +00:00
<body bgcolor="black" text="greem"><div align="center">
<img src="http://unps-gama.tk/upload/Pictures/header.png"><br>
<h4>Welcome to the UnPS-GAMA page shortner</h4>
<a href="#" id="api-show" class="showApi" onclick="showHide('api');return false;">Existing Short Links</a>
<div id="api" class="api">
2012-10-08 01:01:39 +00:00
<?php
include('getfiles.php');
echo "<table><tr><td><div align'center'><P>List of links already:</p></div></td></tr><tr><td>" . $thelist . "</td></tr></table>";
2012-10-08 01:01:39 +00:00
?>
<a href="#" id="api-hide" class="hideApi" onclick="showHide('api');return false;">Close Me</a>
</div>
2012-10-08 01:01:39 +00:00
<br><hr><br>
2012-10-07 23:52:44 +00:00
<?php
include("config.php");
if(!$_POST['submit'])
{
?>
<form action="index.php" method="POST">
<p>Destination:<br><input name="dest" type="text" size="30" ></p>
<input type="submit" name="submit" value="submit">
</form>
<?php
}
$dest=$_POST['dest'];
if($_POST["submit"])
{
if(isset($_POST['dest']) && $dest != "")
2012-10-07 23:52:44 +00:00
{
$myFile = $random.".php";
2012-10-07 23:52:44 +00:00
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>'.$random.'</title>
<?php
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode(\'/\', $currentFile);
2012-10-07 23:52:44 +00:00
$myFile = "log/".$parts[count($parts) - 1].".log";
$fh = fopen($myFile, \'a\') or die("can\'t open file");
2012-10-10 02:32:17 +00:00
$string = $_SERVER[\'REMOTE_ADDR\']."\n";
fwrite($fh, $string);
fclose($fh);
?>
2012-10-07 23:52:44 +00:00
<meta http-equiv="REFRESH" content="0;url='.$dest.'"></HEAD>
<BODY>
Service by '.$pagepath.'
</BODY>
</HTML>
';
fwrite($fh, $stringData);
fclose($fh);
echo '
Thanks for using '.$pagetitle.' <br>
your link is available here (right click, copy link):<br>
2012-10-09 00:43:47 +00:00
<a href='.$pagepath.$random.' target='.$random.'>'.$pagepath.$random.'</a><br>
2012-10-07 23:52:44 +00:00
<a href="index.php">Back to index</a><br>
<a href="http://unps-gama.tk">Home</a>
';
}if($dest == ""){
echo '
Sorry, you are not able to shorten something without a url <br>
<a href="index.php">Back to index</a><br>
<a href="http://unps-gama.tk">Home</a>
';
}
2012-10-07 23:52:44 +00:00
}
?>