mirror of
https://github.com/cydrobolt/polr.git
synced 2024-11-09 19:52:28 +01:00
Changed from WS branch to REL branch
This commit is contained in:
parent
23f7174f0e
commit
0ddffa44bd
8
dev/.htaccess
Normal file
8
dev/.htaccess
Normal file
@ -0,0 +1,8 @@
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /(index\.php)?\?id=([0-9]+)([^\ ]*)
|
||||
RewriteRule ^ /%3?%4 [L,R=301]
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^([a-zA-Z0-9]+)/?$ /r.php?u=$1 [L,QSA]
|
@ -1,19 +1,16 @@
|
||||
<!-- polr 404 -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!-- polr 404 --><!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>404 Polr</title>
|
||||
<title>404</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="bootstrap.css"/>
|
||||
<link rel="stylesheet" href="main.css"/>
|
||||
</head>
|
||||
<body style="padding-top:60px">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<a class="navbar-brand" href="index.html">Polr</a>
|
||||
<a class="navbar-brand" href="<?php require_once('req.php');echo 'http://'.$wsa;?>"><?php echo $wsn;?></a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="//github.com/Cydrobolt/polr">Github</a></li>
|
||||
<li><a href=-"about.html">About</a></li>
|
||||
<li><a href="//github.com/Cydrobolt/polr">Polr Github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container">
|
||||
@ -21,8 +18,10 @@
|
||||
<h1>404</h1><br><h2>You step in the stream</h2><h2>But the water has moved on.</h2><h2>This page is not here</h2></div>
|
||||
</div>
|
||||
<footer>
|
||||
<p>© Copyright 2013 Polr - Special Thanks to <a href="http://mywot.com">WOT</a></p>
|
||||
<p><?php echo $footer;?></p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
BIN
dev/Favicon.ico
BIN
dev/Favicon.ico
Binary file not shown.
Before Width: | Height: | Size: 54 KiB |
@ -1,27 +0,0 @@
|
||||
polr contributor info
|
||||
======================
|
||||
|
||||
A URL Shortner with simple API
|
||||
|
||||
If you are reading this, you should be a prospective contributor. If you are a developer that would like to use Polr
|
||||
in an app, please go to the /releases/ folder and download the version that you would like to use. Documentation
|
||||
is located in /docs/
|
||||
|
||||
|
||||
If you would like to contribute, please make sure you read /req.php/ and understand all the references that a script is making before you submit a pull request. If you are confused, please head to #polr in irc.freenode.net:6667 or click -> to use the webchat. http://webchat.freenode.net/?channels=#polr
|
||||
|
||||
|
||||
Copyright (C) 2014 Polr
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
@ -1,36 +0,0 @@
|
||||
<!-- polr about -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>About Polr</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="bootstrap.css"/>
|
||||
<link rel="stylesheet" href="main.css"/>
|
||||
</head>
|
||||
<body style="padding-top:60px">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<a class="navbar-brand" href="http://polr.cf">Polr</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="//github.com/Cydrobolt/polr">Github</a></li>
|
||||
<li><a href="about.html">About</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="jumbotron" style="text-align:center; padding-top:80px; background-color: rgba(0,0,0,0);">
|
||||
<h1>Polr</h1><br><p>Crafted by <a href="http://xcyd.tk">Cydrobolt</a></p>
|
||||
</div>
|
||||
<br>
|
||||
<div style="text-align:center">
|
||||
<h3>Other Contributors:</h3>
|
||||
<a href="http://techfilmer.com">Srijay Kasturi</a> ,
|
||||
<a href="http://fwilson.me">fwilson</a>
|
||||
<p>Thanks <a href="http://mywot.com">WOT</a> for checking the reputation of links we shorten</p>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p>© Copyright 2013 Polr</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
61
dev/appcalls.php
Normal file
61
dev/appcalls.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*Polr ver 0.1.
|
||||
* http://github.com/cydrobolt/polr
|
||||
*/
|
||||
//To use this, put this in your app
|
||||
// --> include('appcalls.php'); if appcalls.php is in the same directory as the script calling it
|
||||
// --> include('/path/to/appcalls.php'); if appcalls.php is in another dir
|
||||
|
||||
/* This script does not sanitize any input. It also doesn't check whether
|
||||
* the person calling it has an API key or not. Please only use this
|
||||
* for shortening urls from your other scripts.
|
||||
*/
|
||||
|
||||
//How to use:
|
||||
/*
|
||||
* Simply include this script, then use the functions
|
||||
* lookup($url); to lookup the baseval (the letters following the slash, e.g polr.cf/<baseval>)
|
||||
* of an url to find the longurl.
|
||||
*
|
||||
* shorten($url); shortens a url, returns the shortened url.
|
||||
*
|
||||
* The shortened url will be in a http://domain/baseval form. You will need the
|
||||
* .htaccess file provided in order to accomplish this. r.php must be in your
|
||||
* domain root.
|
||||
*
|
||||
*/
|
||||
|
||||
function lookup ($urltl) {
|
||||
global $mysqli;
|
||||
$val = $mysqli->real_escape_string($urltl);
|
||||
$query = "SELECT rurl FROM redirinfo WHERE baseval='{$val}'";
|
||||
$result = $mysqli->query($query) or die("QUERY ERROR");
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
return $row['rurl'];
|
||||
}
|
||||
|
||||
function shorten ($urlr) {
|
||||
global $mysqli;
|
||||
global $wsa;
|
||||
$query1 = "SELECT rid FROM redirinfo WHERE rurl='{$urlr}'";
|
||||
$result = $mysqli->query($query1);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$existing = $row['rid'];
|
||||
if(!$existing) {
|
||||
$query1 = "SELECT MAX(rid) AS rid FROM redirinfo;";
|
||||
$result = $mysqli->query($query1);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$ridr = $row['rid'];
|
||||
$baseval = base_convert($ridr+1,10,36);
|
||||
$query2 = "INSERT INTO redirinfo (baseval,rurl) VALUES ('{$baseval}','{$urlr}');";
|
||||
$result2r = $mysqli->query($query2) or showerror();
|
||||
return "http://{$wsa}/{$baseval}";
|
||||
}
|
||||
else {
|
||||
$query1 = "SELECT baseval FROM redirinfo WHERE rurl='{$urlr}'";
|
||||
$result = $mysqli->query($query1);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$baseval = $row['baseval'];
|
||||
return "http://{$wsa}/{$baseval}";
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
<!-- polr -->
|
||||
|
||||
<?php require_once("req.php");?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Polr</title>
|
||||
<title><?php echo $wsn;?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="bootstrap.css"/>
|
||||
<link rel="stylesheet" href="main.css"/>
|
||||
@ -12,10 +12,9 @@
|
||||
</head>
|
||||
<body style="padding-top:60px">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<a class="navbar-brand" href="index.html">Polr</a>
|
||||
<a class="navbar-brand" href="index.php"><?php echo $wsn;?></a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="//github.com/Cydrobolt/polr">Github</a></li>
|
||||
<li><a href="about.html">About</a></li>
|
||||
<li><a href="//github.com/Cydrobolt/polr">Polr Github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container">
|
||||
@ -23,7 +22,6 @@
|
||||
|
||||
|
||||
<?php
|
||||
require_once("req.php");
|
||||
if(!filterurl($_POST['urlr'])) {
|
||||
echo "You entered an invalid url<br>";
|
||||
echo "<a href='index.html'>Back</a>";
|
||||
@ -31,6 +29,17 @@ if(!filterurl($_POST['urlr'])) {
|
||||
}
|
||||
$urlr = $_POST['urlr'];
|
||||
$urlr = $mysqli->real_escape_string($urlr);
|
||||
//Other URL Shorteners List Array
|
||||
|
||||
$isshort = array('polr.cf','bit.ly','is.gd','tiny.cc','adf.ly','ur1.ca','goo.gl','ow.ly','j.mp');
|
||||
|
||||
foreach ($isshort as $url_shorteners) {
|
||||
if(strstr($urlr, $url_shorteners)) {
|
||||
echo "You entered an already shortened URL.<br>";
|
||||
echo "<a href='index.html'>Back</a>";
|
||||
die();
|
||||
}
|
||||
}
|
||||
$query1 = "SELECT rid FROM redirinfo WHERE rurl='{$urlr}'";
|
||||
$result = $mysqli->query($query1);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
@ -46,27 +55,23 @@ if(!$existing) {
|
||||
$baseval = base_convert($ridr+1,10,36);
|
||||
$query2 = "INSERT INTO redirinfo (baseval,rurl,ip) VALUES ('{$baseval}','{$urlr}','{$ip}');";
|
||||
$result2r = $mysqli->query($query2) or showerror();
|
||||
$basewsa = base64_encode($wsa);
|
||||
$basebv =base64_encode($baseval);
|
||||
echo "<input type='hidden' value='$basebv' id='j' /><input type='hidden' value='$basewsa' id='k' />";
|
||||
echo $decodescript;
|
||||
echo "<div style='text-align:center'>URL: <input type='text' id='i' class='form-control' value=\"Please enable Javascript\" />";
|
||||
}
|
||||
$basevaltd = "http://".$wsa."/".$baseval;
|
||||
echo "<div style='text-align:center'>URL:<input type='text' id='i' class='form-control' value=\"$basevaltd\" />";
|
||||
|
||||
}
|
||||
else {
|
||||
$query1 = "SELECT baseval FROM redirinfo WHERE rurl='{$urlr}'";
|
||||
$result = $mysqli->query($query1);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$baseval = $row['baseval'];
|
||||
$basebv = base64_encode($baseval);
|
||||
$basewsa = base64_encode($wsa);
|
||||
echo "<input type='hidden' value='$basebv' id='j' /><input type='hidden' value='$basewsa' id='k' />";
|
||||
echo $decodescript;
|
||||
echo "<div style='text-align:center'>URL:<input type='text' id='i' class='form-control' value=\"Please enable JavaScript\" />";
|
||||
}
|
||||
$basevaltd = "http://".$wsa."/".$baseval;
|
||||
echo "<div style='text-align:center'>URL:<input type='text' id='i' class='form-control' value=\"$basevaltd\" />";
|
||||
}
|
||||
echo "<a href='index.php'>Back</a>";
|
||||
echo "</div>";
|
||||
?>
|
||||
<footer>
|
||||
<p id="footer-pad">© Copyright 2013 Polr - Special Thanks to <a href="http://mywot.com">WOT</a></p>
|
||||
<p id="footer-pad"><?php echo $footer;?></p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
|
13
dev/durl.js
13
dev/durl.js
@ -1,13 +0,0 @@
|
||||
function z(t) {
|
||||
return atob(t);
|
||||
}
|
||||
$(function() {
|
||||
function y (a) {
|
||||
return z(a);
|
||||
}
|
||||
var var1 = $("#j").val();
|
||||
var var2 = y(var1);
|
||||
var var5 = $("#k").val();
|
||||
var var4 = y(var5);
|
||||
$("#i").val(var4+"/"+var2);
|
||||
});
|
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
echo '1';
|
@ -1,30 +0,0 @@
|
||||
<!-- polr -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Polr</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="bootstrap.css"/>
|
||||
<link rel="stylesheet" href="main.css"/>
|
||||
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body style="padding-top:60px">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<a class="navbar-brand" href="index.html">Polr</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="//github.com/Cydrobolt/polr">Github</a></li>
|
||||
<li><a href="about.html">About</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="jumbotron" style="text-align:center; padding-top:80px; background-color: rgba(0,0,0,0);">
|
||||
<h1>Polr</h1>
|
||||
<form method="POST" action="createurl.php" role="form"><input type="text" class="form-control" placeholder="URL" id="url" value="http://" name="urlr" /><br> <input type="submit" class="btn btn-info btn-large" value="Shorten!"/></form></div>
|
||||
</div>
|
||||
<footer>
|
||||
<p id="footer-pad">© Copyright 2013 Polr - Special Thanks to <a href="http://mywot.com">WOT</a></p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
58
dev/index.php
Normal file
58
dev/index.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
@(include('config.php')) or header('Location:setup.php');
|
||||
include('req.php');
|
||||
if($ppfrontend==true && !isset($_POST['pw'])) {
|
||||
echo "<h2>Enter password to proceed:</h2>";
|
||||
echo "<form action='index.php' method='post'><br><input type='password' name='pw' /><br><input type='submit' value='Log in' /></form>";
|
||||
die();
|
||||
}
|
||||
else if($_POST['pw']==$ppass) {
|
||||
echo "<!--logged in-->";
|
||||
}
|
||||
else if($ppfrontend!=true) {
|
||||
echo "<!--PP disabled-->";
|
||||
}
|
||||
else {
|
||||
echo "<b>Wrong Password, try again.</b>";
|
||||
echo "<form action='index.php' method='post'><br><input type='password' name='pw' /><br><input type='submit' value='Log in' /></form>";
|
||||
die();
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Polr Status</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="bootstrap.css"/>
|
||||
<link rel="stylesheet" href="main.css"/>
|
||||
</head>
|
||||
<body style="padding-top:60px">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<a class="navbar-brand" href="<?php require_once('req.php');echo 'http://'.$wsa;?>"><?php echo $wsn;?></a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="//github.com/Cydrobolt/polr">Polr Github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="jumbotron" style="padding-top:80px; background-color: rgba(0,0,0,0);">
|
||||
<h1>Welcome to your Polr Instance</h1>
|
||||
<?php
|
||||
if ($wp==1) {
|
||||
echo "<p style='color: red'>Your Polr instance is improperly configured. Delete config.php and reinstall.</p>";
|
||||
}
|
||||
else {
|
||||
echo "<p style='color: green'>Your Polr instance is properly configured.</p>";
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<h2>Shorten a link:</h2>
|
||||
<br><form method="POST" action="createurl.php" role="form"><input type="text" class="form-control" placeholder="URL" id="url" value="http://" name="urlr" /><br> <input type="submit" class="btn btn-info btn-large" value="Shorten it!"/></form><br>
|
||||
<br>If you need help, click <a href="http://webchat.freenode.net/?channels=#polr">here</a> to contact a developer<br>
|
||||
<b>Clueless? Read the docs. <a href='https://github.com/Cydrobolt/polr/wiki'>https://github.com/Cydrobolt/polr/wiki</a></b></div>
|
||||
</div>
|
||||
<div class='footer-pad'>
|
||||
<p><?php echo $footer;?></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
dev/logo.png
BIN
dev/logo.png
Binary file not shown.
Before Width: | Height: | Size: 9.1 KiB |
@ -4,3 +4,7 @@ footer {
|
||||
position:absolute;
|
||||
font-size:75%;
|
||||
}
|
||||
.footer-pad {
|
||||
padding-left:11%;
|
||||
font-size: 75%;
|
||||
}
|
||||
|
4
dev/mainalt.css
Normal file
4
dev/mainalt.css
Normal file
@ -0,0 +1,4 @@
|
||||
footer {
|
||||
padding-left:5%;
|
||||
font-size:75%;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 115 KiB |
@ -14,7 +14,7 @@ $result = $mysqli->query($query) or showerror();
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
|
||||
if(!$row['rurl']) {
|
||||
header("Location: 404.html",true,301);
|
||||
header("Location: 404.php",true,301);
|
||||
}
|
||||
else {
|
||||
header("Location: {$row['rurl']}",true,301);
|
||||
|
25
dev/req.php
25
dev/req.php
@ -1,18 +1,13 @@
|
||||
<?php
|
||||
//POLR CONFIGURATION
|
||||
|
||||
$host = "localhost"; //Enter Mysql host address
|
||||
$user = "root"; //Mysql user
|
||||
$passwd = ""; //Mysql user password
|
||||
$db = "polr"; //Mysql DB name
|
||||
$wsa = "localhost/polr/php"; //Address of website : e.g polr.cf - do not include http://
|
||||
$ip = $_SERVER['REMOTE_ADDR']; //How Polr should fetch the user's ip - some hosts require you to use getenv()
|
||||
@(include('ovr.php')); //If OVR.php is there, load that config instead
|
||||
//POLR CONFIGURATION LOADING
|
||||
|
||||
|
||||
@(require_once('config.php'));
|
||||
include('version.php');
|
||||
$footer = "© Copyright 2014 $wsn. Powered by <a href='http://github.com/cydrobolt/polr'>Polr</a> ver $version build $reldate";
|
||||
|
||||
//connect to mysql with $mysqli variable
|
||||
$mysqli = new mysqli($host,$user,$passwd,$db) or die("Error : Could not establish database connection");
|
||||
$mysqli = new mysqli($host,$user,$passwd,$db) or $wp=1; //If cannot connect, then set var $wp to 1
|
||||
|
||||
//SQL Functions
|
||||
|
||||
@ -20,7 +15,7 @@ $mysqli = new mysqli($host,$user,$passwd,$db) or die("Error : Could not establis
|
||||
function sqlrun ($query) {
|
||||
global $mysqli;
|
||||
$queryrs = $query;
|
||||
$resultrs = $mysqli->query($queryrs) or die("ERROR in $query");
|
||||
$resultrs = $mysqli->query($queryrs) or $mysqli->error;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -69,11 +64,3 @@ function filterurl ($url) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
$(function() {
|
||||
console.log( "ready!" );
|
||||
var todec = $("#todec").val();
|
||||
var decoded = window.atob(todec);
|
||||
$(".form-control").val("http://polr.cf/"+decoded);
|
||||
});
|
||||
*/
|
||||
|
106
dev/setup.php
Normal file
106
dev/setup.php
Normal file
@ -0,0 +1,106 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Polr Setup</title>
|
||||
<link rel="stylesheet" href="bootstrap.css"/>
|
||||
<link rel="stylesheet" href="main.css"/>
|
||||
</head>
|
||||
<body style="padding-top:60px">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<a class="navbar-brand" href="//github.com/Cydrobolt/polr">Polr</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="//github.com/Cydrobolt/polr">Github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='container-fluid' style="text-align: center">
|
||||
<span><h1>Polr setup</h1></span><br>
|
||||
<?php
|
||||
@(include('config.php'));
|
||||
if (isset($ppass)) {
|
||||
if(!isset($_POST['pw'])) {
|
||||
echo "<h2>Enter password to proceed:</h2>";
|
||||
echo "<form action='setup.php' method='post'><br><input type='password' name='pw' /><br><input type='submit' value='Log in' /></form>";
|
||||
die();
|
||||
}
|
||||
else if($_POST['pw']==$ppass) {
|
||||
echo "";
|
||||
}
|
||||
else {
|
||||
echo "Wrong password";
|
||||
echo "<h2>Enter password to proceed:</h2>";
|
||||
echo "<form action='setup.php' method='post'><br><input type='password' name='pw' /><br><input type='submit' value='Log in' /></form>";
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
if (isset($_POST['dbserver'])) {
|
||||
$data = '<?php
|
||||
$host="'.$_POST['dbserver'].'";'.
|
||||
'$user="'.$_POST['dbuser'].'";'.
|
||||
'$passwd="'.$_POST['dbpass'].'";'.
|
||||
'$db="'.$_POST['dbname'].'";'.
|
||||
'$wsa = "'.$_POST['appurl'].'";'.
|
||||
'$wsn = "'.$_POST['appname'].'";'.
|
||||
'$ppass = "'.$_POST['protpass'].'";'.
|
||||
'$ppfrontend = "'.$_POST['pp'].'";'.
|
||||
'$ip = $_SERVER[\'REMOTE_ADDR\'];
|
||||
?>';
|
||||
$file = "config.php";
|
||||
|
||||
$handle = fopen($file, 'a');
|
||||
if (fwrite($handle, $data) === FALSE) { echo "Can not write to (".$file.")"; }
|
||||
echo "Succesfully created config. ";
|
||||
fclose($handle);
|
||||
require_once('req.php');
|
||||
|
||||
//Create Tables
|
||||
sqlrun("CREATE TABLE redirinfo"
|
||||
. "("
|
||||
. "rid INT NOT NULL AUTO_INCREMENT,"
|
||||
. "PRIMARY KEY(rid),"
|
||||
. "rurl CHAR(80),"
|
||||
. "baseval CHAR(40),"
|
||||
. "ip CHAR(90)"
|
||||
. ")");
|
||||
sqlrun("CREATE TABLE api"
|
||||
. "("
|
||||
. "apikey CHAR(100) NOT NULL,"
|
||||
. "PRIMARY KEY(apikey),"
|
||||
. "email CHAR(80),"
|
||||
. "valid TINYINT(1)"
|
||||
. ")");
|
||||
sqlrun("CREATE INDEX index ON redirinfo (rurl, baseval, ip)");
|
||||
sqlrun("CREATE INDEX aindex ON api (valid,email)");
|
||||
echo "You are now finished Polr Setup. You can now close this window or click <a href='index.php'>here</a> to check the status of the installation. <br><br>If you need help, click <a href=\"http://webchat.freenode.net/?channels=#polr\">here</a><br>"
|
||||
. "<br><br><b>Clueless? Read the docs. <a href='https://github.com/Cydrobolt/polr/tree/master/docs'>https://github.com/Cydrobolt/polr/tree/master/docs</a></b>";
|
||||
}
|
||||
else {
|
||||
include('version.php');
|
||||
echo "<form name=\"Config Creation\" method=\"post\" action=\"".'setup.php'."\">";
|
||||
echo "Database Host: <input type=\"text\" name=\"dbserver\" value=\"localhost\"><br>";
|
||||
echo "Database User: <input type=\"text\" name=\"dbuser\" value=\"root\"><br>";
|
||||
echo "Database Pass: <input type=\"password\" name=\"dbpass\" value=\"password\"><br>";
|
||||
echo "Database Name: <input type=\"text\" name=\"dbname\" value=\"polr\"><br>";
|
||||
echo "Application Name: <input type=\"text\" name=\"appname\" value=\"polr\"><br>";
|
||||
echo "Application URL (path to Polr, no http:// or www.) : <input type=\"text\" name=\"appurl\" value=\"yoursite.com\"><br>";
|
||||
echo "App Access Password: <input type=\"text\" name=\"protpass\" value=\"password123\"><br>";
|
||||
if(isset($_POST['pw'])) {
|
||||
echo "<input type='hidden' value='{$_POST['pw']}' name='pw' />";
|
||||
}
|
||||
echo "<input type=\"checkbox\" name=\"pp\" value=\"Password-Protect\">Password Protect the Frontend (shortener)<br><br>";
|
||||
echo "<input type=\"submit\" value=\"Create/Update config\"><input type=\"reset\" value=\"Clear Fields\">";
|
||||
echo "</form>";
|
||||
echo "<br><br></div><div class='container'><b>Make sure the databse you specify is already created. The database user needs to"
|
||||
. "already have been created. If you enter the wrong information, go in the installation "
|
||||
. "directory and delete config.php.<br>Please grant the mysql user all privileges"
|
||||
. "during the setup, and then restrict the user to only CREATE, UPDATE, INSERT, DELETE, and SELECT.</b>";
|
||||
echo "<br><br>Polr is <a href='http://en.wikipedia.org/wiki/Open-source_software'>Open-Source software</a> licensed under the <a href='https://www.gnu.org/copyleft/gpl.html'>GPL</a>. By continuing to use Polr, you agree to the terms of the GPL.";
|
||||
echo "<footer>Polr Version $version released $reldate - <a href='//github.com/cydrobolt/polr'>Github</a></footer>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
3
dev/version.php
Normal file
3
dev/version.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$version = "0.15 RC1";
|
||||
$reldate = "2/15/2014";
|
Loading…
Reference in New Issue
Block a user