Exemplo n.º 1
0
 public function __construct()
 {
     global $FATAL_ERROR;
     set_error_handler('Controller::handleError');
     register_shutdown_function('Controller::shutdown');
     ERROR_REPORTING(0);
 }
 /**
  * Run the task, and do the business
  *
  * @param SS_HTTPRequest $httpRequest 
  */
 function run($httpRequest)
 {
     global $databaseConfig;
     // environment type
     Director::set_environment_type("dev");
     // debug
     ini_set("display_errors", "2");
     ERROR_REPORTING(E_ALL);
     /*
     $dbhost 		= $databaseConfig['server'];
     $dbuser 		= $databaseConfig['username'];
     $dbpwd   		= $databaseConfig['password'];
     $dbname  		= $databaseConfig['database'];
     $backupfolder 	= $_SERVER['DOCUMENT_ROOT'].'/db_backups';
     $dumpfile	 	= $backupfolder."/".$dbname."_".date("Y-m-d_H-i-s").".sql";
     
     if (!is_dir($backupfolder)) mkdir($backupfolder);
     
     passthru("/usr/bin/mysqldump --opt --host=$dbhost --user=$dbuser --password=$dbpwd $dbname > $dumpfile");
     
     echo "Created: ".$dumpfile; passthru("tail -1 $dumpfile");	
     */
     $drop_table_if_exists = false;
     //Add MySQL 'DROP TABLE IF EXISTS' Statement To Output
     $dbhost = $databaseConfig['server'];
     $dbuser = $databaseConfig['username'];
     $dbpass = $databaseConfig['password'];
     $dbname = $databaseConfig['database'];
     $backupfolder = __DIR__ . '/../../db_backups';
     $dumpfile = $backupfolder . "/" . $dbname . "_" . date("Y-m-d_H-i-s") . ".sql";
     $backup = new MySQLDump();
     $backup->droptableifexists = $drop_table_if_exists;
     $backup->connect($dbhost, $dbuser, $dbpass, $dbname);
     //Connect To Database
     if (!$backup->connected) {
         die('Error: ' . $backup->mysql_error);
     }
     //On Failed Connection, Show Error.
     $backup->list_tables();
     //List Database Tables.
     $broj = count($backup->tables);
     //Count Database Tables.
     $output = '';
     echo "found " . $broj . " tables \n\n";
     for ($i = 0; $i < $broj; $i++) {
         $table_name = $backup->tables[$i];
         //Get Table Names.
         $backup->dump_table($table_name);
         //Dump Data to the Output Buffer.
         $output .= $backup->output;
     }
     if (!is_dir($backupfolder)) {
         mkdir($backupfolder);
     }
     file_put_contents($dumpfile, $output);
     echo "Dumped into " . $dumpfile;
     //echo "<pre>".$output."</pre>";
 }
Exemplo n.º 3
0
 private function __construct()
 {
     // Handles debugging. If TRUE, displays all errors and enables FirePHP logging
     if (ACTIVATE_DEBUG_MODE === TRUE) {
         ini_set("display_errors", 1);
         ERROR_REPORTING(E_ALL);
         FB::setEnabled(TRUE);
         FB::warn("FirePHP logging is enabled! Sensitive data may be exposed.");
         ChromePhp::warn("ChromePHP logging is enabled! Sensitive data may be exposed.");
     } else {
         ini_set("display_errors", 0);
         error_reporting(0);
         FB::setEnabled(FALSE);
     }
 }
<?php

ini_set("display_errors", "1");
ERROR_REPORTING(E_ALL | E_STRICT);
include_once 'IConnectInfo.php';
class UniversalConnect implements IConnectInfo
{
    private static $server = IConnectInfo::HOST;
    private static $currentDB = IConnectInfo::DBNAME;
    private static $user = IConnectInfo::UNAME;
    private static $pass = IConnectInfo::PW;
    private static $hookup;
    public static function doConnect()
    {
        self::$hookup = mysqli_connect(self::$server, self::$user, self::$pass, self::$currentDB);
        try {
            self::$hookup;
            //Uncomment following line for develop/debug
            echo "Successful MySql connection:<br />";
        } catch (Exception $e) {
            echo "There is a problem: " . $e->getMessage();
            exit;
        }
        return self::$hookup;
    }
}
     code in 2013-4-26 by zhaolianxiang 
    **/
