Exemplo n.º 1
0
function create_calendar()
{
    if (!check_connection()) {
        exit("Connection Error");
    }
    if (isset($_GET[month]) && isset($_GET[year])) {
        //first validate the $_GET values
        if (!(is_numeric($_GET[year]) && is_numeric($_GET[month]) && $_GET[month] > 0 && $_GET[month] < 13 && $_GET[year] > 2000 && $_GET[year] < 10000)) {
            echo 'URL Values not within range. Please Correct in address bar<br>';
            echo 'Year data received:' . $_GET[year] . '<br>';
            echo 'Month data received:' . $_GET[month];
            return;
            //exit 'create_calendar()' function
        }
        //if they're okay, proceed to create calendar
        calendar_display_month($_GET[month], $_GET[year]);
    } else {
        //Display current month
        calendar_display_month($GLOBALS[cur_month], $GLOBALS[cur_year]);
    }
}
Exemplo n.º 2
0
ini_set('max_execution_time', 100200);
function check_connection($user, $pass, $host)
{
    if (!($connection = @mysql_connect("{$host}", "{$user}", "{$pass}"))) {
        return false;
    }
    return $connection;
}
function check_db($db_name, $connection)
{
    if (!($db = @mysql_select_db($db_name, $connection))) {
        return false;
    }
    return true;
}
if ($conn = check_connection(JB_MYSQL_USER, JB_MYSQL_PASS, JB_MYSQL_HOST)) {
    if (check_db(JB_MYSQL_DB, $conn)) {
        if ($DB_ERROR) {
            $JBMarkup->error_msg("<b>Database is not installed. [" . mysql_error() . "]<br>Please go to the installation page: <a href='install.php'>install.php</a></b>");
            die;
        }
    } else {
        $JBMarkup->error_msg("<b>Cannot select database.  " . mysql_error() . "<br>Please go to the installation page: <a href='install.php'>install.php</a></b>");
        die;
    }
} else {
    $JBMarkup->error_msg("<b>Cannot connect to database. " . mysql_error() . "<br>Please go to the installation page: <a href='install.php'>install.php</a></b>");
    die;
}
require 'upgrade.php';
if ($DB_ERROR == '') {
Exemplo n.º 3
0
<?php

// Returns an error code.
require_once "api.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $connection = get_connection();
    check_connection($connection);
    $username = $connection->real_escape_string($_POST["username"]);
    $password = $connection->real_escape_string($_POST["password"]);
    echo register_user($connection, $username, $password);
    $connection->close();
} else {
    goto_page("");
}
Exemplo n.º 4
0
function check_status()
{
    global $page, $webimroot, $settings, $dbversion;
    $page['done'][] = getlocal2("install.0.php", array(phpversion()));
    if (!check_webimroot()) {
        return;
    }
    if (!check_files()) {
        return;
    }
    $link = check_connection();
    if (!$link) {
        return;
    }
    if (!check_database($link)) {
        mysql_close($link);
        return;
    }
    if (!check_tables($link)) {
        mysql_close($link);
        return;
    }
    if (!check_columns($link)) {
        mysql_close($link);
        return;
    }
    check_sound();
    $page['done'][] = getlocal("installed.message");
    if (!check_admin($link)) {
        $page['nextstep'] = getlocal("installed.login_link");
        $page['nextnotice'] = getlocal2("installed.notice", array("{$webimroot}/install/"));
        $page['nextstepurl'] = "{$webimroot}/operator/login.php?login=admin";
    }
    $page['show_small_login'] = true;
    mysql_close($link);
    loadsettings();
    $settings['dbversion'] = $dbversion;
    update_settings();
}
Exemplo n.º 5
0
// ------------------------------------------
$leftbox .= "<ul>\r\n";
foreach ($GLOBALS["DBdef"] as $label => $array) {
    $leftbox .= "  <li>" . "<p><a href='" . $_SERVER["PHP_SELF"] . "?label=" . $label . "' style='padding-right:1em'>" . "<strong>&quot;" . $label . "&quot;</strong></a>" . (strtolower($array["host"]) != "localhost" ? " [connect on <a href='" . $_SERVER["PHP_SELF"] . "?label=" . $label . "&amp;localhost=1'><strong>localhost</strong></a> instead]" : "") . "<br>User <strong>" . $array["user"] . "@" . $array["host"] . "</strong> " . "needs to connect to database <strong>" . $array["name"] . "</strong></p>" . "</li>\r\n";
}
$leftbox .= "</ul>\r\n";
// ------------------------------------------
//
// ------------------------------------------
if (isset($_REQUEST["label"])) {
    $dblabel = $_REQUEST["label"];
    $localhost = isset($_REQUEST["localhost"]) && $_REQUEST["localhost"] ? TRUE : FALSE;
    $rightbox .= "<h3>Now checking database &quot;" . $dblabel . "&quot; on " . ($localhost ? "localhost" : (isset($GLOBALS["DBdef"][$dblabel]["host"]) ? $GLOBALS["DBdef"][$dblabel]["host"] : "")) . "</h3>\r\n";
    if (!isset($GLOBALS["DBdef"][$dblabel]["name"]) || !isset($GLOBALS["DBdef"][$dblabel]["host"]) || !isset($GLOBALS["DBdef"][$dblabel]["user"]) || !isset($GLOBALS["DBdef"][$dblabel]["pass"])) {
        $rightbox .= "<p><strong class='red'>CONFIGURATION ERROR</strong> - " . "Cannot find configuration parameters for database <strong>&quot;" . $dblabel . "&quot;</strong></p>";
    } else {
        $rightbox .= check_connection($localhost ? "localhost" : $GLOBALS["DBdef"][$dblabel]["host"], $GLOBALS["DBdef"][$dblabel]["user"], $GLOBALS["DBdef"][$dblabel]["pass"], $GLOBALS["DBdef"][$dblabel]["name"]);
    }
}
// ------------------------------------------
// Output left and right columns
// ------------------------------------------
if (!empty($leftbox)) {
    print "<div style='max-width:45%;float:left'>\r\n" . $leftbox . "</div>\r\n";
}
if (!empty($rightbox)) {
    print "<div style='float:left;margin-left:4em;border:1px solid black;padding:0 1em'>\r\n" . $rightbox . "</div>\r\n";
}
// ------------------------------------------
require_once './page_footer.inc.php';
// ------------------------------------------
Exemplo n.º 6
0
<?php

