Beispiel #1
0
<?php

// (C) Phurl Project 2012
// Define PHURL to allow includes
define('PHURL', true);
// No debugging here, oh dear!
ini_set('display_errors', 0);
//Ensure they've deleted the install directory.
$prefix[0] = '';
$filename = 'install';
if (is_dir($filename)) {
    die("To get Phurl up and running, you first need to go through the <a href=\"install\">installation wizard</a> which will help you set up your new URL shortener in a matter of moments.<br/><br/>If you've already installed Phurl, then you MUST delete the install directory before it will function.");
}
// include the magic
include "includes/config.php";
include "includes/functions.php";
// connect to the database
db_connect();
if (file_exists(get_phurl_option('theme_path') . "header.php")) {
    include get_phurl_option('theme_path') . "header.php";
} else {
    die("<h2>Could not load theme</h2>");
}
include get_phurl_option('theme_path') . "forms/shorten.php";
if (file_exists(get_phurl_option('theme_path') . "footer.php")) {
    include get_phurl_option('theme_path') . "footer.php";
} else {
    die("<h2>Could not load theme</h2>");
}
Beispiel #2
0
$result = mysql_query("SELECT SUM(clicks) AS clicks FROM " . DB_PREFIX . "stats WHERE BINARY alias='{$alias}'");
$total = mysql_fetch_assoc($result);
?>
<br/><b>Clicks: </b>
<?php 
$curtot = $total['clicks'];
if ($curtot == "1337") {
    $curtot = "leet";
}
echo $curtot;
?>
</td>
</tr>
</table><br/>
<b>Regional statistics for <?php 
echo get_phurl_option('site_url');
?>
/<?php 
echo $alias;
?>
 (Total <?php 
echo $curtot;
?>
 clicks)</b><br />
<?php 
$result = mysql_query("SELECT country, clicks FROM " . DB_PREFIX . "stats WHERE BINARY alias='{$alias}' GROUP BY country ORDER BY clicks DESC");
$countries = "";
$numbers = "";
echo "<div id=\"flags\">";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $countries .= $row['country'] . "|";
Beispiel #3
0
function get_hostname()
{
    $data = parse_url(get_phurl_option('site_url'));
    return $data['host'];
}
Beispiel #4
0
   \$.ajaxSetup({ cache: false });
});
</script>
JQUERY;
echo $jquery;
?>

</head>
<body>
<div id="container">
 <div id="header">
 	<div id="logo"><h1><?php 
echo get_phurl_option('site_title');
?>
</h1></div>
 	<span id="slogan">- <?php 
echo get_phurl_option('site_slogan');
?>
</span>
 	<div id="menu">
 		<ul>
 			<li><a href="/">Home</a></li>
<li><a href="/api/create.php?url=http://example.org/">API</a></li>

 		</ul>
 	</div>
 	<div class="clear"></div>
 	
 </div>
<div id="content">
Beispiel #5
0
<?php

if (!defined('PHURL')) {
    header('HTTP/1.0 404 Not Found');
    exit;
}
?>
<div id="footer">
<p>&copy; <?php 
echo date('Y');
?>
 <?php 
echo get_phurl_option('site_title');
?>
 


<?php 
// From the developers:
// You may remove the below powered by link if you wish, we don't mind. However, we'd really really appreciate it if you donated to Phurl.
// Any donation of any size is much appreciated, and you'll be able to see how it helps out in our public accounts on our website.
// To donate, simply head over to http://phurlproject.org/ and hit the donate button. Thank you!
?>
- Proudly powered by 
<a href="http://www.phurlproject.org/">Phurl</a>.</p>
</div>
</div>
</body>
</html>
Beispiel #6
0
<div id="shorten">
	<img src="<?php 
echo get_phurl_option('theme_path');
?>
enter-url-here.png" />
<form id="surlform">	
<div id="url-box">
		<div id="input"><input type="text" id="url" autocomplete="off" /></div>
		<button id="button">Shorten</button>
		<button id="hbutton">View Stats</button>
		<div class="clear"></div>
	</div>
</form>
	
	<div id="show-options" onclick="$('#shorten-options').slideToggle('slow');">[+] Show Shortening Options</div>
	<div id="shorten-options">
		<table>
			<tr>
				<td>Consecutive (Short)</td>
				<td><input type="radio" name="alias-type" value="short" /></td>
			</tr>
			<tr>
				<td>Random (Longer)</td>
				<td><input type="radio" name="alias-type" value="long" /></td>
			</tr>
			<tr>
				<td>Custom</td>
				<td><input type="radio" name="alias-type" value="custom" onclick="showHideCustom();" /></td>
			</tr>
		</table>
Beispiel #7
0
                }
            }
        }
        if ($create) {
            do {
                $sctype = get_phurl_option('shortcode_type');
                if ($sctype = "r") {
                    $code = generate_code_rand();
                } else {
                    $code = generate_code(get_last_number());
                    if (!increase_last_number()) {
                        die("System error!");
                    }
                }
                if (code_exists($code) || alias_exists($code)) {
                    continue;
                }
                break;
            } while (1);
            $id = insert_url($url, $code, $alias);
        }
        if (strlen($alias) > 0) {
            $code = $alias;
        }
        $short_url = get_phurl_option('site_url') . "/" . $code;
        $_GET['url'] = "";
        $_GET['alias'] = "";
        echo "{$short_url}\n";
        exit;
    }
}