コード例 #1
0
ファイル: setup.php プロジェクト: lorecioni/watss
         if ($i < count($cameras) - 1) {
             $sql .= ',';
         }
     }
     mysqli_query($dbConnection, $sql) or $success = false;
     if ($success) {
         jecho($success);
     } else {
         $log = mysqli_error($dbConnection);
         error_500($log);
     }
     mysqli_close($dbConnection);
     break;
 case 'parse-sql-script':
     if ($_FILES['file']['error'] > 0) {
         error_500('Error: ' . $_FILES['file']['error']);
     } else {
         require_once 'config.php';
         global $config;
         $sql = file_get_contents($_FILES['file']['tmp_name']);
         $result = SQLParse($sql);
         $response = array('name' => $result['name'], 'tables' => array());
         foreach ($result['tables'] as $t) {
             if (in_array($t, $config->tables)) {
                 array_push($response['tables'], array('name' => $t, 'success' => true));
             } else {
                 array_push($response['tables'], array('name' => $t, 'success' => false));
             }
         }
         move_uploaded_file($_FILES['file']['tmp_name'], "../database/import.sql");
         jecho($response);
コード例 #2
0
ファイル: person-add.php プロジェクト: ldfaiztt/ucla-cs143
            // It is okay to submit dod without dob
            $error_messages['dod'] = '<div class="err-msg">Date of death <em>must</em> occur after date of birth</div>';
        } else {
            $default_values['dod'] = array('day' => (int) $form_dod['day'], 'month' => (int) $form_dod['month'], 'year' => (int) $form_dod['year']);
        }
    }
    // Check for proper type input
    if (!in_array($form['type'], array('actor', 'director'), true)) {
        $error_messages['type'] = '<div class="err-msg">Invalid type specified.</div>';
    } else {
        $default_values['type'] = (string) $form['type'];
    }
    if (empty($error_messages)) {
        $new_id = save_person_in_db($default_values);
        if (!$new_id) {
            error_500();
        } else {
            redirect_to(url_for_id(PERSON_VIEW, $new_id));
        }
    }
}
page_header('Add Person');
?>
		<p><h3>New person information</h3></p>
		<form action="<?php 
echo PERSON_ADD;
?>
" method="POST">
			<?php 
if (isset($error_messages['name'])) {
    echo $error_messages['name'];
コード例 #3
0
ファイル: lib_log.php プロジェクト: whosonfirst/flamework
function log_fatal($msg)
{
    _log_dispatch('fatal', $msg);
    error_500();
    exit;
}
コード例 #4
0
ファイル: index.php プロジェクト: misasagi966/Sysdev2015
        <div class="page-header">
          <h1 id="tables">Room List</h1>
        </div>
      </div>
_FIRST;
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) {
    error_500("Unable to connect to MySQL: " . mysql_error());
}
if (!mysql_select_db($db_database)) {
    error_500("Unable to select database: " . mysql_error());
}
$query = "SELECT * FROM {$db_table} WHERE Flag=3";
$result = mysql_query($query);
if (!$result) {
    error_500("Could not get data" . mysql_error());
}
$row = mysql_fetch_array($result);
if (!$row) {
    echo <<<_TABLE
      <div class="col-lg-12">
        <div class="bs-component">
          <h3>現在アップロードされているデータはありません<h3>
        </div>
      </div>
    </div>
_TABLE;
} else {
    echo <<<_TABLE
      <div class="col-lg-12 col-xs-12">
        <div class="bs-component">
コード例 #5
0
/**
 * Do an internal self check
 * @global array $profile
 * @global array $sreg
 */
function self_check()
{
    global $profile, $sreg;
    // 	if (! isset($profile) || ! is_array($profile))
    // 		error_500('No configuration found, you shouldn\'t access this file directly.');
    if (version_compare(phpversion(), '4.2.0', 'lt')) {
        error_500('The required minimum version of PHP is 4.2.0, you are running ' . phpversion());
    }
    $extension_r = array('session', 'pcre');
    foreach ($extension_r as $x) {
        if (!extension_loaded($x)) {
            @dl($x);
        }
        if (!extension_loaded($x)) {
            error_500("Required extension '{$x}' is missing.");
        }
    }
    // 	$extension_b = array('suhosin');
    // 	foreach ($extension_b as $x) {
    // 		if (extension_loaded($x) &! $profile["allow_$x"])
    // 			error_500("phpMyID is not compatible with '$x'");
    // 	}
    //
    // 	$keys = array('auth_username', 'auth_password');
    // 	foreach ($keys as $key) {
    // 		if (! array_key_exists($key, $profile))
    // 			error_500("'$key' is missing from your profile.");
    // 	}
    if (!isset($sreg) || !is_array($sreg)) {
        $sreg = array();
    }
}
コード例 #6
0
ファイル: index.php プロジェクト: misasagi966/Sysdev2015
            }
            $query = "UPDATE {$db_table} SET Flag=1 WHERE No={$id}";
            $result = mysql_query($query);
            if (!$result) {
                error_500("Could not change flag ID={$id}: " . mysql_error());
            }
            echo <<<_SUCCESS1
          <div class="alert alert-dismissible alert-success alert-pos col-lg-4 col-md-6 col-xs-12">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <h4>SUCCESSFULL!</h4>
            <p>依頼を受け付けました.<br/>
