code
stringlengths
1
2.01M
language
stringclasses
1 value
<?php function GetVersion() { $query = "SELECT * FROM updates ORDER BY version DESC"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); return $row['version']; } function GetNextVersion($current_version) { $query = "SELECT * FROM updates WHERE version > ".$current_ve...
PHP
<?php //init connects to mysql include("init.php"); include("functions.php"); $command = $_REQUEST['command']; if($command == "GetVersion") { echo GetVersion(); } if($command == "GetLauncherVersion") { echo "0.9"; } if($command == "GetLauncherUpdateURL") { echo "http://arturasserver.com/launch...
PHP
document.write("596");var replies=0;
PHP
document.write("0");
PHP
<?php function arvin(){ print 'bbbbbbbbbbbbb'; } class application{ protected static $instance = null; protected $module = ''; protected $action = ''; private function __construction() { // TODO } public static function getInstance() { if(null == self::$instance){ self::$instance = n...
PHP
<?php ini_set('date.timezone','Asia/Shanghai'); include('./mysql.php'); $analytics = new LogAnalytics; $logPath = 'C:\Users\arvin\Desktop\nginx-1.0.11\nginx-1.0.11\logs\access.log'; $analytics->analytics($logPath); /** * 对日志的分析 **/ class LogAnalytics { private $fileLog = null; private $fil...
PHP
<?php class page{ /** * 配置信息 * define('ROLLPAGE', 5);//分页栏每页显示的页数 * define('LISTROWS', 15);//分页栏每页显示的条数 * define('PAGE', 'page');//分页传递参数 * * 使用方法 * include 'page_class.php'; * $page = new page('总记录数', '每页显示多少条记录', '分页链接传递参数(如:catid=5,可以为空)'); * mysql_query(...
PHP
<?php class Cache { /** * @var string $cachePath 缓存文件目录 * @access public */ public $cachePath = './test'; /** * 构造函数 * @param string $path 缓存文件目录 */ function __construct($path = NULL) { if ($path) { ...
PHP
<?php /** * MYSQL PDO * **/ class mysql_pdo extends mysql { private $pdo = null; private $dbtype = 'mysql'; private $host = 'localhost'; private $user = 'root'; private $pass = '123456'; private $dbname = 'test'; private $ds = "$dbms:host=$this->host;dbname...
PHP
<?php /** * 基于左右值排序的无限分类算法 * 数据库结果为 CREATE TABLE om_catagory ( CatagoryID int(10) unsigned NOT NULL auto_increment, Name varchar(50) default '', Lft int(10) unsigned NOT NULL default '0', Rgt int(10) unsigned NOT NULL default '0', PRIMARY KEY (CatagoryID), KEY lft (lft), KEY rgt (rgt) ) * *...
PHP
<?php /** * SHMOP共享内存操作示例 */ $key = 0x4337b700; $size = 4096; $shmid = @shmop_open($key, 'c', 0644, $size); if($shmid === FALSE){ exit('shmop_open error!'); } $data = '世界,你好!我将写入很多的数据,你能罩得住么?'; $length = shmop_write($shmid, pack('a*',$data), 0); if($length === FALSE){ ...
PHP
<?php /** * 统计指定目录中的文件和文件夹数量 * @author arvin * @param string $filepath * @result array */ function statfile($filepath) { if(file_exists($filepath)){ static $folder,$file; $hander = opendir($filepath); while(false != ($filename = readdir($hander))){ if(is_dir($filepath.'/'.$filename) && ...
PHP
<?php require_once("./vo/com/artxis/cms/vo/AccountVO.php"); require_once("config.php"); class LoginService { function LoginService(){ //connect to the database. $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD); mysql_select_db(DATABASE_NAME); } public function...
PHP
<?php require_once("./vo/com/artxis/cms/vo/MenuAdminVO.php"); require_once("config.php"); class MenuAdminService { function MenuAdminService() { //connect to the database. $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD); mysql_select_db(DATABASE_NAME); } public fu...
PHP
<?php require_once("./vo/com/artxis/cms/vo/SiteConfigVO.php"); //conection info require_once("config.php"); class SiteConfigService { function SiteConfigService(){ //connect to the database. $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD); mysql_select_db(DATABASE_NA...
PHP
<?php class AccountVO { var $_explicitType = "com.artxis.cms.vo.AccountVO"; var $accountid; var $username; var $password; var $type; var $userGroup; var $userEmail; } ?>
PHP
<?php class LoginVO { var $_explicitType = "com.artxis.cms.vo.LoginVO"; var $username = ""; var $password = ""; var $loginDate= ""; } ?>
PHP
<?php class MenusVO { var $_explicitType = "com.artxis.cms.vo.MenusVO"; var $idmenu; var $label; var $description; var $chidren; var $orderId; var $type; var $visible; var $enable; var $parentId; var $openMethod; var $ModulePath; var $restrictGroupId; var $kategoriNa...
PHP
<?php class MenuAdminVO { var $_explicitType = "com.artxis.cms.vo.MenuAdminVO"; var $id; var $name; var $url; var $icon; } ?>
PHP
<?php class SiteConfigVO { var $_explicitType = "com.artxis.cms.vo.SiteConfigVO"; var $accountid; var $username; var $password; var $type; var $userGroup; var $userEmail; var $Nama_domain; var $copyright; var $Site_logo; var $title; var $keyword; var $admin_name; var $a...
PHP
<?php require_once("./vo/com/artxis/cms/vo/MenusVO.php"); require_once("config.php"); class MenusService { function MenusService() { //connect to the database. $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD); mysql_select_db(DATABASE_NAME); } function bolean($b...
PHP
<?php define( "DATABASE_SERVER", "localhost"); define( "DATABASE_USERNAME", "root"); define( "DATABASE_PASSWORD", ""); define( "DATABASE_NAME", "artxiscms"); ?>
PHP
<?php add_plugin_hook('install', 'json_output_install'); add_filter('define_response_contexts', 'json_output_response_context'); add_filter('define_action_contexts', 'json_output_action_context'); function json_output() {} function json_output_action_context($context, $controller) { if ($controller instanceof It...
PHP
<?php // retrieve the json callback for JSONP requests $jsonCallback = $_GET['callback']; // First step: retrieve that wonderful taggy goodness $tags = get_tags(array('sort'=>$order, 'record'=>$item), null, 100); // Sort of an arbitrary number, but we'll set the max # of tags to 100 $maxClasses = 100; // Get the lar...
PHP
<?php // retrieve the json callback for JSONP requests $jsonCallback = $_GET['callback']; // retrieve the tagName $tagName = $_GET['tags']; // retrieve the collectionId $collectionId = $_GET['collection']; // Start with an empty array of item metadata $multipleItemMetadata = array(); // We'll loop through each item...
PHP
<?php add_plugin_hook('install', 'send_to_mobile_install'); add_plugin_hook('public_append_to_items_show', 'display_send_to_mobile_link'); function send_to_mobile_install() {} function display_send_to_mobile_link() { echo "<a href='/send-to-mobile/'><img src='" . img('iphone_small_icon.png') . "' alt='cell phone ic...
PHP
<?php head(); ?> <?php foot(); ?>
PHP
<?php head(); ?> <form id="sms" name="sms" method="post" action="/send-to-mobile/index/response"> <table width="400"> <tr> <td align="right" valign="top">From:</td> <td align="left"><input name="from" type="text" id="from" size="30" /></td> </tr> <tr> <td align="right" valign="top">To:</td> <td a...
PHP
<?php class SendToMobile_IndexController extends Omeka_Controller_Action { public function indexAction() {} public function responseAction() { $from = $_POST['from']; $to = $_POST['to']; $carrier = $_POST['carrier']; $message = stripslashes($_POST['message']); if ((empty($from)) || (empty($to)) || (...
PHP
<?php // Add plugin hooks. add_plugin_hook('install', 'geocode_install'); add_plugin_hook('uninstall', 'geocode_uninstall'); add_plugin_hook('item_browse_sql', 'geocode_apply_haversine_to_browse_sql'); function geocode_install() {} function geocode_uninstall() {} function geocode_apply_haversine_to_browse_sql($sele...
PHP
<?php $SECRET = "whatevercodeyouwantittobe"; $PW = "yourgmailsmtppassword"; ?>
PHP
<?php function mylog($msg) { $fmt = "[%s] [%s] %s\n"; $ip = $_SERVER['REMOTE_ADDR']; $time = date('d.m.Y h:i:s'); $line = sprintf($fmt, $time, $ip, $msg); error_log($line, 3, "/home/kalugny/logs/user/emailbyweb.log"); } function exce...
PHP
<?php $psw = $_REQUEST["psw"]; echo(md5($psw));
PHP
<?php session_start(); $ticket = $_SESSION["ticket"]; if($ticket==''){ header('Location: logon.php'); die(); } ?> <!DOCTYPE html> <html> <head> <?php // $ticket = $_SESSION["ticket"]; // if($ticket==''){ // echo('<meta http-equiv="refresh" content="0; url=logon.php">'); // echo('</head></...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); require('providers/xmlUserSessions.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $allMode = $_REQUEST["all"]=='1'; $ti...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeTableRows($treeCatID, $dbCatID){ $tblRef = TreeUtility::getTabl...
PHP
<?php class ProviderFactory{ static function getSessions($baseDir){ return new XmlUsersSessions($baseDir); } static function getUsers(){ return new XmlUsersDB(); } static function getTable($tblRef){ $provName = $tblRef['srcType']; if($provName==''){ echo("{\"error\":\"errMissingDataPr...
PHP
<?php class XmlDB{ function writeLinkedNodes($link, $el, $permissions, $defaultVisibility){ $db = $link->getAttribute("xmldb"); $tableName = $link->getAttribute("table"); $parentID = $el->getAttribute("id"); if($db=='') return; $doc = new DOMDocument('1.0', 'UTF-8'); $doc->load('xmlData/'.$d...
PHP
<?php class Util{ static function conv($str){ return iconv("UTF-8", "windows-1251", $str); } static function checkAccess($ticket, $catID){ $sessions = ProviderFactory::getSessions('xmlData/'); $userID = $sessions->getAuthorizedUser($ticket); if($userID==null){ self::writeError('errAuthoriz...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); require('providers/xmlUserSessions.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $ticket = $_REQUEST["ticket"]; $rowIDs ...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); require('providers/xmlUserSessions.php'); $rootID = $_REQUEST["rootID"]; $depth = $_REQUEST["depth"]; $includeRoot = $_REQUEST["includeRoot"]; $excludeBranch = $_REQUEST["exc...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); require('providers/xmlUserSessions.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $ticket ...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeRecordData($treeCatID, $dbCatID, ...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); require('providers/xmlUserSessions.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $ticket = $_REQUEST["ticket"]; func...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $data = $_REQUEST["data"]; function writeRefRows...
PHP
<?php require('treeUtil.php'); require('providers/factory.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $grpID = $_REQUEST["grpID"]; $ticket = $_REQUEST["ticket"]; if($ticket==''){ echo("{\"error\":\"errAuthorizationRequired\"}"); die(); } function writePermissions($g...
PHP
<?php class DB{ const DOCPATH = "test/db.xml"; function __construct(){ $this->xmlDoc = new DOMDocument(); $this->xmlDoc->load(self::DOCPATH); } function __destruct(){ //$this->save(); } function save(){ $this->xmlDoc->save(self::DOCPATH); } function getX...
PHP
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Пример авторизации</title> </head> <body> <h1>Пример авторизации</h1> <p>Это пример авторизации с помощью передачи ticket'а.</p> <p><a href="logon.php">Reload</a></p> <?php include ("test/db.php"); $d...
PHP
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Пример авторизации</title> </head> <body> <h1>Пример авторизации</h1> <p>Это пример авторизации с помощью передачи ticket'а.</p> <p><a href="logon.php">Reload</a></p> <?php include ("test/db.php"); $d...
PHP
<?php require('treeUtil.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeColumns($treeCatID, $dbCatID){ $tblRef = TreeUtility::getTableRef($treeCatID, $dbCatID); $provName...
PHP
<?php require('treeUtil.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeTableRows($treeCatID, $dbCatID){ $tblRef = TreeUtility::getTableRef($treeCatID, $dbCatID); $prov...
PHP
<?php class XmlDB{ function writeLinkedNodes($link, $el){ $db = $link->getAttribute("xmldb"); $tableName = $link->getAttribute("table"); $parentID = $el->getAttribute("id"); if($db=='') return; $doc = new DOMDocument('1.0', 'UTF-8'); $doc->load('xmlData/'.$db); $xp = new DOMXPath($doc); ...
PHP
<?php require('treeUtil.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $rootID = $_REQUEST["rootID"]; $depth = $_REQUEST["depth"]; $includeRoot = $_REQUEST["includeRoot"]; $excludeBranch = $_REQUEST["excludeBranch"]; $xmlDoc = new DOMDocument('1.0', 'UTF-8'); $xmlDoc->load("xm...
PHP
<?php require('treeUtil.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeResult($treeCatID, $dbCatID, $recID){ $tblRef = TreeUtility::getTableRef($treeCatID); if($tblRef['xmlDBID']=='') return; echo("{\"...
PHP
<?php require('treeUtil.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeRecordData($treeCatID, $dbCatID, $recID){ $tblRef = TreeUtility::g...
PHP
<?php require('treeUtil.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeRefRows($treeCatID, $dbCatID, $recID){ $tblRef = TreeUtility::getTab...
PHP
<?php class DB{ const DOCPATH = "test/db.xml"; function __construct(){ $this->xmlDoc = new DOMDocument(); $this->xmlDoc->load(self::DOCPATH); } function __destruct(){ //$this->save(); } function save(){ $this->xmlDoc->save(self::DOCPATH); } function getX...
PHP
<?php $psw = $_REQUEST["psw"]; echo(md5($psw));
PHP
<?php session_start(); $ticket = $_SESSION["ticket"]; if($ticket==''){ header('Location: logon.php'); die(); } ?> <!DOCTYPE html> <html> <head> <?php // $ticket = $_SESSION["ticket"]; // if($ticket==''){ // echo('<meta http-equiv="refresh" content="0; url=logon.php">'); // echo('</head></...
PHP
<?php require('util.php'); require('providers/factory.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $allMode = $_REQUEST["all"]=='1'; $ticket = $_REQUEST["ticket"]; function writeColumns($treeCatID, $dbCatID, $allMode){ $treeProvider = ProviderFactory:...
PHP
<?php require('util.php'); require('providers/factory.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeTableRows($treeCatID, $dbCatID){ $treeProvider = ProviderFactory::getTree(); $tblRef = $treeProvider->getTableRef($treeCatID, $dbCatID);...
PHP
<?php require('xmldb.php'); require('xmlTree.php'); require('xmlusersdb.php'); require('xmlUserSessions.php'); class ProviderFactory{ static function getDBTypes(){ return array( 'xmlDB'=>'XmlDB', 'xmlUsersDB'=>'XmlUsersDB' ); } static function getSessions($baseDir){ return new XmlUsers...
PHP
<?php class XmlDB{ static $idField = "xmlDBID"; function __construct($db){ $this->db = $db; } function writeLinkedNodes($link, $el, $permissions, $defaultVisibility){ $db = $link->getAttribute("xmldb"); $tableName = $link->getAttribute("table"); $parentID = $el->getAttribute("id"); ...
PHP
<?php require('util.php'); require('providers/factory.php'); $ticket = $_REQUEST["ticket"]; function writeDBTypes($ticket){ if(!Util::checkAccess($ticket, null)){ Util::writeError('errAuthorizationRequired'); die(); } $types = ProviderFactory::getDBTypes(); echo('['); echo('{"id":"none","t...
PHP
<?php require('util.php'); require('providers/factory.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $data = $_REQUEST["data"]; $ticket = $_REQUEST["ticket"]; function saveCatalogProperties($catRef, $treeCatID, $dbCatID, $data, $ticket){ // var_dump(arr...
PHP
<?php class Util{ static function conv($str){ return iconv("UTF-8", "windows-1251", $str); } static function checkAccess($ticket, $catID){ $sessions = ProviderFactory::getSessions('xmlData/'); $userID = $sessions->getAuthorizedUser($ticket); if($userID==null){ self::writeError('errAuthoriz...
PHP
<?php require('util.php'); require('providers/factory.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $ticket = $_REQUEST["ticket"]; $rowIDs = $_REQUEST["rowIDs"]; function writeResult($treeCatID, $dbCatID, $rowIDs){ $treeProvider = ProviderFactory::getT...
PHP
<?php require('util.php'); require('providers/factory.php'); $rootID = $_REQUEST["rootID"]; $depth = $_REQUEST["depth"]; $includeRoot = $_REQUEST["includeRoot"]; $excludeBranch = $_REQUEST["excludeBranch"]; $ticket = $_REQUEST["ticket"]; $thisDBOnly = $_REQUEST["thisDBOnly"]=='true'; $permissions = Util::...
PHP
<?php require('util.php'); require('providers/factory.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $ticket = $_REQUEST["ticket"]; $data = $_REQUEST["data"]; function writeResult($treeCatID, $dbCatID, $recID, $data){ $tr...
PHP
<?php require('util.php'); require('providers/factory.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeRecordData($treeCatID, $dbCatID, $recID){ $treeProvider = ProviderFactory::getTree(); $tblRef = $treePro...
PHP
<?php require('util.php'); require('providers/factory.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $ticket = $_REQUEST["ticket"]; function writeCatData($treeCatID, $dbCatID, $ticket){ $treeProvider = ProviderFactory::getTree(); if($dbCatID==null){ ...
PHP
<?php require('util.php'); require('providers/factory.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; $data = $_REQUEST["data"]; function writeRefRows($treeCatID, $dbCatID, $recID){ $treeProvider = ProviderFactory::getTree(...
PHP
<?php require('util.php'); require('providers/factory.php'); $grpID = $_REQUEST["grpID"]; $ticket = $_REQUEST["ticket"]; if($ticket==''){ echo("{\"error\":\"errAuthorizationRequired\"}"); die(); } function writePermissions($grpID){ $provider = ProviderFactory::getUsers(); $provider->writeUserPer...
PHP
<?php class DB{ const DOCPATH = "test/db.xml"; function __construct(){ $this->xmlDoc = new DOMDocument(); $this->xmlDoc->load(self::DOCPATH); } function __destruct(){ //$this->save(); } function save(){ $this->xmlDoc->save(self::DOCPATH); } function getX...
PHP
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Пример авторизации</title> </head> <body> <h1>Пример авторизации</h1> <p>Это пример авторизации с помощью передачи ticket'а.</p> <p><a href="logon.php">Reload</a></p> <?php include ("test/db.php"); $d...
PHP
<?php require('treeUtil.php'); require('providers/xmldb.php'); require('providers/xmlusersdb.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeColumns($treeCatID, $dbCatID){ $tblRef = TreeUtility::getTableRef($treeCatID, $dbCatID); $provider...
PHP
<?php require('treeUtil.php'); $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeTableRows($treeCatID, $dbCatID){ $tblRef = TreeUtility::getTableRef($treeCatID, $dbCatID); if($tblRef['xmlDBID']=='') return; $dbDoc = new DOMDocument('1.0', 'UTF...
PHP
<?php class XmlDB{ function writeColumns($tblRef){ if($tblRef['xmlDBID']=='') return; $dbDoc = new DOMDocument('1.0', 'UTF-8'); $dbDoc->load($tblRef['xmlDBID']); $dbPath = new DOMXPath($dbDoc); $table = $dbPath->query("//table[@name='{$tblRef['tableID']}']")->item(0); $columns = $dbPath->q...
PHP
<?php require('treeUtil.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeResult($treeCatID, $dbCatID, $recID){ $tblRef = TreeUtility::getTableRef($treeCatID); if($tblRef['xmlDBID']=='') return; echo("{\"...
PHP
<?php require('treeUtil.php'); $recID = $_REQUEST["recID"]; $catRef = explode("/", $_REQUEST["catID"]); $treeCatID = $catRef[0]; $dbCatID = $catRef[1]; function writeRecordData($treeCatID, $dbCatID, $recID){ $tblRef = TreeUtility::getTableRef($treeCatID); if($tblRef['xmlDBID']=='') return; $dbDo...
PHP
<?php class TreeUtility{ static function conv($str){ return iconv("UTF-8", "windows-1251", $str); } static function getTableRef($treeCatID, $dbCatID){ $treeDoc = new DOMDocument('1.0', 'UTF-8'); $treeDoc->load("tree.xml"); $treePath = new DOMXPath($treeDoc); $links = $treePath->query("//catalo...
PHP
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Пример авторизации</title> </head> <body> <h1>Пример авторизации</h1> <p>Это пример авторизации с помощью передачи ticket'а.</p> <p><a href="logon.php">Reload</a></p> <?php include ("test/db.php"); $d...
PHP
<?php class DB{ const DOCPATH = "test/db.xml"; function __construct(){ $this->xmlDoc = new DOMDocument(); $this->xmlDoc->load(self::DOCPATH); } function __destruct(){ //$this->save(); } function save(){ $this->xmlDoc->save(self::DOCPATH); } function getX...
PHP
<?php require("settings.php"); function openConnection(){ global $Settings; $con=mysqli_connect($Settings['dbServer'], $Settings['dbUser'], $Settings['dbPassword'], $Settings['dbName']); // Check connection if (mysqli_connect_errno()){ echo "Failed to connect to MySQL: " . mysqli_connect_error();...
PHP
<?php require_once('db/dbResumes.php'); require_once('db/dbVacancies.php'); require_once('db/dbUsers.php'); require_once('db/dbConst.php'); require_once('db/dbResumesTest.php'); require_once('db/dbVacanciesTest.php'); require_once('db/dbUsersTest.php'); require_once('db/dbConstTest.php'); $con = openConnec...
PHP
<?php require_once('db/GenericTable.php'); class DbVacancies extends GenericTable{ public $tableName = "Vacancies"; public function create($con){ if(tableExists($con, $this->tableName)){ $this->drop($con); } execSql($con, "CREATE TABLE ".$this->tableName."(". "ID INT NOT NULL AUTO_INCRE...
PHP
<?php require_once('db/GenericTable.php'); class DbUsers extends GenericTable{ public $tableName = "Users"; public function create($con){ if(tableExists($con, $this->tableName)){ $this->drop($con); } execSql($con, "CREATE TABLE ".$this->tableName."(". "ID INT NOT NULL AUTO_INCREMENT, PR...
PHP
<?php require_once('db/GenericTable.php'); class DbResumes extends GenericTable{ public $tableName = "Resumes"; public function create($con){ if(tableExists($con, $this->tableName)){ $this->drop($con); } execSql($con, "CREATE TABLE ".$this->tableName."(". "ID INT NOT NULL AUTO_INCREMENT...
PHP
<?php require_once('db/GenericTable.php'); class DbConstants extends GenericTable{ public $tableName = "Constants"; public $sectTableName = "ConstantSections"; public function create($con){ if(tableExists($con, $this->tableName)){ $this->drop($con); } execSql($con, "CREATE TABLE ".$this->...
PHP
<?php require_once('../util.php'); class GenericTable{ public $tableName = ""; public function drop($con){ execSql($con, "DROP TABLE ".$this->tableName); } public function rebuild($con){ $this->create($con); } }
PHP
<?php $Settings = array( "dbServer" => "localhost", "dbUser" => "sa", "dbPassword" => "123456", "dbName" => "jobstr", "setDbEncoding" => "CP1251", "writeConversion" => "Windows-1251/UTF-8", "cryptKey" => '$1$oy789FnX$n456FkIc4Hrm123PZ0IEO/' );
PHP
<?php require('util.php'); $con = openConnection(); function writeSection($con, $sid, $name){ echo("\"".$name."\": ["); $res = mysqli_query($con,"SELECT * FROM Constants WHERE Section=".$sid); $first = true; while($row = mysqli_fetch_array($res)){ if(!$first) echo(","); else $first=false; echo("{\"i...
PHP
<?php function captcha_generateCode($key) { $str = md5(md5($key)); $str = substr($str, 1, 6); return $str; } function captcha_check($userCode, $key){ return $userCode==captcha_generateCode($key); }
PHP
<?php require('../util.php'); $con = openConnection(); $uid = $_REQUEST["uid"]; $ticket = $_REQUEST["ticket"]; $ID = $_REQUEST["id"]; $filter = " Owner is NULL"; if(checkSession($con, $uid, $ticket)){ $filter = $filter." or Owner='".$uid."'"; } $result = mysqli_query($con, "SELECT * FROM Vacancies WH...
PHP
<?php require('../util.php'); require('../captcha/code.php'); $con = openConnection(); $uid = $_REQUEST["uid"]; $ticket = $_REQUEST["ticket"]; $data = $_REQUEST["data"]; // if(!checkSession($con, $uid, $ticket)){ // $uid = null; // } if(!captcha_check($data["captcha"]["code"], $data["captcha"]["key"]...
PHP
<?php require('../util.php'); $tableName = "Resumes"; $con = openConnection(); $uid = $_REQUEST["uid"]; $ticket = $_REQUEST["ticket"]; $resID = $_REQUEST["resID"]; $owner = getOwner($con, $tableName, $resID); if(!checkSession($con, $uid, $ticket) && $owner!=$uid){ writeError("Access denied."); die...
PHP
<?php require('../util.php'); require('../captcha/code.php'); $tableName = "Users"; $con = openConnection(); $uid = $_REQUEST["uid"]; $ticket = $_REQUEST["ticket"]; $data = $_REQUEST["data"]; if(!checkSession($con, $uid, $ticket)){ writeError("Access denied."); die(); } saveRecord($con, $table...
PHP
<?php require('../util.php'); $con = openConnection(); $login = $_REQUEST["login"]; $password = crypt($_REQUEST["password"], $Settings['cryptKey']); $result = mysqli_query($con,"SELECT ID, Name FROM Users WHERE login='".$login."' AND password='".$password."'"); if($result->num_rows==1){ $row = $result->fe...
PHP
<?php require('../util.php'); require('../captcha/code.php'); $tableName = "Vacancies"; $con = openConnection(); $uid = $_REQUEST["uid"]; $ticket = $_REQUEST["ticket"]; $data = $_REQUEST["data"]; $rowID = $data["id"]; $owner = getOwner($con, $tableName, $rowID); if(!checkSession($con, $uid, $ticke...
PHP
<?php require('../util.php'); $con = openConnection(); $uid = $_REQUEST["uid"]; $ticket = $_REQUEST["ticket"]; $data = $_REQUEST["data"]; if(!checkSession($con, $uid, $ticket)){ $uid = null; } if(!captcha_check($data["captcha"]["code"], $data["captcha"]["key"])){ echo("{\"error\":\"Bad CAPTCHA code.\"...
PHP