/**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->pdo = new EventServicePDO();
     $link = mysqliConnect();
     $this->session = new Zebra_Session($link, 'XXXX');
     $_SESSION['userValid'] = 1;
 }
Beispiel #2
0
 /**
  * logout by destroying the session
  */
 public static function logout()
 {
     if (!self::$testMode) {
         // This is handled by cascading delete in database schema
         // This way if the GC deletes the session the event subscriptions will
         // be cleaned up
         // $userId = self::getUserId();
         // if (isset($userId))
         // {
         // // Unsubscribe from all events
         // $pdo = new EventServicePDO();
         // $pdo->unsubscribeForUser($userId);
         // }
         /*
          * NO_ZEBRA_SESSION $_SESSION = array(); // destroy all of the session
          * variables session_destroy();
          */
         $link = mysqliConnect();
         $session = new Zebra_Session($link, SESSION_HASH, SESSION_LIFETIME_SECONDS);
         $session->stop();
         self::$xactSession = NULL;
     }
 }
Beispiel #3
0
<?php

session_start();
// mysqli Database utility file
$mysqli = null;
// mysqli database connection object
$mysqli_response = array();
// global response/error variable
$mysqli_status = "";
// global status variable
mysqliConnect();
// Start Connection, initiates the connection assigning $myslqi object
// Attempt connection and populate mysqli connection object, used later.
//  This will be executed once per page request, preparing possible connection object
function mysqliConnect()
{
    global $mysqli, $mysqli_response, $mysqli_status;
    // register the globals here for use
    //$mysqli=new mysqli( DB_HOST       DB_USER,    DB_PASS,    DB_NAME,  [ DB_PORT ], [ BP_UNIX_SOCKET ]);
    $mysqli = new mysqli("23.229.242.71", "logan", "Trustn0on3", "LippyWithIt");
    if ($mysqli->connect_error) {
        $mysqli_response[] = 'Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error;
        echo json_encode($mysqli_response);
        die;
        // exit(), but close up any outstanding "open" things
    }
}
// Regular Query function, will expect a resultset to bind to result object
function mysqliQuery($q)
{
    global $mysqli, $mysqli_response, $mysqli_status;
Beispiel #4
0
function mysqliQuery($SQL, $db = null)
{
    $mysqli = mysqliConnect($db);
    $result = $mysqli->query($SQL);
    if (!$result) {
        $error_db['TIPO ERROR'] = "ERROR EN LA QUERY DE STORED PROCEDURE";
        $error_db['MYSQLI ERROR'] = mysqli_error($mysqli);
        $error_db['MYSQLI QUERY'] = $SQL;
        dpr($error_db);
        exit;
    }
    return $result->fetch_array(MYSQL_ASSOC);
}