-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2ac5449
Showing
140 changed files
with
25,181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file was created by JetBrains PhpStorm 3.0 for binding GitHub repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
$connection = mysql_connect("localhost", "root", ""); | ||
|
||
if (!$connection) { | ||
die("<strong>Połączenie z bazą danych nie powiodło się: </strong>" . mysql_error() ); | ||
} | ||
$db_select = mysql_select_db("gerry", $connection); | ||
if (!$db_select) { | ||
die("<strong>Nie znaleziono bazy danych: </strong>" . mysql_error() ); | ||
} | ||
|
||
// add new item | ||
if (isset($_POST[position]) && isset($_POST[link_txt]) && isset($_POST[link_url]) && isset($_POST[text])) { | ||
$position = mysql_real_escape_string($_POST[position]); | ||
$link_txt = mysql_real_escape_string($_POST[link_txt]); | ||
$link_url = mysql_real_escape_string($_POST[link_url]); | ||
$text = mysql_real_escape_string($_POST[text]); | ||
|
||
mysql_query("INSERT INTO items (position, link-txt, link-url, text) VALUES('{$position}', '{$link_txt}', '{$link_url}', '{$text}')"); | ||
} | ||
mysql_close($connection); | ||
header("Location: index.php"); | ||
?> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
-- MySQL dump 10.13 Distrib 5.1.54, for debian-linux-gnu (x86_64) | ||
-- | ||
-- Host: localhost Database: gerry | ||
-- ------------------------------------------------------ | ||
-- Server version 5.1.54-1ubuntu4 | ||
|
||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
/*!40101 SET NAMES utf8 */; | ||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
/*!40103 SET TIME_ZONE='+00:00' */; | ||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
|
||
-- | ||
-- Table structure for table `items` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `items`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!40101 SET character_set_client = utf8 */; | ||
CREATE TABLE `items` ( | ||
`id` int(10) NOT NULL AUTO_INCREMENT, | ||
`position` int(10) NOT NULL, | ||
`link_txt` varchar(512) NOT NULL, | ||
`link_url` varchar(512) NOT NULL, | ||
`item_text` text NOT NULL, | ||
`filename` varchar(50) NOT NULL, | ||
`size` int(12) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
-- | ||
-- Dumping data for table `items` | ||
-- | ||
|
||
LOCK TABLES `items` WRITE; | ||
/*!40000 ALTER TABLE `items` DISABLE KEYS */; | ||
INSERT INTO `items` VALUES (7,0,'asdf asdf','sadfasdf','asdf sdf sdf','zamek.jpg',258818),(8,0,'rrr aaa sss','sdf sdfs sdf','sdf sdf sdf sdf','plakat-4.jpg',84910); | ||
/*!40000 ALTER TABLE `items` ENABLE KEYS */; | ||
UNLOCK TABLES; | ||
|
||
-- | ||
-- Table structure for table `users` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `users`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!40101 SET character_set_client = utf8 */; | ||
CREATE TABLE `users` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`username` varchar(20) NOT NULL, | ||
`password` varchar(32) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin2; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
-- | ||
-- Dumping data for table `users` | ||
-- | ||
|
||
LOCK TABLES `users` WRITE; | ||
/*!40000 ALTER TABLE `users` DISABLE KEYS */; | ||
INSERT INTO `users` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3'),(8,'goszu','1a2d9606d9a30d8219b0541c47538f16'); | ||
/*!40000 ALTER TABLE `users` ENABLE KEYS */; | ||
UNLOCK TABLES; | ||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | ||
|
||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | ||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | ||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | ||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | ||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | ||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | ||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | ||
|
||
-- Dump completed on 2012-01-06 23:01:34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
// Database Constants | ||
defined("DB_SERVER") ? null : define("DB_SERVER", "localhost"); | ||
defined("DB_USER") ? null : define("DB_USER", "root"); | ||
defined("DB_PASS") ? null : define("DB_PASS", "root"); | ||
defined("DB_NAME") ? null : define("DB_NAME", "gerry"); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
require_once(LIB_PATH.DS."config.php"); | ||
|
||
class MySQLDatabase { | ||
|
||
private $connection; | ||
public $last_query; | ||
private $magic_quotes_active; | ||
private $real_escape_string_exists; | ||
|
||
function __construct() { | ||
$this->open_connection(); | ||
$this->magic_quotes_active = get_magic_quotes_gpc(); | ||
$this->real_escape_string_exists = function_exists( "mysql_real_escape_string" ); | ||
} | ||
|
||
public function open_connection() { | ||
$this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS); | ||
if (!$this->connection) { | ||
die("Database connection failed: " . mysql_error()); | ||
} else { | ||
$db_select = mysql_select_db(DB_NAME, $this->connection); | ||
if(!$db_select) { | ||
die("Database connection failed: " . mysql_error()); | ||
} | ||
} | ||
} | ||
|
||
public function close_connection() { | ||
if(isset($this->connection)) { | ||
mysql_close($this->connection); | ||
unset($this->connection); | ||
} | ||
} | ||
|
||
public function query($sql) { | ||
$this->last_query = $sql; | ||
$result = mysql_query($sql, $this->connection); | ||
$this->confirm_query($result); | ||
return $result; | ||
} | ||
|
||
public function escape_value( $value ) { | ||
if( $this->real_escape_string_exists ) { // PHP v4.3.0 or higher | ||
// undo any magic quote effects so mysql_real_escape_string can do the work | ||
if( $this->magic_quotes_active ) { $value = stripslashes( $value ); } | ||
$value = mysql_real_escape_string( $value ); | ||
} else { // before PHP v4.3.0 | ||
// if magic quotes aren't already on then add slashes manually | ||
if( !$this->magic_quotes_active ) { $value = addslashes( $value ); } | ||
// if magic quotes are active, then the slashes already exist | ||
} | ||
return $value; | ||
} | ||
|
||
// "database-neutral" methods | ||
public function fetch_array($result_set) { | ||
return mysql_fetch_array($result_set); | ||
} | ||
|
||
public function num_rows($result_set) { | ||
return mysql_num_rows($result_set); | ||
} | ||
|
||
public function insert_id() { | ||
// get the last id inserted over the current db connection | ||
return mysql_insert_id($this->connection); | ||
} | ||
|
||
public function affected_rows() { | ||
return mysql_affected_rows($this->connection); | ||
} | ||
|
||
private function confirm_query($result) { | ||
if (!$result) { | ||
$output = "Database query failed: " . mysql_error() . "<br />"; | ||
//$output .= "Last SQL query: " . $this->last_query; | ||
die( $output ); | ||
} | ||
} | ||
} | ||
|
||
$database = new MySQLDatabase; | ||
$db =& $database; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
function __autoload($class_name) { | ||
$class_name = strtolower($class_name); | ||
$path = LIB_PATH.DS."{$class_name}.php"; | ||
if(file_exists($path)) { | ||
require_once($path); | ||
} else { | ||
die("The file {$class_name}.php could not be found."); | ||
} | ||
} | ||
|
||
function output_message($message="") { | ||
if (!empty($message)) { | ||
return "<p class=\"message\">{$message}</p>"; | ||
} else { | ||
return "test <br />"; | ||
} | ||
} | ||
|
||
function redirect_to( $location = NULL ) { | ||
if ($location != NULL) { | ||
header("Location: {$location}"); | ||
exit; | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); | ||
|
||
defined('SITE_ROOT') ? null : | ||
define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT'].DS.'gerry'); | ||
|
||
define('LIB_PATH', SITE_ROOT.DS.'includes'); | ||
|
||
// load config file first | ||
require_once(LIB_PATH.DS.'config.php'); | ||
|
||
// load basic functions next so that everything after can use them | ||
require_once(LIB_PATH.DS.'functions.php'); | ||
|
||
// load core objects | ||
require_once(LIB_PATH.DS.'session.php'); | ||
require_once(LIB_PATH.DS.'database.php'); | ||
|
||
// load database-related classes | ||
require_once(LIB_PATH.DS.'user.php'); | ||
require_once(LIB_PATH.DS.'item.php'); | ||
|
||
?> |
Oops, something went wrong.