error_reporting(E_ALL & ~E_NOTICE);
if ($_REQUEST[action] == 'install') {
    save_db_config();
    require "../config.php";
    if ($conn = check_connection($_REQUEST[mysql_user], $_REQUEST[mysql_pass], $_REQUEST[mysql_host])) {
        if (check_db($_REQUEST[mysql_db], $conn)) {
            install_db();
        } else {
            echo "<p><font color='red'><b>Install failed: Cannot select database.  " . mysql_error() . "</b></font></p>";
        }
    } else {
        echo "<p><font color='red'><b>Install failed: Cannot connect to database. " . mysql_error() . "</b></font></p>";
    }
} else {
    require "../config.php";
}
$sql = "select * from users";
$result = @mysql_query($sql);
if ($result) {
    echo "<h3>Database successfully Installed.</h3>";
    echo "<p>";
    echo "Next Steps:<br>";
    echo "1. Delete this file (install.php) from the server<br>";
    echo "2. Note: You must go to Admin-&gt;Main Config now and set up the rest of the script.<br>";
    echo " <a href='" . BASE_HTTP_PATH . "admin/'>Go to Admin</a>. <b>(The default admin password is 'ok'. Please don't forget to change the default password.)</b><br>";
    die;
}
function check_connection($user, $pass, $host)
{
Exemplo n.º 7
0
<tr>
<td>
Follow-Up Pending
</td>
<td>
<input type="checkbox" name="followuppending" value="Yes" />
</td>
</tr>

<tr>
<td>Related to Course:
</td>
<td>
<?
     	$con = check_connection(NULL, NULL);
     $sql = "SELECT CourseName FROM course";
        $result = mysql_query($sql);

         echo "<select name='icourse'>";
		  echo "<option value='N/A'>N/A</option>";
  while ($row = mysql_fetch_array($result)) {
   echo "<option value='" . $row[0] ."'>" . $row[0] ."</option>";}
   echo "</select>";
 ?>
</td>
</tr>



Exemplo n.º 8
0
$dblink = @mysqli_connect($dbhost, $mysql_admin_user, $mysql_admin_pass);
@mysqli_set_charset($dblink, "utf8");
// ------------------------------------------
// Display in left column - logout button
// ------------------------------------------
if (isset($_SESSION["hvzmsql"])) {
    $leftbox .= output_db_logout_form($dbname, $mysql_admin_user);
}
// ------------------------------------------
// List Web Applications that need database support
// ------------------------------------------
ksort($GLOBALS["DBS"]);
$leftbox .= "  <h3>List of Applications on the Nordita Webs</h3>\r\n" . "  <ul>\r\n";
foreach ($GLOBALS["DBS"] as $label => $array) {
    $lock = isset($array["lock"]) && $array["lock"] ? 1 : 0;
    $leftbox .= "    <li style='margin-bottom:1em'>\r\n" . "      <p style='margin:0'>" . "<strong style='font-size:1.2em'>&quot;" . $label . "&quot;</strong>" . (strtolower($array["host"]) != "localhost" ? " [connect on <a href='" . $_SERVER["PHP_SELF"] . "?label=" . $label . "&amp;localhost=1'><strong>localhost</strong></a> instead]" : "") . "</p>\r\n" . "      <p style='margin:0'>" . check_connection($array["host"], $array["user"], $array["pass"], $array["name"], $lock) . "</p>\r\n" . "</li>\r\n";
}
$leftbox .= "  </ul>\r\n";
/*
  // ------------------------------------------
  //
  // ------------------------------------------
  if (isset($_REQUEST["label"])) {
    $dblabel = $_REQUEST["label"];
    $localhost = (isset($_REQUEST["localhost"]) && $_REQUEST["localhost"]) ? TRUE : FALSE;
    print "<div style='max-width:45%;float:left;margin-left:4em;border:1px solid black;padding:0 1em'>" .
          "<h3>Now checking database &quot;" . $dblabel . "&quot; on " .
          ($localhost ? "localhost" : (isset($GLOBALS["DBdef"][$dblabel]["host"]) ? $GLOBALS["DBdef"][$dblabel]["host"] : "") ) .
          "</h3>\r\n";
    if (!isset($GLOBALS["DBdef"][$dblabel]["name"])
        || !isset($GLOBALS["DBdef"][$dblabel]["host"])
Exemplo n.º 9
0
   install-texts.inc
*/
if ($_SESSION["session_ok"] != 1) {
    header("Location:?");
}
/***************************************************
  This script use only the structure DATABASE_DEF
***************************************************/
include "lib/parameters.inc";
genPHPVariables($database_def, "BASIC");
if ($submited) {
    /* The code above take the mission to validate the database data
          enter by the user in the Step 0.
       */
    getPostVariables($database_def);
    $errno = check_connection($database_host, $database_user, $database_password, $database_name);
    $errno_arr = explode("|", $errno);
    $msg = $errno_arr[1];
    $_SESSION['dbCreatedSuccesfully'] = $errno_arr[2];
    if ($errno_arr[0] > 0) {
        $HTMLElements = getHTMLElements($database_def);
        $inTheSame = 1;
    } else {
        setSessionData($database_def);
        $inTheSame = 0;
        header("Location:?page=" . ($page + 1));
    }
} else {
    $msg = "";
    $inTheSame = 1;
    getSessionData($database_def);