예제 #1
0
function getAlbumId($email, $UPLOAD_ALBUM_NAME = "personals")
{
    $UPLOAD_ALBUM_NAME = "personals";
    $q = "select * from albums where user_email = '{$email}' and album_name = '{$UPLOAD_ALBUM_NAME}'";
    $r = selectData($q);
    if (is_string($r)) {
        return 0;
    } else {
        if (is_array($r)) {
            if (count($r) > 0) {
                foreach ($r as $a) {
                    $album = $a;
                }
                $album_id = $album['id'];
                return $album_id;
            } else {
                $dt = date("Y-m-d G:i:s");
                $table = "albums";
                $id = getNewId("{$table}");
                $albumimg_id = 0;
                $fields = array("id", "album_name", "user_email", "date_pub", "privacy", "admin_perm", "remarks", "albumimg_id", "view_count", "rating");
                $values = array("{$id}", "{$UPLOAD_ALBUM_NAME}", "{$email}", "{$dt}", 1, 1, "", "{$albumimg_id}", 0, 0);
                $rs = insertData($table, $fields, $values);
                if ($rs == true) {
                    return $id;
                } else {
                    return 0;
                }
            }
        } else {
            return 0;
        }
    }
}
예제 #2
0
/**
* Author : Jan Germann
* Datum : 01.05.2010
* Modul : menu
* Beschreibung : Erstellen von einem Menüpunkt
*/
function create()
{
    if (!$_POST['submit']) {
        return showFormCreate();
    } elseif ($_POST['submit']) {
        return insertData();
    }
}
예제 #3
0
function signupOverride($coreUserInfo)
{
    global $gasDatabaseName, $CoreUserTableName;
    $insert = array();
    $uid = $coreUserInfo["Result"]["Uid"];
    $insert["CustomerType"] = post("CustomerType");
    $insertAddress = array();
    $insertAddress["Uid"] = $uid;
    $insertAddress["Username"] = "";
    $insertAddress["PhoneNumber"] = post("PhoneNumber");
    $insertAddress["City"] = post("RegionFirstLevel");
    $insertAddress["Area"] = post("RegionSecondLevel");
    $insertAddress["DetailAddress"] = post("DetailAddress");
    $insertAddress["Floor"] = 0;
    $insertAddress["Elevator"] = 0;
    $insertAddress["IsDefault"] = 1;
    $_POST = null;
    connectDB($gasDatabaseName);
    //    insertData("Customer", $insert);
    updateData($CoreUserTableName, "Uid = {$uid}", $insert);
    insertData("CustomerAddress", $insertAddress);
    printResultByMessage("", 0, $coreUserInfo["Result"]);
}
예제 #4
0
function saveImages($paths, $artistId)
{
    global $mysqli;
    // Artistbilder
    //beim hinzufügen neuer Bilder die höchste SortId raus suchen und +1
    $anzahlBilder = "SELECT MAX(Images_SortId) Anzahl FROM artistimages WHERE Artists_ID = " . $artistId;
    $result = mysqli_query($mysqli, $anzahlBilder);
    if (isset($result)) {
        $anzahlBilder = mysqli_fetch_assoc($result);
    } else {
        $anzahlBilder = 0;
    }
    if (intval($anzahlBilder['Anzahl']) >= 1) {
        $sort = $anzahlBilder['Anzahl'] + 1;
    } else {
        $sort = 1;
    }
    foreach ($paths as $path) {
        $artistImages = array("Artists_Id" => $artistId, "Images_Name" => $path, "Images_SortId" => $sort);
        insertData("artistimages", $artistImages);
        $sort++;
    }
}
		//log status

    //MODEL:: WHERE THE DATABASE CAPTURES THE APPROVAL DETAILS .....STARTS HERE
		mysqlquery("insert into vl_samples_verify 
						(sampleID,outcome,outcomeReasonsID,comments,created,createdby) 
						values 
						('$id','$outcome','$outcomeReasonsID','$comments','$datetime','$trailSessionUser')");

    if(isset($other_reasons)){
      foreach ($other_reasons as $other_reason) {
        if(!empty($other_reason)){
          $data=array("sampleID"=>$id,
                      "reasonID"=>$other_reason,
                      "created"=>$datetime,
                      "createdby"=>$trailSessionUser);
          insertData($data,'vl_samples_verify_reasons'); 
        }      
      }
    }
     //MODEL:: WHERE THE DATABASE CAPTURES THE APPROVAL DETAILS ..... ENDS HERE
		//redirect to home with updates on the tracking number
		if($saveChangesProceed) {
			//proceed to next sample within the search results
			if($encryptedSample && $searchQueryCurrentPosition && $searchQueryNextPosition) {
				go("/verify/approve.reject/$searchQueryNextPosition/$pg/search/$encryptedSample/1/");
			} elseif($envelopeNumberFrom && $envelopeNumberTo && $searchQueryCurrentPosition && $searchQueryNextPosition) {
				go("/verify/approve.reject/$searchQueryNextPosition/$pg/search/$envelopeNumberFrom/$envelopeNumberTo/1/");
			}
		} elseif(!$searchQueryNextPosition || $saveChangesReturn) {
			if($encryptedSample) {
				go("/verify/search/$encryptedSample/pg/$pg/modified/");
예제 #6
0
파일: commands.php 프로젝트: aazhbd/ArtCms
function FileUpload($resourceType, $currentFolder, $sCommand)
{
    dbConn();
    $email = getEmailFCK();
    $thumb_widthpx = 160;
    if (!isset($_FILES)) {
        global $_FILES;
    }
    $sErrorNumber = '0';
    $sFileName = '';
    if (isset($_FILES['NewFile']) && !is_null($_FILES['NewFile']['tmp_name']) && $email != "") {
        global $Config;
        $oFile = $_FILES['NewFile'];
        // Map the virtual path to the local server path.
        //$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ;
        $s = GetRootPath() . $Config['UserTempPath'] . $currentFolder . "/";
        $s = str_replace("\\", "/", $s);
        $sServerDir = $s;
        $f = fopen("log2.txt", "a");
        fwrite($f, "\r\n  s = {$s} \r\n");
        // Get the uploaded file name.
        $sFileName = $oFile['name'];
        $sFileName = SanitizeFileName($sFileName);
        $sOriginalFileName = $sFileName;
        // Get the extension.
        $sExtension = substr($sFileName, strrpos($sFileName, '.') + 1);
        $sExtension = strtolower($sExtension);
        if (isset($Config['SecureImageUploads'])) {
            if (($isImageValid = IsImageValid($oFile['tmp_name'], $sExtension)) === false) {
                $sErrorNumber = '202';
            }
        }
        if (isset($Config['HtmlExtensions'])) {
            if (!IsHtmlExtension($sExtension, $Config['HtmlExtensions']) && ($detectHtml = DetectHtml($oFile['tmp_name'])) === true) {
                $sErrorNumber = '202';
            }
        }
        // Check if it is an allowed extension.
        if (!$sErrorNumber && IsAllowedExt($sExtension, $resourceType)) {
            $iCounter = 0;
            while (true) {
                $sFilePath = $sServerDir . "/" . $sFileName;
                //fwrite($f, "\r\n sFilePath = $sFilePath \r\n");
                //fwrite($f, "\nsServerDir = $sServerDir\n");
                if (is_file($sFilePath)) {
                    $iCounter++;
                    $sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension;
                    $sErrorNumber = '201';
                } else {
                    move_uploaded_file($oFile['tmp_name'], $sFilePath);
                    if (is_file($sFilePath)) {
                        $ftype = $_FILES['NewFile']['type'];
                        $file_size = $_FILES['NewFile']['size'];
                        $originalpic = file_get_contents($sFilePath);
                        list($width, $height) = getimagesize($sFilePath);
                        if ($width > $thumb_widthpx) {
                            $count = 1;
                            $p = str_replace($sFileName, "", $sFilePath, $count);
                            //fwrite($f, "\r\nfpath: $sFilePath\r\n");
                            $thumbpic = getThumbImage($p, $thumb_widthpx, $sFileName);
                        } else {
                            $thumbpic = $originalpic;
                            unlink($sFilePath);
                        }
                        $album_id = getAlbumId($email);
                        $table = 'user_imgs';
                        $fields = array('id', 'user_email', 'large_image', 'thumb_image', 'file_type', 'stat', 'file_name', 'file_size', 'album_id', 'admin_perm', 'view_count', 'rating');
                        $values = array(null, $email, $originalpic, $thumbpic, $ftype, 1, $sFileName, $file_size, $album_id, 1, 0, 0);
                        $rs = insertData($table, $fields, $values);
                        if (is_string($rs) || $rs == false) {
                            //$sErrorNumber = '202' ;
                            //file_put_contents("$sFileName", $thumbpic);
                        } else {
                            //fwrite($f, "is inserted = true");
                        }
                        if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) {
                            break;
                        }
                        $permissions = 0777;
                        if (isset($Config['ChmodOnUpload']) && $Config['ChmodOnUpload']) {
                            $permissions = $Config['ChmodOnUpload'];
                        }
                        $oldumask = umask(0);
                        chmod($sFilePath, $permissions);
                        umask($oldumask);
                    }
                    break;
                }
            }
            if (file_exists($sFilePath)) {
                //previous checks failed, try once again
                if (isset($isImageValid) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false) {
                    @unlink($sFilePath);
                    $sErrorNumber = '202';
                } else {
                    if (isset($detectHtml) && $detectHtml === -1 && DetectHtml($sFilePath) === true) {
                        @unlink($sFilePath);
                        $sErrorNumber = '202';
                    }
                }
            }
        } else {
            $sErrorNumber = '202';
        }
    } else {
        $sErrorNumber = '202';
    }
    $sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder);
    $sFileUrl = CombinePaths($sFileUrl, $sFileName);
    SendUploadResults($sErrorNumber, $sFileUrl, $sFileName);
    exit;
}
예제 #7
0
            $conn = dbConnect($dbHost, $dbUser, $dbPass);
            //Create table (and database)
            dbCreate($conn);
            //Close the MySQL connection
            mysqli_close($conn);
            //Finish
            return;
        } else {
            //Process the CSV file - loading, capitalization, email validation etc
            $lines = csvProcessing($filename);
            //Connect to the MySQL database
            $conn = dbConnect($dbHost, $dbUser, $dbPass);
            //Create table (and database)
            dbCreate($conn);
            //Insert the CSV data into the table
            insertData($lines, $conn);
            //Close the MySQL connection
            mysqli_close($conn);
            //Finish
            return;
        }
    }
}
//Process the CSV file - loading, capitalization, email validation etc
function csvProcessing($filename)
{
    //Open the CSV file
    $file = fopen($filename, "r");
    //Create an empty array to put the csv file into
    $lines = [];
    //Load each line of the CSV file, to the end of the file, into the array
예제 #8
0
<?php

header('Content-Type: application/json');
require_once 'app/init.php';
//include 'app/checksession.php';
global $datbase;
// = Database::getDB();
$jsonData = '';
if (isset($_POST['jsonData'])) {
    $jsonData = json_decode($_POST['jsonData']);
    //var_dump($jsonData);
    foreach ($jsonData as $obj) {
        $item = ['Inventory_Link' => $obj->recId, 'Item_Desc' => $obj->partDesc, 'Qty' => $obj->qty];
        insertData($item, $database);
    }
} else {
    die("no JSON DATA");
}
function insertData($item, $dbObj)
{
    $dbObj->table('tblPartRequestItems')->insert($item);
    print_r($dbObj);
}
예제 #9
0
<?php

// Worker Code to store values in database
$worker = new GearmanWorker();
$worker->addServer();
$worker->addFunction("saveRecord", function ($job) {
    return insertData($job->workload());
});
while ($worker->work()) {
}
function insertData($data)
{
    $dataArray = json_decode($data, true);
    // connect to database and save records
    $dbhost = 'localhost';
    $dbuser = '******';
    $dbpass = '';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass);
    if (!$conn) {
        return false;
    }
    $sql = "INSERT INTO records(name, email, phone) VALUES('" . $dataArray['name'] . "', '" . $dataArray['email'] . "', " . $dataArray['phone'] . ");";
    mysql_select_db('gearman');
    $retval = mysql_query($sql, $conn);
    if (!$retval) {
        echo 'Could not enter data: ' . mysql_error();
    } else {
        echo 'Data Stored';
    }
    mysql_close($conn);
    return;
예제 #10
0
<?php

session_start();
$_SESSION['info'] = "qweqwe";
if (isset($_POST['text'])) {
    $component_id = $_POST['text'];
    insertData($component_id);
} else {
    if (isset($_POST['releaseSKU'])) {
        $invlines_id = $_POST['releaseSKU'];
        releaseSKU($invlines_id);
    } else {
        exit;
    }
}
function insertData($component_id)
{
    mysql_connect("localhost", $_SESSION['database_user'], $_SESSION['database_user_pswd']);
    mysql_select_db("radiosklad");
    mysql_query("SET NAMES 'utf8'");
    mysql_query("INSERT INTO invlines VALUES \n        (null,\n        " . $component_id . ",\n        " . $_SESSION['user_id'] . ",\n        '1',\n        null)");
    exit;
}
function releaseSKU($invlines_id)
{
    mysql_connect("localhost", $_SESSION['database_user'], $_SESSION['database_user_pswd']);
    mysql_select_db("radiosklad");
    mysql_query("SET NAMES 'utf8'");
    $query = mysql_query("SELECT invdate FROM invlines WHERE id =" . $invlines_id);
    $result_row = mysql_fetch_object($query);
    if ($result_row->invdate == "") {
예제 #11
0
        if ($isDefault == "1") {
            query("UPDATE CustomerAddress SET IsDefault=0 WHERE Uid = {$uid}");
        }
        $insert = array();
        $insert["Uid"] = $uid;
        $insert["CustomerId"] = $customerId;
        $insert["Username"] = $username;
        $insert["PhoneNumber"] = $phoneNumber;
        $insert["City"] = $regionFirstLevel;
        $insert["Area"] = $regionSecondLevel;
        $insert["DetailAddress"] = $detailAddress;
        $insert["Floor"] = $floor;
        $insert["Elevator"] = $elevator;
        $insert["IsDefault"] = $isDefault;
        $_POST = NULL;
        insertData("CustomerAddress", $insert);
    }
    if ($actionType == "edit") {
        $addressId = post("CustomerAddressId");
        if ($isDefault == "1") {
            query("UPDATE CustomerAddress SET IsDefault=0 WHERE Uid = {$uid}");
        }
        query("UPDATE `CustomerAddress` SET UserName='******', PhoneNumber='{$phoneNumber}', City='{$regionFirstLevel}', Area='{$regionSecondLevel}', DetailAddress='{$detailAddress}', Floor={$floor}, Elevator={$elevator}, IsDefault={$isDefault} WHERE CustomerAddressId={$addressId}");
    }
    if ($actionType == "delete") {
        $addressId = post("CustomerAddressId");
        query("DELETE FROM `CustomerAddress` WHERE CustomerAddressId={$addressId}");
    }
    printResultByMessage("", 0);
} else {
    if ($action == "EditName") {
예제 #12
0
        $puntos = "";
        $letra = "";
        $x = "x";
        echo $idpreg[0]['Id_Pregunta'] . "";
        echo $Pregunta . "<br> RESPUESTAS: <br>";
        //Desglosar la Cadena dada y obtener las respuestas y los puntos
        for ($i = 0; $x; $i++) {
            if ($str[$i] == ":") {
                $i++;
                for ($a = $i; $letra != "," || $letra != null; $a++) {
                    $puntos = $puntos . $str[$a];
                    $i++;
                    $letra = $str[$i];
                }
                echo $respuesta . " - " . $puntos . "<br>";
                insertData("INSERT INTO respuestas(Respuesta, Id_Pregunta, Puntos) VALUES ('" . $respuesta . "', " . $idpreg[0]['Id_Pregunta'] . ", " . $puntos . ")");
            } else {
                $respuesta = $respuesta . $str[$i];
            }
            $x = $str[$i];
        }
    }
    if ($_GET['z'] == "Configuraciones") {
        echo "\n\t\t\t<label id='equipos' class='btn btn-default btn-lg' style='width: 100%; margin-top: 5px;'>Equipos</label>\n\t\t\t<label id='juego' class='btn btn-default btn-lg' style='width: 100%; margin-top: 10px;'>Juego</label>\n\t\t\t<label id='cpreguntas'class='btn btn-default btn-lg' style='width: 100%; margin-top: 10px;'>Preguntas</label>\n\t\t\t<label id='extras'class='btn btn-default btn-lg' style='width: 100%; margin-top: 10px;'>Extras</label>\n\t\t\t<br>\n\n\t\t\t<script type='text/javascript'>\n\t\t\t\$(document).ready(function () {\n\t\t\t\$('#equipos').on('click', function(){\n\t\t\t        \$('#tabla').load('php/configuraciones/equipos.php');  \n\t\t\t  });\n\n\n\t\t\t\$('#juego').on('click', function(){\n\t\t\t        \$('#tabla').load('php/configuraciones/juego.php');  \n\t\t\t  });\n\n\t\t\t\$('#cpreguntas').on('click', function(){\n\t\t\t        \$('#tabla').load('php/configuraciones/cpreguntas.php');  \n\t\t\t  });\n\t\n\t\t\t\$('#extras').on('click', function(){\n\t\t\t        \$('#tabla').load('php/configuraciones/extra.php');  \n\t\t\t  });\n\n\n\t\t\t});\n\n\t\t\t</script>\n\n\t\t\t\t\t";
    }
}
function MusicOFF()
{
    SQL("UPDATE juego SET music = 0");
    echo "<script>\n    \$(document).ready( \n        function(){ \n         \$('#auto8').load('php/music.php?z=None');\n        });\n    </script>";
}
예제 #13
0
include "function.php";
@($username = $_SESSION['username']);
if (@$username == null || @$username == "") {
    echo "<script>location.href='http://mdm.techandtheory.com/alpha/login.php'</script>";
}
if (isset($_POST['submit'])) {
    unset($_SESSION['user_id']);
    if (!empty($_POST['userlist'])) {
        $_SESSION['user_id'] = $_POST['userlist'];
        echo '<script>window.location.replace("add_device.php");</script>';
    } else {
        $f_name = mysql_real_escape_string(trim($_POST['f_name']));
        $l_name = mysql_real_escape_string(trim($_POST['l_name']));
        $office_loc = mysql_real_escape_string(trim($_POST['office_loc']));
        $insert_data = array('f_name' => $f_name, 'l_name' => $l_name, 'office_loc' => $office_loc);
        $data = insertData('users', $insert_data);
        if ($data) {
            $_SESSION['success'] = "New User Added Successfully...";
            $_SESSION['user_id'] = mysql_insert_id();
            echo '<script>window.location.replace("add_device.php");</script>';
        }
    }
}
?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
	<html lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<title>Mobile Device Management ALPHA - Add</title>

		<link href="css/styles.css" rel="stylesheet" type="text/css" />
예제 #14
0
        printError("CBX_ERROR_002", "通行证不正确");
        exit;
    }
}
//从JSON中获取用户通行证
$thePassport = $phpJson->passport;
//从JSON中获取用户装过数
$theInstCount = $phpJson->install_count;
//查询是否存在该通行证,没有则插入数据
$sql = "SELECT * FROM `user` WHERE `passport`='{$thePassport}'";
$result = mysql_query($sql);
if ($row = mysql_fetch_array($result)) {
    //insertData($phpJson,$thePassport,$userName,$theInstCount);
    refactorJson($thePassport, $userName);
} else {
    insertData($phpJson, $thePassport, $userName, $theInstCount);
    refactorJson($thePassport, $userName);
}
//从服务器获取的JSON数据插入数据库
function insertData($phpJson, $thePassport, $userName, $theInstCount)
{
    //插入数据库用户表
    $sqlString_1 = "INSERT INTO `recommend_contrast`.`user` (`id` ,`passport` ,`name`,`install_count`) VALUES (NULL ,'{$thePassport}', '{$userName}','{$theInstCount}');";
    $sqlResult_1 = mysql_query($sqlString_1);
    //如果插入失败,返回error
    /*if(!$sqlResult_1){
      	echo "error1";
      	exit;
      }*/
    //将软件推荐数据插入软件表
    for ($i = 0; $i < count($phpJson->software); $i++) {
예제 #15
0
<?php

//connect to database
$mysqli = new mysqli('localhost', 'elliothc', 'elliothc', 'history_chains');
$action = $_POST["action"];
//depending on the action value, run a different function
switch ($action) {
    case 0:
        insertData($mysqli);
        //sign up - insert data
        break;
    case 3:
        login($mysqli);
        //checks to see if login matches
        break;
}
function insertData($mysqli)
{
    //insert data
    $person_firstname = $_POST["personFName"];
    $person_lastname = $_POST["personLName"];
    $person_dob = $_POST["personDOB"];
    $person_username = $_POST["personUserName"];
    $person_password = $_POST["personPassword"];
    $person_institution = $_POST["personInstitution"];
    //if one of the names is missing, do nothing
    if ($person_firstname == null || $person_lastname == null) {
        return;
    }
    $query = "INSERT INTO user(fname, lname) VALUES ('" . $person_firstname . "', '" . $person_lastname . "')";
    $result = $mysqli->query($query);
예제 #16
0
<?php

include_once '../utiliti/crud_function.php';
#declare variable
$nim = isset($_POST['nim']) ? $_POST['nim'] : null;
$nama = isset($_POST['nama']) ? $_POST['nama'] : null;
$aktivasi = rand();
$status = "belum di aktivasi";
if (isset($_POST['simpan'])) {
    #eksekusi quey insert
    $array_obj = array('id_pemilih' => '', 'nim' => $nim, 'nama' => $nama, 'no_aktivasi' => $aktivasi, 'status' => $status);
    $query_insert = insertData($array_obj, 'voter', $conn);
    $query_insert;
    if ($query_insert) {
        ?>
			<div class="alert alert-success">
				Data Pemilih Berhasil di Tambahkan. Silahkan KLIK <a href="?page=master&ref=data_pemilih">Disini</a> Untuk Kembali.
			</div>
			<?php 
    }
}
//$worksheetName=0;
//$worksheetName=getDetailedTableInfo2("vl_samples_worksheetcredentials","id='$worksheetID' limit 1","worksheetName");
$worksheetReferenceNumber=0;
$worksheetReferenceNumber=getDetailedTableInfo2("vl_samples_worksheetcredentials","id='$worksheetID' limit 1","worksheetReferenceNumber");

//create worksheet
if($proceed) {
	if(count($no_spots_samples)>0){
		define("NO_SPOTS_RES","Invalid test result. There is insufficient sample to repeat the assay");
		foreach($no_spots_samples AS $s_id){
			$data=array("sampleID"=>$s_id,
						"worksheetID"=>$worksheetID,
						"result"=>NO_SPOTS_RES,
						"created"=>$datetime,
						"createdby"=>$trailSessionUser);
			insertData($data,"vl_results_override");
		}
	}

	if(count($worksheetSamples)) {
		//first delete all samples from this worksheet
		mysqlquery("delete from vl_samples_worksheet where worksheetID='$worksheetID'");
		$insert_sql = "";
		foreach($worksheetSamples as $ws) {
			$ws=validate($ws);
			$insert_sql .= "('$worksheetID','$ws','$datetime','$trailSessionUser'),";
		}
		$insert_sql = trim($insert_sql, ",");
		
		mysqlquery("insert into vl_samples_worksheet 
							(worksheetID,sampleID,created,createdby) 
            $userStmt->bindValue(':name', $name, PDO::PARAM_STR);
            $userStmt->bindValue(':location', $location, PDO::PARAM_STR);
            $userStmt->bindValue(':date_established', $date, PDO::PARAM_STR);
            $userStmt->bindValue(':area_in_acres', $area, PDO::PARAM_STR);
            $userStmt->bindValue(':description', $description, PDO::PARAM_STR);
            try {
                $userStmt->execute();
            } catch (Exception $e) {
                $errors[] = $e->getMessage();
                throw new Exception('Error: {$e->getMessage()}');
            }
        }
    }
    return $errors;
}
insertData($dbc);
$data = 'SELECT * FROM national_parks LIMIT :limit OFFSET :offset';
$stmt = $dbc->prepare($data);
// Bind the query parameters
$stmt->bindValue(':limit', $limit, PDO::PARAM_INT);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
$parks = $stmt->fetchAll();
?>


<!doctype html>
<html>
<head>
	<title>National Parks</title>
	<meta charset="utf-8">
예제 #19
0
$host = $argv[2];
$user = $argv[3];
$pass = $argv[4];
$db = $argv[5];
switch ($method) {
    case "inidb":
        echo "running...";
        echo "\n";
        $dbms_schema = $argv[6];
        inidb($host, $user, $pass, $db, $dbms_schema);
        break;
    case "insertData":
        echo "running...";
        echo "\n";
        $dbms_data = $argv[6];
        insertData($host, $user, $pass, $db, $dbms_data);
        break;
    default:
        break;
}
function remove_comments(&$output)
{
    $lines = explode("\n", $output);
    $output = "";
    // try to keep mem. use down
    $linecount = count($lines);
    $in_comment = false;
    for ($i = 0; $i < $linecount; $i++) {
        if (preg_match("/^\\/\\*/", preg_quote($lines[$i]))) {
            $in_comment = true;
        }
예제 #20
0
    if (count($ArtistAnzahl) > 1) {
        //im Array die Werte absteigend sortieren
        array_multisort($Anzahl, SORT_DESC, $ArtistAnzahl);
        //jetzt noch die TOP 8 raus suchen, wenn mehr als 8 Artists vorhanden sind
        if (count($ArtistAnzahl) > 8) {
            $Top8 = array();
            for ($x = 0; $x <= 7; $x++) {
                //die TOP 8 ins Array schreiben
                $Top8[] = $ArtistAnzahl[$x];
            }
        } else {
            //ansonsten die Artists ins Array schreiben
            $Top8 = array();
            for ($x = 0; $x < count($ArtistAnzahl); $x++) {
                $Top8[] = $ArtistAnzahl[$x];
            }
        }
    } else {
        if (count($ArtistAnzahl) == 1) {
            //wenn nur 1 Artist gefunden wurde, diesen ins Array schreiben
            $Top8 = array();
            $Top8[] = $ArtistAnzahl[0];
        }
    }
    //Array fuer DB vorbereiten
    foreach ($Top8 as $relatedArtist) {
        $relatedArtists = array("RelatedArtists_Artist" => $relatedArtist['relArtist'], "Artists_ID" => $artist['Artists_ID'], "RelatedArtists_SortId" => $relatedArtist['Anzahl']);
        //Jeden einzelnen Eintrag in die DB schreiben
        insertData('relatedartists', $relatedArtists);
    }
}
예제 #21
0
function addNewEntry()
{
    if ($valid_request = validateRequest()) {
        //prepare Post vars
        /** 
         * XSS Cleaner For Name and Email Fields
         */
        //sanitize vars
        $name = strip_tags($_POST['name']);
        $email = strip_tags($_POST['email']);
        //checking if post vars are empty or invalid
        $name = trim($name);
        $email = trim($email);
        //prepare insert SQL Script
        $insert_sql = "INSERT INTO TBL_ITEMS (NAME,EMAIL) VALUES ('" . $name . "','" . $email . "')";
        //insert into database
        $resp = insertData($insert_sql);
        //check anwser and redirect
        if (!$resp) {
            $_SESSION['errors'] .= "- Fail to insert into database!<br/>";
        } else {
            $_SESSION['success'] .= "- The data was inserted successfully!<br/>";
        }
        //Close Session Write
        session_write_close();
        //redirect
        header("Location: ../../add");
        die;
    } else {
        $_SESSION['errors'] .= "- The request was not accepted!<br/>";
        //Close Session Write
        session_write_close();
        //redirect
        header("Location: ../../add");
        die;
    }
}
예제 #22
0
if ($action == "MakeOrderRequest") {
    unset($_POST["Action"]);
    connectDB($gasDatabaseName);
    $couponId = post("CouponId");
    if (!empty($couponId)) {
        $sql = "update Coupon set IsUse = 1 where CouponId = '{$couponId}'";
        query($sql);
    }
    $merchantOrderNo = time();
    $_POST["MerchantOrderNo"] = $merchantOrderNo;
    $_POST["Uid"] = session("Uid");
    $_POST["UserName"] = session("Info")["CustomerName"];
    $_POST["PhoneNumber"] = session("Info")["PhoneNumber"];
    $_POST["CustomerId"] = session("Info")["Uid"];
    $_POST["OrderTime"] = date("Y-m-d H:i:s");
    insertData("GasOrder");
    $result["MerchantOrderNo"] = $merchantOrderNo;
    $result["OrderAmount"] = post("OrderAmount");
    printResultByMessage("", 0, $result);
} else {
    if ($action == "AffirmReceiveGas") {
        connectDB($gasDatabaseName);
        $orderId = post("OrderId");
        $orderCompleteTime = date("Y-m-d H:i:s");
        $sql = "update GasOrder set OrderComplete = 1, OrderCompleteTime = '{$orderCompleteTime}' where OrderId = '{$orderId}'";
        query($sql, $error);
        if (empty($error)) {
            printResultByMessage("", 0);
        } else {
            printResultByMessage("Fail", 1001);
        }
예제 #23
0
<?php

include_once '../utiliti/crud_function.php';
#input ke log
$id = isset($_GET['id']) ? $_GET['id'] : null;
$array_obj = array('id_log' => '', 'id_calon' => $id);
insertData($array_obj, 'log', $conn);
# Update data calon yang sudah memilih
$id_voter = $_SESSION['no_aktv'];
$array_obj2 = array('status' => 'sudah memilih');
updateData($array_obj2, 'voter', $id_voter, 'no_aktivasi', $conn);
#unset nomor aktv
unset($_SESSION['no_aktv']);
?>

<h1 align="center"> TERIMA KASIH SUDAH MENGGUNAKAN HAK PILIH</h1>
<h2 align="center">SILAHKAN TINGGALKAN BILIK SUARA DAN PASTIKAN TIDAK ADA YANG TERTINGGAL</h2>
예제 #24
0
<?php 
include_once '../utiliti/crud_function.php';
$id = 1;
$waktu_selesai = date("H:i:s");
$status = "pemungutan selesai";
#eksekusi query
$array_obj = array('status' => $status, 'waktu_selesai' => $waktu_selesai);
updateData($array_obj, 'waktu_pemilihan', $id, 'id_waktu', $conn);
#input data statistik :
$query_calon = $conn->query("SELECT * FROM calon");
while ($result_calon = $query_calon->fetch_array()) {
    $id_calon = $result_calon['id_calon'];
    $query_log = $conn->query("SELECT * FROM log WHERE id_calon = '{$id_calon}'");
    $hitung_log = $query_log->num_rows;
    $array_obj1 = array('id_statistik' => '', 'id_calon' => $id_calon, 'jum_suara' => $hitung_log);
    insertData($array_obj1, 'statistik', $conn);
}
# mengitung prosentase data
$query_jum = $conn->query("SELECT SUM(jum_suara) AS jumlah_suara FROM statistik");
$result_jum = $query_jum->fetch_array();
$jumlah = $result_jum['jumlah_suara'];
$query_prosentase = $conn->query("SELECT * FROM statistik");
while ($result_prosentase = $query_prosentase->fetch_array()) {
    $id_calon = $result_prosentase['id_calon'];
    $jum_temp = $result_prosentase['jum_suara'];
    #hitung prosentase
    $prosentase = $jum_temp * 100 / $jumlah;
    $array_obj2 = array('prosentase' => $prosentase);
    updateData($array_obj2, 'statistik', $id_calon, 'id_calon', $conn);
}
?>
예제 #25
0
				</div>
				<?php 
        } else {
            ?>
				<div class="alert alert-danger">
					<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
					Gagal Tambah Data
				</div>				
				<?php 
        }
    } else {
        if ($format == "image/jpeg" || $format == "image/jpg" || $format == "image/png" || $format == "image/JPG") {
            if (move_uploaded_file($temp, $dir)) {
                $array_param = array('id_calon' => '', 'nim' => $nim, 'nama' => $nama, 'prodi' => $prodi, 'visi' => $visi, 'img' => $foto);
                // declare var yang mendefinisikan function insert
                $query_simpan = insertData($array_param, 'calon', $conn);
                $query_simpan;
                if ($query_simpan) {
                    ?>
						<div class="alert alert-success">
							<strong>Berhasil!</strong> Calon berhasil di tambahkan .. klik <a href="?page=master&ref=data_calon">Disini</a> Untuk Kembali
						</div>
						<?php 
                } else {
                    ?>
						<div class="alert alert-danger">
							<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
							Gagal Tambah Data
						</div>				
						<?php 
                }
예제 #26
0
function logUpdate($table="",$cols="",$cond=""){
	global $trailSessionUser;
	$res=mysqlquery("SELECT id,$cols FROM $table WHERE $cond");
	while($row=mysqlfetchassoc($res)){
		$log_data=array();
		$log_data['table_name']=$table;
		$log_data['table_id']=$row['id'];
		$log_data['old_information']=json_encode($row);
		$log_data['created']=date("Y-m-d H:i:s");
		$log_data['createdby']=$trailSessionUser;
		insertData($log_data,"vl_logs_edits");
	}
}
예제 #27
0
파일: save_latlng.php 프로젝트: hoogle/ttt
<?php

session_start();
require LIBRARY_PATH . "function.php";
$curr_time = date("Y-m-d H:i:s");
if (isset($_POST['action'])) {
    $db = Mysql::getInstance('localhost');
    switch ($_POST['action']) {
        case "create":
            $data_point = array("userid" => $_SESSION['userid'], "lat" => $_POST['lat'], "lng" => $_POST['lng'], "curr_time" => $curr_time);
            insertData("web3.map_point", $data_point, $new_markerid);
            $data_photo = array("userid" => $_SESSION['userid'], "set" => $set, "title" => $title, "description" => $desc, "post_time" => $curr_time, "point_id" => $new_markerid);
            insertData("web3.photo", $data_photo, $new_photo);
            $db->close();
            echo "{new_markerid:{$new_markerid}}";
            break;
        case "update":
            $sql = "UPDATE web3.map_point SET ";
            $sql .= "lat = '{$_POST['lat']}', lng = '{$_POST['lng']}', curr_time = '{$curr_time}' ";
            $sql .= "WHERE id = '{$_POST['point_id']}'";
            $db->query($sql);
            $db->close();
            break;
    }
}
예제 #28
0
    $note = str_replace("\r\n", " ", $note);
    $devices_row = getRow("SELECT * FROM `devices` WHERE `user_id` ='{$user_ID}'");
    $insert_data = array('user_id' => $user_ID, 'make' => $manufac, 'model' => $model, 'phone_num' => $phone, 'serial_num' => $serial, 'imei_string' => $imei, 'purchaser' => $purchaser, 'price' => $price, 'purchase_date' => $purchase_date, 'carrier' => $carrier, 'device_status' => $status);
    if ($devices_row == null) {
        $data = insertData('devices', $insert_data);
        $devices_ID = mysql_insert_id();
    } else {
        $where = array('user_id' => $user_ID);
        $data = updateData('devices', $insert_data, $where);
        $devices_ID = $devices_row[0];
    }
    if ($data) {
        $activity_data = array('user_id' => $user_ID, 'device_id' => $devices_ID, 'activity_type' => '', 'activity_notes' => $note, 'activity_date' => date("Y-m-d"));
        $activity_row = getRow("SELECT * FROM `activity_log` WHERE `user_id` ='{$user_ID}'");
        if ($activity_row == null) {
            insertData('activity_log', $activity_data);
            echo "<h3 class='success-msg'>Device Added Successfully.</h3>";
        } else {
            $where = array('user_id' => $user_ID);
            $data = updateData('activity_log', $activity_data, $where);
            echo "<h3 class='success-msg'>Device Updated Successfully.</h3>";
        }
    }
}
if (!empty($_SESSION['user_id'])) {
    $user_data = get_user_data($_SESSION['user_id']);
    $name = $user_data->f_name . ' ' . $user_data->l_name;
    if ($device_data = get_device_data($_SESSION['user_id'])) {
        $purchase_date = $device_data->purchase_date ? $device_data->purchase_date : '';
        $price = $device_data->price ? $device_data->price : '';
        $imei = $device_data->imei_string ? $device_data->imei_string : '';
예제 #29
0
    $cltId = '';
    $getVehi = "SELECT ci_clientName,di_deviceId,di_deviceName,di_imeiId,ci_clientId FROM tb_deviceinfo,tb_clientinfo WHERE ci_id = di_clientId AND di_mobileNo='" . $src . "' AND di_status=1";
    $resVehi = $db->query($getVehi);
    if ($db->affected_rows > 0) {
        $fetVehi = $db->fetch_array($resVehi);
        //print_r($fetVehi);
        $cltId = $fetVehi[di_imeiId];
        $path = $GLOBALS[dataPath] . "src/data/" . date('d-m-Y') . "/" . $fetVehi[di_imeiId] . ".txt";
        //$path=$dataPath."client_".$fetVehi[vi_clientId]."/10-05-2009/".$src.".txt";
        if ($fetVehi[di_deviceName] != "") {
            $devName = $fetVehi[di_deviceName];
        } else {
            $devName = $fetVehi[di_deviceId];
        }
        PrintKMLFolder($path, $devName, $fetVehi[ci_clientId]);
        insertData($src);
    } else {
        print "Invalid data.";
        $from = "Shastra";
        $to = $_GET[from];
        //sendLocation($from,$to,$message,$fetVehi[ci_clientId]);
    }
} else {
    print "Parameter missing. Please check the data once.";
    $from = "";
    $to = $_GET[from];
    //sendLocation($from,$to,$message);
    //echo "Invalid";
}
function insertData($src)
{
예제 #30
0
$user = "******";
$url = getFirstURL($token);
echo $url;
// die();
// $url = "";
$tot = 500;
for ($i = 0; $i < $tot; $i++) {
    // Initialize cURL session
    $ch = curl_init($url);
    // Option to Return the Result, rather than just true/false
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    // setting headers
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Fk-Affiliate-Id: ' . $user, 'Fk-Affiliate-Token: ' . $token));
    // Perform the request, and save content to $result
    $result = curl_exec($ch);
    // print_r($result);
    if ($result === FALSE) {
        die("Curl failed: " . curL_error($ch));
    }
    $data = json_decode($result, true);
    curl_close($ch);
    // print_r($data);
    insertData($data);
    $url = $data['nextUrl'];
    echo "<br>trying next URL<br>";
    if ($url == null) {
        echo "<br> exiting the loop";
        break;
    }
}