This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

create

  • Loading branch information...
Admin Admin
Admin authored and Admin committed May 1, 2011
0 parents commit 67e18867945edd22bf7179f9ac0bc1d8b6fbd52e
No changes.
@@ -0,0 +1,17 @@
+RewriteEngine on
+
+
+RewriteRule ^quote/([0-9]+)/?$ index.php?postid=$1 [L]
+RewriteRule ^users/([0-9]+)/?$ index.php?do=users&id=$1 [L]
+RewriteRule ^best$ index.php/?act=best [L]
+RewriteRule ^bestusers$ index.php/?act=bestusers [L]
+RewriteRule ^rand$ index.php/?act=rand [L]
+RewriteRule ^abyss$ index.php/?act=abyss [L]
+RewriteRule ^users$ index.php/?do=users [L]
+RewriteRule ^addpost$ index.php/?do=addpost [L]
+
+
+
+RewriteCond %{HTTP_REFERER} (weight) [NC,OR]
+RewriteCond %{HTTP_REFERER} (drugs) [NC]
+RewriteRule .* - [F]

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,11 @@
+<?php
+if (!defined('PROTECT')) { header('Location: ./'); exit(); };
+
+$db_host = 'localhost';
+$db_user = 'vitalvasw_bash';
+$db_pass = '4rzZea62_';
+$db_name = 'vitalvasw_bash';
+
+$debug = false;
+
+?>

Large diffs are not rendered by default.