_SUCCESS1;
            $query = "SELECT * FROM UploadedData WHERE No={$id}";
            $result = mysql_query($query);
            if (!$result) {
                error_500("Could not get date id={$id}: " . mysql_error());
            }
            $row = mysql_fetch_assoc($result);
            $id = $row['No'];
            $title = $row['Title'];
            $user = $row['UserName'];
            $comment = str_replace(array("\r\n", "\r", "\n"), " ", $row['Comment']);
            switch ($row['Model']) {
                case 1:
                    $model = "iPhon6s";
                    break;
                case 2:
                    $model = "iPhon6";
                    break;
                case 3:
                    $model = "iPhon5s";
コード例 #7
0
/**
 * @param mysqli $mysqli
 * @param int $line
 */
function show_mysqli_error(mysqli $mysqli, $line)
{
    if ($mysqli->error) {
        error_500('[' . $line . '] ' . $mysqli->error);
    }
}
コード例 #8
0
ファイル: MyID.php プロジェクト: sionide21/phpMyId
/**
 * Verify the profile has the necessary keys for an auth type.
 * @global array $profile
 * @global array $auth_types
 */
function check_keys($type)
{
    global $profile, $auth_types;
    foreach ($auth_types[$type]['keys'] as $key) {
        if (!array_key_exists($key, $profile)) {
            error_500("'{$key}' is missing from your profile.");
        }
    }
}
コード例 #9
0
ファイル: api.php プロジェクト: lorecioni/watss
 /**
  * Returns the frames list for the timeline. Each frame has associated the list of person ID
  * present in that frame; based on a frame ID (current).
  * Timeline starts from k previous frames and end after k frames from the selected one.
  *
  * @param frame_id : the current frame id
  * @param limit : k value
  * @return frames list array (frame id, people id list for each frame)
  */
 case "get-timeline-frames":
     $output = new stdClass();
     $frames = array();
     $done = true;
     //Check if params are valid
     if (!isset($_SESSION["frame_id"])) {
         error_500("Missing information: frame id");
     }
     $frame_id = intval($_SESSION['frame_id']);
     $output->current = 0;
     //Retrieving previous and next frames
     if (isset($_REQUEST['limit'])) {
         $sql = $QUERIES->getFrameIdList($_SESSION['camera_id'], $_REQUEST['limit'], $frame_id);
     } else {
         $sql = $QUERIES->getFrameIdList($_SESSION['camera_id'], null, null);
     }
     $result = mysql_query($sql) or $done = false;
     $count = 0;
     while ($row = mysql_fetch_array($result)) {
         $frame = new stdClass();
         $frame->id = $row["frameid"];
         if ($frame->id == $frame_id) {
コード例 #10
0
ファイル: MyID.php プロジェクト: hueyhuecoyotl/phpMyId
/**
 * Do an internal self check
 * @global array $profile
 * @global array $sreg
 * @global array $auth_types
 */
function self_check()
{
    global $profile, $sreg, $auth_types;
    if (!isset($profile) || !is_array($profile)) {
        error_500('No configuration found, you shouldn\'t access this file directly.');
    }
    if (version_compare(phpversion(), '4.2.0', 'lt')) {
        error_500('The required minimum version of PHP is 4.2.0, you are running ' . phpversion());
    }
    $extension_r = array('session', 'pcre');
    foreach ($extension_r as $x) {
        if (!extension_loaded($x)) {
            @dl($x);
        }
        if (!extension_loaded($x)) {
            error_500("Required extension '{$x}' is missing.");
        }
    }
    $extension_b = array('suhosin');
    foreach ($extension_b as $x) {
        if (extension_loaded($x) & !$profile["allow_{$x}"]) {
            error_500("phpMyID is not compatible with '{$x}'");
        }
    }
    if (!isset($auth_types[$profile['auth_type']])) {
        error_500('Configuration Error: Invalid auth_type.');
    }
    // Check required keys for current auth type
    foreach ($auth_types[$profile['auth_type']]['keys'] as $key) {
        if (!array_key_exists($key, $profile)) {
            error_500("'{$key}' is missing from your profile.");
        }
    }
    if (!isset($sreg) || !is_array($sreg)) {
        $sreg = array();
    }
}
コード例 #11
0
ファイル: MyID.php プロジェクト: bryanveloso/sayonarane
/**
 * Do an internal self check
 * @global array $profile
 * @global array $sreg
 */
function self_check()
{
    global $profile, $sreg;
    if (!isset($profile) || !is_array($profile)) {
        error_500('No configuration found, you shouldn\'t access this file directly.');
    }
    if (version_compare(phpversion(), '4.2.0', 'lt')) {
        error_500('The required minimum version of PHP is 4.2.0, you are running ' . phpversion());
    }
    $extensions = array('session', 'pcre');
    foreach ($extensions as $x) {
        if (!extension_loaded($x)) {
            @dl($x);
        }
        if (!extension_loaded($x)) {
            error_500("Required extension '{$x}' is missing.");
        }
    }
    $keys = array('auth_username', 'auth_password');
    foreach ($keys as $key) {
        if (!array_key_exists($key, $profile)) {
            error_500("'{$key}' is missing from your profile.");
        }
    }
    if (!is_writable(ini_get('session.save_path'))) {
        error_500("PHP cannot save sessions.");
    }
    if (!isset($sreg) || !is_array($sreg)) {
        $sreg = array();
    }
}