Example #1
0
function readDataParser($sql, $case, $searchstring, $scanner = false)
{
    $con = newConnection();
    if ($result = $con->query($sql)) {
        if ($scanner === true) {
            while ($row = $result->fetch_assoc()) {
                if (strpos(strtolower($row["query"]), strtolower($searchstring)) !== false) {
                    if ($case === 1) {
                        echo "[" . $row["query"] . "]<br>";
                    } else {
                        echo "[" . $row["query"] . "] [" . $row["Datelog"] . "]<br>";
                    }
                }
            }
        } else {
            while ($row = $result->fetch_assoc()) {
                if ($case === 1) {
                    echo "[" . $row["query"] . "]<br>";
                } else {
                    echo "[" . $row["query"] . "] [" . $row["Datelog"] . "]<br>";
                }
            }
        }
    } else {
        echo "No results found";
    }
    $con->close();
}
Example #2
0
     if ($username) {
         $password = safe_REQUEST($_REQUEST, 'password');
         $user_id = authenticateUser($username, $password);
         if ($user_id) {
             $stat = newConnection();
             if ($stat !== false) {
                 addDebugLog($action . " username={$username} SUCCESS\n" . $stat);
                 print "SUCCESS\n" . $stat;
             }
             $_SESSION['connected'] = $user_id;
         } else {
             addDebugLog($action . " username={$username} ERROR 10: Username and password key failed to authenticate.");
             print "ERROR 10: Username and password key failed to authenticate.\n";
         }
     } else {
         $stat = newConnection();
         if ($stat !== false) {
             addDebugLog($action . " SUCCESS\n" . $stat);
             print "SUCCESS\n" . $stat;
         }
         AddToLog('Read-Only Anonymous Client connection.');
         $_SESSION['connected'] = 'Anonymous';
         $_SESSION['readonly'] = 1;
     }
     exit;
 case 'listgedcoms':
     $out_msg = "SUCCESS\n";
     foreach (get_all_gedcoms() as $ged_id => $gedcom) {
         $out_msg .= "{$gedcom}\t" . get_gedcom_setting($ged_id, 'title') . "\n";
     }
     addDebugLog($action . " " . $out_msg);
Example #3
0
<?php

// Defines the mysqli database object, and provides convenience functions for running commonly executed queries
/* Require database stuff */
require_once "functions/conf.inc.php";
require_once "functions/connection.php";
/* Defines the $mysqli object */
$mysqli = newConnection($CFG);
/* Random function */
function test()
{
    $query = <<<VEV
    SELECT question_id FROM  `{$prefix}questions`
VEV;
    // Execute the query and grab the data.
    $result = $mysqli->query($query);
}
Example #4
0
<?php

require_once 'conf.inc.php';
require_once 'connection.php';
$connection = newConnection($CFG);
$prefix = $connection->prefix;
$query = <<<EOL

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';


-- -----------------------------------------------------
-- Table `{$prefix}user`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `{$prefix}user` ;

CREATE TABLE IF NOT EXISTS `{$prefix}user` (
`user_id` INT NOT NULL AUTO_INCREMENT ,
`first_name` VARCHAR(60) NOT NULL ,
`last_name` VARCHAR(60) NOT NULL ,
`email` VARCHAR(255) NOT NULL ,
`grad_yr` SMALLINT NULL ,
`last_online` DATE NULL ,
`student_id` VARCHAR(60) NOT NULL ,
`image_url` TEXT NULL COMMENT 'profile pic\\n\\nurl to the image relative to installation\\\\'s resource directory, or from the web?' ,
PRIMARY KEY (`user_id`) ,
INDEX `grad_yr` (`grad_yr` ASC) ,
INDEX `last_name` (`last_name` ASC) ,
UNIQUE INDEX `student_id` (`student_id` ASC) )