define('CODE_BASE2', '/server/www/code_base');
$GLOBALS['THRIFT_ROOT'] = !isset($GLOBALS['THRIFT_ROOT']) ? CODE_BASE2 . '/third_part/thrift-0.5.0' : $GLOBALS['THRIFT_ROOT'];
require_once $GLOBALS['THRIFT_ROOT'] . '/Thrift.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/packages/scribe/scribe.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/THttpClient.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TFramedTransport.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php';
//生成的文件
require_once dirname(__FILE__) . '/Hive.php';
//数据库文件
include_once '../DB/MyDB.class.php';
ERROR_REPORTING(E_ALL);
INI_SET('DISPLAY_ERRORS', 'ON');
$socket = new TSocket('hive.corp.xx.com', 13080);
$socket->setDebug(TRUE);
// 设置接收超时(毫秒)
$socket->setSendTimeout(10000);
$socket->setRecvTimeout(30 * 60 * 1000);
//接受时间设置为30分钟
//$transport = new TBufferedTransport($socket, 1024, 1024);
$transport = new TFramedTransport($socket);
$protocol = new TBinaryProtocol($transport);
$client = new HiveClient($protocol);
try {
    $transport->open();
} catch (TException $tx) {
    echo $tx->getMessage();
Exemplo n.º 6
0
<?php

ini_set("display_errors", "0");
ERROR_REPORTING(E_NONE);
$conds = <<<OKDONE
<div class="ui-widget">
  <label for="conditions">Your condition: </label>
  <input id="conditions">
</div>
OKDONE;
$medstable = <<<OKDONE
\t<style>
\ttable.medstable td {
\t\tborder-top:1px solid black;
\t\tpadding-left: 8px;
\t\tvertical-align:middle;
\t}
\ttd.big {
\t\tfont-size:120%;
\t\tfont-weight:bold;
\t}
\ttd.morn {
\t\tbackground-color: rgba(255,255,0,.4);
\t}
\ttd.eve {
\t\tbackground-color: rgba(0,0,200,.2);
\t}
\ttable.medstable img {
\t\twidth: 100px;
\t\tmargin-top:5px;
\t}
Exemplo n.º 7
0
 /**
  * SetParameters is the method that generate constant parameters
  */
 private static final function SetParameters()
 {
     $family = 'Parameters';
     if (file_exists(CTRL . 'parameters.ini')) {
         foreach (parse_ini_file(CTRL . 'parameters.ini') as $name => $value) {
             if ($name == 'ERROR_REPORTING') {
                 ERROR_REPORTING($value);
             } else {
                 if ($name == 'display_errors') {
                     ini_set("display_errors", $value);
                 } else {
                     if (!is_array($value)) {
                         Core::addConst($name, $value, $family);
                     } else {
                         if (is_array($value)) {
                             Core::addArrayGLOBALS($name, $value);
                         }
                     }
                 }
             }
         }
     } else {
         Core::dieError('Initialisation impossible du fichier de configuration');
     }
 }
<?php 
ERROR_REPORTING(0);
$email = base64_decode($argv[1]);
$strArray = iconv('gb2312', 'utf-8//IGNORE', 'cookie_crypto_key_initial' . $email);
$custid = dang_decrypt_text($argv[2], $strArray);
echo $custid;
/*---------------------------------------*\
  | 函数作用:返回一个字符串md5之后的字符串 |
  | $strArray:字符串类型                   |
  \*---------------------------------------*/
function MakeMD5($strArray)
{
    $sb = md5($strArray);
    $sb = pack('H*', $sb);
    return $sb;
}
/*---------------------------------------------*\
  | 函数作用:对.net的3DES加密的字符串进行解密    |
  | $key:加密时候使用的key                       |
  | $iv:初始向量                                 |
  | $text:需要解密的字符串                       |
  \*---------------------------------------------*/
function decryptNET3DES($key, $iv, $text)
{
    if (empty($text)) {
        return "";
    }
    $td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_ECB, '');
    // 把key值补充完整,在PHP里面如果key值不够24位剩下的会自动补0,但是在.net中,会做一个循环把前面的值补充到后面补够24位,所以这里强制补前面的字符
    $key_add = 24 - strlen($key);
    $key .= substr($key, 0, $key_add);
Exemplo n.º 9
0
<?php

require_once 'Connections/koneksi.php';
ERROR_REPORTING(E_ERROR | E_PARSE);
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Praktek Bidan</title>
</head>

<body>
<center>
<form action="<?php 
echo $editFormAction;
?>
" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Username:</td>
      <td><input type="text" name="username" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Password:</td>
      <td><input type="password" name="password" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Login" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
Exemplo n.º 10
0
 public function download($id)
 {
     // cek apakah file ada di database
     $q = $this->db->query('SELECT `user`, `filename`, `path` FROM `file` WHERE `code` = ?', array($id));
     if ($q->num_rows() < 1) {
         return 'guh?!';
     }
     // Cek pribaditivitas (naon atuh euy)
     $qq = $this->db->query('SELECT `user`, `visibility` FROM `folder` WHERE `path` = ?', array($q->row()->path));
     if ($qq->num_rows() >= 1) {
         if ($qq->row()->visibility == 0 and ($this->session->userdata('user') === false or $this->session->userdata('user') != $qq->row()->user)) {
             return 'ga boleh';
         }
     }
     // Apakah pemiliknya plus-plus?
     $this->load->model('User', '', true);
     if ($this->User->level($q->row()->user) != 'p') {
         // Kalo gak, cek slot
         $qqq = $this->db->query("SELECT `ip`, `code` FROM `slot` WHERE `code` = ? AND `ip` = ? AND `status` = '1'", array($id, $_SERVER['REMOTE_ADDR']));
         if ($qqq->num_rows() < 1) {
             return false;
         }
     }
     // KIRIM BOS
     $path = $this->config->item('phys_path');
     $user = $q->row()->user;
     $filename = $q->row()->filename;
     /*
      * Copyright 2012 Armand Niculescu - MediaDivision.com
      * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
      * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
      * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
      * THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      */
     // get the file request, throw error if nothing supplied
     //- turn off compression on the server
     @apache_setenv('no-gzip', 1);
     @ini_set('zlib.output_compression', 'Off');
     // wen de way
     ERROR_REPORTING(0);
     // sanitize the file request, keep just the name and extension
     // also, replaces the file location with a preset one ('./myfiles/' in this example)
     $file_path = $path . $user . '/' . $id . '/' . $filename;
     $path_parts = pathinfo($file_path);
     $file_name = $path_parts['basename'];
     $file_ext = $path_parts['extension'];
     // make sure the file exists
     if (is_file($file_path)) {
         $file_size = filesize($file_path);
         $file = @fopen($file_path, 'rb');
         if ($file) {
             // set the headers, prevent caching
             header('Pragma: public');
             header('Expires: -1');
             header('Cache-Control: public, must-revalidate, post-check=0, pre-check=0');
             header("Content-Disposition: attachment; filename=\"{$file_name}\"");
             // set the mime type based on extension, add yours if needed.
             $ctype_default = 'application/octet-stream';
             $content_types = array('exe' => 'application/octet-stream', 'zip' => 'application/zip', 'mp3' => 'audio/mpeg', 'mpg' => 'video/mpeg', 'avi' => 'video/x-msvideo', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'webm' => 'video/webm');
             $ctype = isset($content_types[$file_ext]) ? $content_types[$file_ext] : $ctype_default;
             header('Content-Type: ' . $ctype);
             //check if http_range is sent by browser (or download manager)
             if (isset($_SERVER['HTTP_RANGE'])) {
                 list($size_unit, $range_orig) = explode('=', $_SERVER['HTTP_RANGE'], 2);
                 if ($size_unit == 'bytes') {
                     //multiple ranges could be specified at the same time, but for simplicity only serve the first range
                     //http://tools.ietf.org/id/draft-ietf-http-range-retrieval-00.txt
                     list($range, $extra_ranges) = explode(',', $range_orig, 2);
                 } else {
                     $range = '';
                     header('HTTP/1.1 416 Requested Range Not Satisfiable');
                     exit;
                 }
             } else {
                 $range = '';
             }
             //figure out download piece from range (if set)
             list($seek_start, $seek_end) = explode('-', $range, 2);
             //set start and end based on range (if set), else set defaults
             //also check for invalid ranges.
             $seek_end = empty($seek_end) ? $file_size - 1 : min(abs(intval($seek_end)), $file_size - 1);
             $seek_start = empty($seek_start) || $seek_end < abs(intval($seek_start)) ? 0 : max(abs(intval($seek_start)), 0);
             //Only send partial content header if downloading a piece of the file (IE workaround)
             if ($seek_start > 0 || $seek_end < $file_size - 1) {
                 header('HTTP/1.1 206 Partial Content');
                 header('Content-Range: bytes ' . $seek_start . '-' . $seek_end . '/' . $file_size);
                 header('Content-Length: ' . ($seek_end - $seek_start + 1));
             } else {
                 header("Content-Length: {$file_size}");
             }
             header('Accept-Ranges: bytes');
             set_time_limit(0);
             fseek($file, $seek_start);
             while (!feof($file)) {
                 print @fread($file, 1024 * 8);
                 ob_flush();
                 flush();
                 if (connection_status() != 0) {
                     @fclose($file);
                     exit;
                 }
             }
             // file save was a success
             @fclose($file);
             exit;
         } else {
             // file couldn't be opened
             header('HTTP/1.0 500 Internal Server Error');
             exit;
         }
     } else {
         // file does not exist
         header('HTTP/1.0 404 Not Found');
         exit;
     }
 }
<?php

session_start();
ERROR_REPORTING(E_ALL ^ E_NOTICE);
date_default_timezone_set('Europe/Oslo');
$gjennomIndex = true;
require_once "_functions.php";
require_once "_classes.php";
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="nettbutikk.css" title="Standard css" />
<title>HBHL nettbutikk</title>
</head>
<body>

<div id="hovedramme">

<div id="header">
    <h1><a href="index.php?side=hjem">HBHL nettbutikk</a></h1>
</div>

<div id="l_meny"></div>

<div id="innhold">
	<h2>Opprett administratorbruker</h2>
<?php 
if ($_POST['knapp'] == "Opprett adminbruker") {
    $admin = new Admin();
Exemplo n.º 12
0
<?php

ERROR_REPORTING(E_ALL ^ E_WARNING ^ E_NOTICE ^ E_ERROR);
/*
 * Set tabs to 4 for best viewing.
 * 
 * Latest version is available at http://adodb.sourceforge.net
 * 
 * This is the main include file for ADOdb.
 * Database specific drivers are stored in the adodb/drivers/adodb-*.inc.php
 *
 * The ADOdb files are formatted so that doxygen can be used to generate documentation.
 * Doxygen is a documentation generation tool and can be downloaded from http://doxygen.org/
 */
/**
	\mainpage
	
	 @version V5.18 3 Sep 2012   (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved.

	Released under both BSD license and Lesser GPL library license. You can choose which license
	you prefer.
	
	PHP's database access functions are not standardised. This creates a need for a database 
	class library to hide the differences between the different database API's (encapsulate 
	the differences) so we can easily switch databases.

	We currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere, DB2,
	Informix, PostgreSQL, FrontBase, Interbase (Firebird and Borland variants), Foxpro, Access,
	ADO, SAP DB, SQLite and ODBC. We have had successful reports of connecting to Progress and
	other databases via ODBC.