Oops, something went wrong.
No changes.
178 index.php
@@ -0,0 +1,178 @@
+<?php
+define('PROTECT', true);
+if (file_exists('config.php')) {
+ require_once('config.php');
+} else {
+ if (file_exists('install.php'))
+ header('Location: ./install.php');
+ else {
+ echo 'Error load "config.php"';
+ exit();
+ }
+};
+if ($debug) error_reporting(E_ALL);
+$dbh = mysql_connect($db_host,$db_user,$db_pass) or die('No connected : '.mysql_error());
+mysql_select_db($db_name,$dbh) or die("Can't select db : ".mysql_error());
+mysql_query("SET NAMES cp1251");
+function load_tpl($name) {
+ if (file_exists("tpl/$name.tpl"))
+ return file_get_contents("tpl/$name.tpl");
+ else {
+ echo "Error load $name.tpl";
+ exit();
+ }
+}
+function sql_array($name) {
+ $query = mysql_query($name);
+ if (!$query)
+ return false;
+ else {
+ $row = mysql_fetch_array($query);
+ if (!$row)
+ return false;
+ else
+ return $row;
+ }
+}
+$tpl_main = load_tpl('main');
+$tpl_content = load_tpl('content');
+//-------SHAPKA---------------------------
+$row = sql_array("SELECT COUNT(id) AS num FROM quotes");
+$quote_count = $row['num'];
+if ($quote_count > '0') {
+ $row = sql_array("SELECT text,id FROM quotes WHERE status = 'enabled' AND count <= (SELECT MIN(count) FROM quotes) ORDER BY RAND() LIMIT 1");
+ $quote = $row['text'];
+ $quote_id = $row['id'];
+ $rowq = mysql_query("UPDATE quotes SET count=count+1 WHERE id='$quote_id'");
+};
+$row = sql_array("SELECT COUNT(id) AS num FROM users");
+$users_count = $row['num'];
+$row = sql_array("SELECT COUNT(id) AS num FROM posts");
+$posts_count = $row['num'];
+//----------LOAD--CONFIG-----------------
+$row = sql_array("SELECT value AS name FROM config WHERE ckey='site_name'");
+$site_name = $row['name'];
+$row = sql_array("SELECT value AS name FROM config WHERE ckey='site_lang'");
+$site_lang = $row['name'];
+//-------------------COUNT--POSTS--------------------
+if ($posts_count > '0') {
+ $row = sql_array("SELECT COUNT(id) AS num FROM posts WHERE status='enabled'");
+ $posts_enabled = $row['num'];
+ $row = sql_array("SELECT COUNT(id) AS num FROM posts WHERE status='deleted'");
+ $posts_deleted = $row['num'];
+} else {
+ $posts_enabled = '0';
+ $posts_deleted = '0';
+};
+//---------------CHECK--USER--------------------
+if (isset($_COOKIE['user_login']) && isset($_COOKIE['user_passw'])) {
+ $user_login = $_COOKIE['user_login'];
+ $user_passw = $_COOKIE['user_passw'];
+ $row = sql_array("SELECT COUNT(id) AS name FROM users WHERE sha1(username)='$user_login'");
+ $check = $row['name'];
+ if ($check == '1') {
+ $row = sql_array("SELECT password FROM users WHERE sha1(username)='$user_login'");
+ $check_pass = $row['password'];
+ if ($check_pass == $user_passw) {
+ $row = sql_array("SELECT id,username,prem FROM users WHERE sha1(username)='$user_login'");
+ $pub_user_name = $row['username'];
+ $pub_user_id = $row['id'];
+ $pub_user_prem = $row['prem'];
+ $none_auth = 'none';
+ } else {
+ $none_auth = 'go';
+ $pub_user_prem = 'user';
+ }
+ } else {
+ $none_auth = 'go';
+ $pub_user_prem = 'user';
+ }
+} else {
+ $none_auth = 'go';
+ $pub_user_prem = 'user';
+}
+//-----------------------------------------------
+if (isset($_GET['do'])) $do = $_GET['do']; else $do = 'NULL';
+if (!isset($content)) $content = '';
+$site_title = $site_name;
+switch ($do) {
+ case 'rating':
+ if (file_exists('mod/rating.php'))
+ require_once('mod/rating.php');
+ else
+ $content = '<br><b>Error load module rating.php in directory "mod"</b>';
+ break;
+ case 'users':
+ if (file_exists('mod/users.php'))
+ require_once('mod/users.php');
+ else
+ $content = '<br><b>Error load module users.php in directory "mod"</b>';
+ break;
+ case 'login':
+ if (file_exists('mod/login.php'))
+ require_once('mod/login.php');
+ else
+ $content = '<br><b>Error load module login.php in directory "mod"</b>';
+ break;
+ case 'addpost':
+ if (file_exists('mod/addpost.php'))
+ require_once('mod/addpost.php');
+ else
+ $content = '<br><b>Error load module addpost.php in directory "mod"</b>';
+ break;
+ case 'logout':
+ if (file_exists('mod/logout.php'))
+ require_once('mod/logout.php');
+ else
+ $content = '<br><b>Error load module logout.php in directory "mod"</b>';
+ break;
+ case 'register':
+ if (file_exists('mod/register.php'))
+ require_once('mod/register.php');
+ else
+ $content = '<br><b>Error load module register.php in directory "mod"</b>';
+ break;
+ case 'admin':
+ if (file_exists('mod/admin.php'))
+ require_once('mod/admin.php');
+ else
+ $content = '<br><b>Error load module admin.php in directory "mod"</b>';
+ break;
+ default:
+ if (file_exists('mod/posts.php'))
+ require_once('mod/posts.php');
+ else
+ $content = '<br><b>Error load module posts.php in directory "mod"</b>';
+ break;
+};
+if ($none_auth == 'go') {
+ $userpanel = load_tpl('userpanel_in');
+} elseif ($none_auth == 'none') {
+ $userpanel = load_tpl('userpanel_auth');
+ if ($pub_user_prem == 'admin') {
+ $userpanel .= "&nbsp;[<a href='/?do=admin'>{lang-adminka}</a>]";
+ }
+}
+if (!isset($posts_count)) $posts_count = '0';
+if (!isset($users_count)) $users_count = '0';
+if (!isset($quote)) $quote = '&nbsp;';
+if (!isset($content)) $content = '';
+if (!isset($pub_user_name)) $pub_user_name = '';
+$out = str_replace("{title}", $site_title, $tpl_main);
+$out = str_replace("{title-site}", $site_name, $out);
+$out = str_replace("{content}", $content, $out);
+$out = str_replace("{userpanel}", $userpanel, $out);
+$out = str_replace("{username}", $pub_user_name, $out);
+$out = str_replace("{posts-count}", $posts_count, $out);
+$out = str_replace("{posts-enabled}", $posts_enabled, $out);
+$out = str_replace("{posts-deleted}", $posts_deleted, $out);
+$out = str_replace("{users-count}", $users_count, $out);
+$out = str_replace("{random-quotes}", $quote, $out);
+$out = str_replace("\n", '', $out);
+$query = mysql_query("SELECT langkey,langvalue FROM lang WHERE langname='$site_lang' ORDER BY langkey");
+while ($row = mysql_fetch_array($query)){
+ $langkey = $row['langkey'];
+ $out = str_replace("{lang-$langkey}", $row['langvalue'], $out);
+}
+echo $out;
+?>
@@ -0,0 +1,86 @@
+<?php
+if (!defined('PROTECT')) { header('Location: ../'); exit(); };
+$tpl_content = load_tpl('content');
+if (!isset($_POST['text'])) {
+ if ($none_auth == 'go') {
+ $tpl_addpost = load_tpl('addpost1');
+ } else {
+ $tpl_addpost = load_tpl('addpost');
+ }
+ if ($none_auth == 'none') {
+ $guest_mess = '';
+ $guest_check_img = '';
+ } elseif ($none_auth == 'go') {
+ $guest_mess = '{lang-add-post-non-auth}';
+ $rand = rand(1, 10);
+ $rand2 = rand(1, 10);
+ $randa = array('+','-','*');
+ $randk = rand(0, 2);
+ $randl = $randa["$randk"];
+ $sum = "$rand $randl $rand2";
+ if ($randk == '0') { $hash = $rand+$rand2; } elseif ($randk == '1') { $hash = $rand-$rand2; } elseif ($randk == '2') { $hash = $rand*$rand2; }
+ $hash = md5($hash);
+ $guest_check_img = "$sum = <input type='text' name='img'><input type='hidden' name='hash' value='$hash'>";
+ }
+ $out = str_replace("{add-post-guest-message}", $guest_mess, $tpl_addpost);
+ $out = str_replace("{guest-check-image}", $guest_check_img, $out);
+ $out = str_replace("{textarea-text}", '', $out);
+} elseif (isset($_POST['text']) && isset($_POST['hash']) && $none_auth == 'go') {
+ $add_text = $_POST['text'];
+ $hash = $_POST['hash'];
+ $user_hash = $_POST['img'];
+ if (md5($user_hash) != $hash) {
+ $tpl_addpost = load_tpl('addpost');
+ if ($none_auth == 'none') {
+ $guest_mess = '';
+ $guest_check_img = '';
+ } elseif ($none_auth == 'go') {
+ $guest_mess = '{lang-add-post-non-auth}';
+ $rand = rand(1, 10);
+ $rand2 = rand(1, 10);
+ $randa = array('+','-','*');
+ $randk = rand(0, 2);
+ $randl = $randa["$randk"];
+ $sum = "$rand $randl $rand2";
+ if ($randk == '0') { $hash = $rand+$rand2; } elseif ($randk == '1') { $hash = $rand-$rand2; } elseif ($randk == '2') { $hash = $rand*$rand2; }
+ $hash = md5($hash);
+ $guest_check_img = "$sum = <input type='text' name='img'>&nbsp;<b><font color='red'>!</font></b><input type='hidden' name='hash' value='$hash'>";
+ }
+ $out = str_replace("{add-post-guest-message}", $guest_mess, $tpl_addpost);
+ $out = str_replace("{guest-check-image}", $guest_check_img, $out);
+ $out = str_replace("{textarea-text}", $add_text, $out);
+ } else {
+ if ($add_text != '') {
+ $add_text = trim($add_text);
+ $add_text = addslashes(htmlspecialchars($add_text));
+ $add_text = nl2br($add_text);
+ $query = mysql_query("INSERT INTO posts (text,author) VALUES ('$add_text','0')");
+ if ($query) {
+ $out = "{lang-add-post-ok}";
+ } else {
+ $out = "{lang-add-post-error}";
+ }
+ } else {
+ $out = "{lang-add-post-error}";
+ }
+ }
+} elseif (isset($_POST['text']) && $none_auth == 'none') {
+ $add_text = $_POST['text'];
+ if ($add_text != '') {
+ $add_text = trim($add_text);
+ $add_text = addslashes(htmlspecialchars($add_text));
+ $add_text = nl2br($add_text);
+ $query = mysql_query("INSERT INTO posts (text,author) VALUES ('$add_text','$pub_user_id')");
+ if ($query) {
+ $out = "{lang-add-post-ok}";
+ } else {
+ $out = "{lang-add-post-error}";
+ }
+ } else {
+ $out = "{lang-add-post-error}";
+ }
+} else {
+ header('Location: ./');
+}
+$content = str_replace("{content-tpl}", $out, $tpl_content);
+?>
Oops, something went wrong.

0 comments on commit 67e1886

Please sign in to comment.