Verified Commit cf3e184c authored by noplanman's avatar noplanman
Browse files

Move config.php to the root level, as it doesn't only have the DB connection info.

Instead of just including the config, it must be required, as it is an essential file.
Move require statement below $_GET checks.
parent cfd2f89c
config.php
<?php <?php
//Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. //Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file.
if ($_GET['key'] != "4r45tg") {die;} if ($_GET['key'] != "4r45tg") {die;}
include('db/config.php');
require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
$tt=0; $tt=0;
include('db/config.php'); require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
/* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
//backup directory //backup directory
$backup_dir = "/var/www/podup/backup"; $backup_dir = '/var/www/podup/backup';
//log directory //log directory
$log_dir = "/var/www/podup/log"; $log_dir = '/var/www/podup/log';
//location of pg dump //location of pg dump
$pg_dump_dir = "/usr/bin"; $pg_dump_dir = '/usr/bin';
//db username //db username
$pguser=''; $pguser = '';
//db password //db password
$pgpass=''; $pgpass = '';
//db name //db name
$pgdb=''; $pgdb = '';
//admin email for forms //admin email for forms
$adminemail = ''; $adminemail = '';
//admin key for deleting pods, set this as a cookie on your own //admin key for deleting pods, set this as a cookie on your own
...@@ -20,4 +20,3 @@ $adminkey = ''; ...@@ -20,4 +20,3 @@ $adminkey = '';
$chimpkey = ''; $chimpkey = '';
//apikey for public api calls //apikey for public api calls
$apikey= ''; $apikey= '';
?>
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ --> <!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
<?php <?php
$valid=0; $valid=0;
include('config.php'); require_once __DIR__ . '/../logging.php';
include('../logging.php');
$log = new Logging(); $log = new Logging();
$log->lfile($log_dir."/add.php.log"); $log->lfile($log_dir."/add.php.log");
if (!$_POST['url']){ if (!$_POST['url']){
...@@ -25,6 +25,9 @@ if (strlen($_POST['url']) < 14){ ...@@ -25,6 +25,9 @@ if (strlen($_POST['url']) < 14){
echo "API key bad needs to be like m58978-80abdb799f6ccf15e3e3787ee";$log->lwrite('api key too short '.$_POST['domain']); echo "API key bad needs to be like m58978-80abdb799f6ccf15e3e3787ee";$log->lwrite('api key too short '.$_POST['domain']);
die; die;
} }
require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
//Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. //Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file.
//this is just a single api for a pod for the android app to get data //this is just a single api for a pod for the android app to get data
include('config.php'); require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
include('config.php'); require_once __DIR__ . '/../config.php';
$keep = (60 * 60 * 6) * 1; $keep = (60 * 60 * 6) * 1;
$dump_date = date("Ymd_Hs"); $dump_date = date("Ymd_Hs");
$file_name = $backup_dir . "/dump_" . $dump_date . ".sql"; $file_name = $backup_dir . "/dump_" . $dump_date . ".sql";
......
<?php <?php
include('config.php');
if (!$_GET['domain']){ if (!$_GET['domain']){
echo "no pod domain given"; echo "no pod domain given";
die; die;
...@@ -13,6 +12,9 @@ if (strlen($_GET['token']) < 6){ ...@@ -13,6 +12,9 @@ if (strlen($_GET['token']) < 6){
die; die;
} }
$domain = $_GET['domain']; $domain = $_GET['domain'];
require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
include('config.php');
$systemTimeZone = system('date +%Z'); $systemTimeZone = system('date +%Z');
if (!$_POST['domain']){ if (!$_POST['domain']){
echo "no pod domain given"; echo "no pod domain given";
die; die;
} }
$domain = $_POST['domain']; $domain = $_POST['domain'];
require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
include('config.php');
if (!$_POST['domain']){ if (!$_POST['domain']){
echo "no pod domain given"; echo "no pod domain given";
die; die;
...@@ -12,8 +11,10 @@ if (!$_POST['action']){ ...@@ -12,8 +11,10 @@ if (!$_POST['action']){
echo "no action selected"; echo "no action selected";
die; die;
} }
$domain = $_POST['domain']; $domain = $_POST['domain'];
require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
...@@ -3,7 +3,7 @@ $debug = isset($_GET['debug'])?1:0; ...@@ -3,7 +3,7 @@ $debug = isset($_GET['debug'])?1:0;
$debug=1; $debug=1;
//$debug = isset($argv[1])?1:0; //$debug = isset($argv[1])?1:0;
//* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ //* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
include('config.php'); require_once __DIR__ . '/../config.php';
//get master code version for diaspora pods //get master code version for diaspora pods
$mv = curl_init(); $mv = curl_init();
......
<?php <?php
include('config.php');
if (!$_POST['username']){ if (!$_POST['username']){
echo "no username given"; echo "no username given";
die; die;
...@@ -20,6 +19,9 @@ if (!$_POST['rating']){ ...@@ -20,6 +19,9 @@ if (!$_POST['rating']){
echo "no rating given"; echo "no rating given";
die; die;
} }
require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
$debug=1; $debug=1;
//* Copyright (c) 2011-2016, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ //* Copyright (c) 2011-2016, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
include('config.php'); require_once __DIR__ . '/../config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {die("Error in connection: " . pg_last_error());} if (!$dbh) {die("Error in connection: " . pg_last_error());}
$domain = isset($_GET['domain'])?$_GET['domain']:null; $domain = isset($_GET['domain'])?$_GET['domain']:null;
......
<?php <?php
include('db/config.php'); require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
...@@ -36,7 +36,8 @@ $("#slider").slider({ animate: true, max: 10, min: 1, step: 1, value: 10, stop: ...@@ -36,7 +36,8 @@ $("#slider").slider({ animate: true, max: 10, min: 1, step: 1, value: 10, stop:
<body> <body>
<div style="height:500px;width:900px;"> <div style="height:500px;width:900px;">
<?php <?php
include('db/config.php'); require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
<?php <?php
$tt=0; $tt=0;
include('db/config.php'); require_once __DIR__ . '/config.php';
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"]; $country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
......
<?php <?php
$tt=0; $tt=0;
include('db/config.php'); require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
...@@ -19,7 +19,8 @@ var geoJsonData = { ...@@ -19,7 +19,8 @@ var geoJsonData = {
"type": "FeatureCollection", "type": "FeatureCollection",
"features": [ "features": [
<?php <?php
include('db/config.php'); require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) { if (!$dbh) {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment