Beispiel #1
0
include $themepath . 'header.php';
?>

<?php 
include 'install.php';
include 'customers.php';
include 'drugs.php';
# SQL Creds
$SQL_servername = "localhost";
$SQL_username = "******";
$SQL_password = "******";
$SQL_dbname = "RxProject";
$SQL_connection = mysqli_connect($SQL_servername, $SQL_username, $SQL_password, $SQL_dbname);
if (!$SQL_connection) {
    die("Connection failed: " . mysqli_connect_error());
}
if ($_GET["function"] == "install") {
    create_customerdb($SQL_connection);
    create_drugdb($SQL_connection);
} elseif ($_GET["function"] == "reset") {
    reset_db($SQL_connection);
} elseif ($_GET["function"] == "customers") {
    list_customers($SQL_connection);
} elseif ($_GET["function"] == "drugs") {
    list_drugs($SQL_connection);
} else {
    $MyVariable = "I have nothing to do. Maybe\n  <a href=\"index.php?function=install\">Install</a>";
    echo $MyVariable;
}
mysqli_close($SQL_connection);
include $themepath . 'footer.php';
Beispiel #2
0
<?php

session_start();
require "Config.php";
mysqli_report(MYSQLI_REPORT_STRICT);
$reset_complete = false;
$error_message = "";
if (isset($_POST['btnReset'])) {
    reset_db();
}
function reset_db()
{
    global $dbname;
    global $dblocation;
    global $dbpassword;
    global $dbuser;
    global $reset_complete;
    global $error_message;
    $db_connected = false;
    try {
        $mysqli = new mysqli($dblocation, $dbuser, $dbpassword, $dbname);
        if ($mysqli->connect_errno) {
            $error_message = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") Check your setting in the Config.php file.  " . $mysqli->connect_error;
        }
        $db_connected = True;
    } catch (mysqli_sql_exception $e) {
        $error_message = "Check your settings in the Config.php file.<br /><br />  Failed to connect to MySQL.  " . $e;
    }
    if ($db_connected) {
        $command = "mysql --user="******" --password="******" --database=" . $dbname . " < ./db-scripts/ResetDB.sql";
        $output = shell_exec($command);
Beispiel #3
0
						<TD  colspan="2" ALIGN="right"><INPUT TYPE="checkbox" VALUE="1" NAME="frm_ticket"></TD></TR>
					<TR><TD CLASS="td_label">Reset users:</TD>
						<TD colspan="2" ALIGN="right"><INPUT TYPE="checkbox" VALUE="1" NAME="frm_user"></TD></TR>
					<TR><TD CLASS="td_label">Reset settings:</TD>
						<TD colspan="2" ALIGN="right"><INPUT TYPE="checkbox" VALUE="1" NAME="frm_settings"></TD></TR>
					<TR><TD CLASS="td_label">Really reset database? &nbsp;&nbsp;</TD>
						<TD colspan="2" ><INPUT MAXLENGTH="20" SIZE="40" TYPE="text" NAME="frm_confirm"></TD></TR>
					<TR><TD></TD><TD><INPUT TYPE="submit" VALUE="Apply"></FORM></TD>';
                print '<td align="right"><FORM METHOD="POST" ACTION="config.php"><INPUT TYPE="submit" VALUE="Cancel / Go Back"></FORM></td>';
                print '</TR></TABLE>';
                powered();
                // Print "Powered by" and end the HTML page
                exit;
            } else {
                if ($_POST['frm_confirm'] == 'yes') {
                    reset_db($_POST['frm_user'], $_POST['frm_ticket'], $_POST['frm_settings']);
                } else {
                    print '<FONT CLASS="warn">Not authorized or confirmation failed.</FONT><BR><BR>';
                }
            }
        }
        break;
    case "settings":
        if ($_SESSION['ticket_user_is_admin'] < 2) {
            print '<FONT CLASS="warn">Not authorized.</FONT><BR><BR>';
        } else {
            if ($_GET['go'] == 'true') {
                for ($i = 0; $i < $_POST["frm_values"]; $i++) {
                    $query = "UPDATE settings SET value='" . $_POST[frm_setting_value][$i] . "' WHERE id='" . $_POST[frm_setting_id][$i] . "'";
                    if ($debug) {
                        print '<p> $query: ' . $query;