当前位置: 首页>>代码示例>>PHP>>正文


PHP query_one函数代码示例

本文整理汇总了PHP中query_one函数的典型用法代码示例。如果您正苦于以下问题:PHP query_one函数的具体用法?PHP query_one怎么用?PHP query_one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了query_one函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: query_several

        echo "\n<option value=\"{$SiteID}\">{$SiteName} ({$from_date} - {$to_date})</option>";
    }
    echo "</select> (Required)";
    $sites = query_several("SELECT Sites.SiteID,Sites.SiteName FROM Sites,Sounds WHERE Sites.SiteID=Sounds.SiteID \n\t\tAND Sounds.SoundStatus!='9' {$qf_check} GROUP BY SiteName", $connection);
    $nrows_sites = mysqli_num_rows($sites);
    echo "<p style=\"margin-left:10px;\">Site 2:</p>\n\t\t<select name=\"site2\" class=\"ui-state-default ui-corner-all\">\n\t\t<option></option>";
    for ($sc = 0; $sc < $nrows_sites; $sc++) {
        $row_site = mysqli_fetch_array($sites);
        extract($row_site);
        $SiteName = truncate2($SiteName, 60);
        $from_date = query_one("SELECT DATE_FORMAT(Date,'%d-%b-%Y') AS Date_f from Sounds WHERE SiteID='{$SiteID}' \n\t\t\tAND Sounds.SoundStatus!='9' {$qf_check} ORDER BY Date ASC LIMIT 1", $connection);
        $to_date = query_one("SELECT DATE_FORMAT(Date,'%d-%b-%Y') AS Date_f from Sounds WHERE SiteID='{$SiteID}' \n\t\t\tAND Sounds.SoundStatus!='9' {$qf_check} ORDER BY Date DESC LIMIT 1", $connection);
        echo "\n<option value=\"{$SiteID}\">{$SiteName} ({$from_date} - {$to_date})</option>";
    }
    echo "</select>";
    $sites = query_several("SELECT Sites.SiteID,Sites.SiteName FROM Sites,Sounds WHERE Sites.SiteID=Sounds.SiteID \n\t\tAND Sounds.SoundStatus!='9' {$qf_check} GROUP BY SiteName", $connection);
    $nrows_sites = mysqli_num_rows($sites);
    echo "<p style=\"margin-left:10px;\">Site 3:</p>\n\t\t<select name=\"site3\" class=\"ui-state-default ui-corner-all\">\n\t\t<option></option>";
    for ($sc = 0; $sc < $nrows_sites; $sc++) {
        $row_site = mysqli_fetch_array($sites);
        extract($row_site);
        $SiteName = truncate2($SiteName, 60);
        $from_date = query_one("SELECT DATE_FORMAT(Date,'%d-%b-%Y') AS Date_f from Sounds WHERE SiteID='{$SiteID}' \n\t\t\tAND Sounds.SoundStatus!='9' {$qf_check} ORDER BY Date ASC LIMIT 1", $connection);
        $to_date = query_one("SELECT DATE_FORMAT(Date,'%d-%b-%Y') AS Date_f from Sounds WHERE SiteID='{$SiteID}' \n\t\t\tAND Sounds.SoundStatus!='9' {$qf_check} ORDER BY Date DESC LIMIT 1", $connection);
        echo "\n<option value=\"{$SiteID}\">{$SiteName} ({$from_date} - {$to_date})</option>";
    }
    echo "</select>";
    echo "<input type=submit value=\" Show comparison \" class=\"fg-button ui-state-default ui-corner-all\">\n\t\t</form>";
} else {
    echo "<p>There are no sounds with dates in the database.</p>";
}
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:comparesites.php

示例2: query_several

$result = query_several($query, $connection);
$nrows = mysqli_num_rows($result);
if ($nrows == 0) {
    echo "<div class=\"error\"><img src=\"images/exclamation.png\"> There was an error. That file ID could not be found. Please go back and try again or contact the administrator.</div>";
} else {
    $row = mysqli_fetch_array($result);
    extract($row);
    $SiteName = query_one("SELECT SiteName FROM Sites WHERE SiteID='{$SiteID}'", $connection);
    $SiteLat = query_one("SELECT SiteLat FROM Sites WHERE SiteID='{$SiteID}'", $connection);
    $SiteLon = query_one("SELECT SiteLon FROM Sites WHERE SiteID='{$SiteID}'", $connection);
    echo "<div class=\"span-24 last\">\t\t\t\n\t\t\t\t\t<h3>Edit sound file information</h3>";
    if ($d == 1) {
        echo "<p><div class=\"success\"><img src=\"images/accept.png\"> File was updated successfully. Return to <a href=\"db_filedetails.php?SoundID={$SoundID}\">the sound file</a></div>";
    }
    echo "<p><a href=\"db_filedetails.php?SoundID={$SoundID}\">{$SoundName}</a>\n\t\t\t\t<br>Filename: {$OriginalFilename}";
    $col_name = query_one("SELECT Collections.CollectionName from Collections,Sounds WHERE Collections.ColID=Sounds.ColID AND Sounds.SoundID='{$SoundID}'", $connection);
    #Source info
    echo "<br>From: <a href=\"db_browse.php?ColID={$ColID}\">{$col_name}</a>\n\t\t\t\t<p><form action=\"file_edit2.php\" method=\"POST\" id=\"EditForm\">\n\t\t\t\t\t<input name=\"SoundID\" type=\"hidden\" value=\"{$SoundID}\">\n\n\t\t\t\tNew name of the sound: <br><input name=\"SoundName\" type=\"text\" maxlength=\"160\" size=\"60\" value=\"{$SoundName}\" class=\"fg-button ui-state-default ui-corner-all formedge\"><br>\n\t\t\t\tCustom ID of sound: <br><input name=\"OtherSoundID\" type=\"text\" maxlength=\"10\" value=\"{$OtherSoundID}\" class=\"fg-button ui-state-default ui-corner-all formedge\"><br>\n\t\t\t\tDate: <br><input name=\"Date\" type=\"text\" size=\"10\" value=\"{$Date}\" id=\"datepicker\" class=\"fg-button ui-state-default ui-corner-all formedge\"> (month/day/year)<br>\n\t\t\t\tTime: <br><input name=\"Time\" type=\"text\" size=\"10\" value=\"{$Time}\" class=\"fg-button ui-state-default ui-corner-all formedge\"> (hour:minute:second)<br>\n\t\t\t\tSite: <a href=\"browse_site.php?SiteID={$SiteID}\" title=\"Browse all the recordings at this site\">{$SiteName}</a> - <a href=\"viewsite_map.php?SiteID={$SiteID}\">Map</a><br>\n\t\t\t\tChange the site: <br>";
    $query_s = "SELECT SiteID AS this_SiteID, SiteName AS this_SiteName, SiteLat AS this_SiteLat, SiteLon AS this_SiteLon FROM Sites ORDER BY this_SiteName";
    $result_s = mysqli_query($connection, $query_s) or die(mysqli_error($connection));
    $nrows_s = mysqli_num_rows($result_s);
    echo "<select name=\"SiteID\" class=\"ui-state-default ui-corner-all formedge\">";
    echo "<option value=\"{$SiteID}\">{$SiteName} ({$SiteLat}/{$SiteLon})</option>\n";
    for ($j = 0; $j < $nrows_s; $j++) {
        $row_s = mysqli_fetch_array($result_s);
        extract($row_s);
        echo "<option value=\"{$this_SiteID}\">{$this_SiteName} ({$this_SiteLat}/{$this_SiteLon})</option>\n";
    }
    echo "</select>";
    echo " &nbsp;&nbsp;<a href=\"#\" onclick=\"window.open('include/addsite.php', 'addsite', 'width=650,height=350,status=yes,resizable=yes,scrollbars=auto')\">Add sites</a><br>";
    $query_e = "SELECT SensorID as SensorID_q, Recorder, Microphone from Sensors ORDER BY SensorID_q";
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:file_edit.php

示例3: mysqli_fetch_array

        if ($nrows_kml > 0) {
            $kml_default = 1;
            for ($k = 0; $k < $nrows_kml; $k++) {
                $row_kml = mysqli_fetch_array($result_kml);
                extract($row_kml);
                echo "\nvar ctaLayer{$k} = new google.maps.KmlLayer('{$this_kmlurl}',{preserveViewport:true});\n\t\t\t\t\t\t        ctaLayer{$k}.setMap(map);\n";
            }
        }
    }
    #KML layers forced on
    $querykml = "SELECT * FROM Kml WHERE KmlDefault='2'";
    $result_kml = query_several($querykml, $connection);
    $nrows_kml = mysqli_num_rows($result_kml);
    for ($kk = 0; $kk < $nrows_kml; $kk++) {
        $row_kml = mysqli_fetch_array($result_kml);
        extract($row_kml);
        echo "\nvar ctaLayer{$k} = new google.maps.KmlLayer('{$KmlURL}',{preserveViewport:true});\n\t\t\t\t        ctaLayer{$k}.setMap(map);\n";
    }
    echo "var myBounds = new google.maps.LatLngBounds(); \n\t\t\t   \n\t\t\t\tsetMarkers(map, sites);\n\t\t\t\t    infowindow = new google.maps.InfoWindow({\n\t\t\t\t\tcontent: \"loading...\"\n\t\t\t\t \t});\n";
    for ($p = 0; $p < count($sites_bounds); $p++) {
        echo $sites_bounds[$p];
    }
    echo "\nmap.fitBounds(myBounds);\n\t\t\t\t    }\n\t\t\t\t</script>\n";
} else {
    $use_googlemaps = query_one("SELECT Value from PumilioSettings WHERE Settings='use_googlemaps'", $connection);
    if ($use_googlemaps == "1") {
        die("<div class=\"error\">The system is set up to use Google Maps v2. This version has been deprecated. Please update your settings in the administration menu or contact your administrator.</div>");
    } else {
        die("<div class=\"error\">The system is not set up for the use of Google Maps.</div>");
    }
}
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:browse_map_head.php

示例4: filter_var

$newqf = filter_var($_GET["newqf"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n<head>\n<title>{$app_custom_name}</title>";
#Get CSS
require "include/get_css.php";
require "include/get_jqueryui.php";
if ($use_googleanalytics) {
    echo $googleanalytics_code;
}
#Execute custom code for head, if set
if (is_file("{$absolute_dir}/customhead.php")) {
    include "customhead.php";
}
?>

</head>
<body>

<div style="padding: 10px;">

<?php 
$a = query_one("UPDATE Sounds SET QualityFlagID='{$newqf}' WHERE SoundID='{$SoundID}'", $connection);
echo "<div class=\"success\">Quality Flag changed for this file. {$a}</div>";
?>

<br><p><a href="#" onClick="opener.location.reload();window.close();">Close window.</a>

</div>

</body>
</html>
开发者ID:nperezg,项目名称:pumilio,代码行数:30,代码来源:editqf.php

示例5: session_start

session_start();
require "include/functions.php";
$config_file = 'config.php';
if (file_exists($config_file)) {
    require "config.php";
} else {
    header("Location: error.php?e=config");
    die;
}
require "include/apply_config.php";
$Token = filter_var($_GET["Token"], FILTER_SANITIZE_STRING);
$username = $_COOKIE["username"];
$UserID = query_one("SELECT UserID FROM Users WHERE UserName='{$username}'", $connection);
$valid_token = query_one("SELECT COUNT(*) FROM Tokens WHERE TokenID='{$Token}' AND UserID='{$UserID}'", $connection);
if ($valid_token == 1) {
    $SoundID = query_one("SELECT soundfile_id FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $random_cookie = query_one("SELECT random_cookie FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $from_db = query_one("SELECT from_db FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
}
$del_token = query_one("DELETE FROM Tokens WHERE TokenID='{$Token}'", $connection);
#rm temp dir
delTree('tmp/' . $random_cookie . '/');
// Relocate back to the first page of the application
if ($from_db == "TRUE") {
    #echo $from_db;
    header("Location: ./db_filedetails.php?SoundID={$SoundID}");
    die;
} else {
    header("Location: ./");
    die;
}
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:closefile.php

示例6: query_one

?>

</head>
<body>

	<!--Blueprint container-->
	<div class="container">
		<?php 
require "include/topbar.php";
?>
		<div class="span-24 last">
			<hr noshade>
		</div>
		<div class="span-24 last">
			<?php 
$WeatherSiteName = query_one("SELECT WeatherSiteName FROM WeatherSites WHERE WeatherSiteID='{$WeatherSiteID}' LIMIT 1", $connection);
echo "<h3>Add data to {$WeatherSiteName}</h3>";
echo "There are 10 comma-separated fields:\n\t\t\t\t<ul>\n\t\t\t\t\t<li>Date (YYYY-MM-DD)\n\t\t\t\t\t<li>Time (HH:MM:SS)\n\t\t\t\t\t<li>Temperature (degrees Celcius)\n\t\t\t\t\t<li>Precipitation (mm)\n\t\t\t\t\t<li>Relative Humidity (%)\n\t\t\t\t\t<li>Dew Point\n\t\t\t\t\t<li>Wind Speed (m/s)\n\t\t\t\t\t<li>Wind Direction\n\t\t\t\t\t<li>Light Intensity\n\t\t\t\t\t<li>Barometric Pressure\n\t\t\t\t</ul>";
echo "<form action=\"add_weatherdata2.php\" method=\"POST\" id=\"AddForm\">\n\t\t\t\t<p>Add one line for each data point (use [enter] for a new line) with each field separated by a comma (,). If the data is missing, enter \"NULL\" without the quotes or leave empty.\n\t\t\t\t<textarea name=\"commadata\" cols=\"60\" rows=\"10\"></textarea>\n\t\t\t\t<input type=\"hidden\" name=\"WeatherSiteID\" value=\"{$WeatherSiteID}\">\n\t\t\t\t<br><input type=submit value=\" Check data and insert to database \" class=\"fg-button ui-state-default ui-corner-all\">\n\t\t\t</form>";
?>

		</div>
		<div class="span-24 last">
			&nbsp;
		</div>
		<div class="span-24 last">
			<?php 
require "include/bottom.php";
?>

		</div>
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:add_weatherdata.php

示例7: query_one

if ($use_googleanalytics) {
    echo $googleanalytics_code;
}
#Execute custom code for head, if set
if (is_file("{$absolute_dir}/customhead.php")) {
    include "customhead.php";
}
?>

</head>
<body>

<div style="padding: 10px;">

<?php 
$SiteName = query_one("SELECT SiteName FROM Sites WHERE SiteID='{$SiteID}'", $connection);
echo "<h3>Photographs at {$SiteName}:</h3>";
$query = "SELECT *, DATE_FORMAT(PhotoDate, '%d-%b-%Y %H:%i:%s') AS PhotoDate_f FROM Sites, SitesPhotos WHERE Sites.SiteID='{$SiteID}' AND \n\t\tSites.SiteID=SitesPhotos.SiteID ORDER BY PhotoDate, ViewDegrees";
$result = query_several($query, $connection);
$nrows = mysqli_num_rows($result);
if ($nrows > 0) {
    for ($i = 0; $i < $nrows; $i++) {
        $row = mysqli_fetch_array($result);
        extract($row);
        echo "<p><strong>{$PhotoDate_f}</strong><br>\n\t\t\t<div style=\"padding: 10px;\"><a href=\"#\" onclick=\"window.open('sitephotos/{$SiteID}/{$PhotoFilename}', 'pics1', 'width=1000,height=800,status=yes,resizable=yes,scrollbars=yes'); return false;\"><img src=\"sitephotos/{$SiteID}/{$PhotoFilename}\" width=\"200\"></a><br>";
        if (isset($ViewDegrees) && $ViewDegrees != "") {
            echo "Direction: {$ViewDegrees}<br>";
        }
        if (isset($PhotoNotes) && $PhotoNotes != "") {
            echo "Notes: {$PhotoNotes}<br>";
        }
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:sitephotos.php

示例8: filter_var

require "include/check_login.php";
$Token = filter_var($_GET["Token"], FILTER_SANITIZE_STRING);
$username = $_COOKIE["username"];
$UserID = query_one("SELECT UserID FROM Users WHERE UserName='{$username}'", $connection);
$valid_token = query_one("SELECT COUNT(*) FROM Tokens WHERE TokenID='{$Token}' AND UserID='{$UserID}'", $connection);
if ($valid_token == 1) {
    $soundfile_format = query_one("SELECT soundfile_format FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $soundfile_duration = query_one("SELECT soundfile_duration FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $soundfile_name = query_one("SELECT soundfile_name FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $soundfile_wav = query_one("SELECT soundfile_wav FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $soundfile_id = query_one("SELECT soundfile_id FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $no_channels = query_one("SELECT no_channels FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $soundfile_samplingrate = query_one("SELECT soundfile_samplingrate FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $soundfile_samplingrateoriginal = query_one("SELECT soundfile_samplingrateoriginal FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $random_cookie = query_one("SELECT random_cookie FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
    $from_db = query_one("SELECT from_db FROM Tokens WHERE TokenID='{$Token}' LIMIT 1", $connection);
}
$SoundID = $soundfile_id;
if (isset($_COOKIE["palette"])) {
    $palette = $_COOKIE["palette"];
} else {
    $palette = "";
}
#Sanitize
if (isset($_GET["ch"])) {
    $ch = filter_var($_GET["ch"], FILTER_SANITIZE_NUMBER_INT);
} else {
    $ch = "1";
}
if (isset($_GET["filter"])) {
    $filter = filter_var($_GET["filter"], FILTER_SANITIZE_STRING);
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:pumilio.php

示例9: query_one

</head>
<body>

	<!--Blueprint container-->
	<div class="container">
		<?php 
require "include/topbar.php";
?>
		<div class="span-24 last">
			<hr noshade>
		</div>
		<div class="span-11">
			<?php 
//How many sounds associated with that tag
$no_sounds = query_one("SELECT COUNT(*) as no_sounds_tag FROM Tags WHERE Tag='{$Tagq}'", $connection);
if ($startid < 1) {
    $startid = 1;
}
$startid_q = $startid - 1;
if ($display_type == "summary") {
    $how_many_to_show = 10;
} elseif ($display_type == "gallery") {
    $how_many_to_show = 18;
}
$endid = $how_many_to_show;
$endid_show = $startid_q + $endid;
if ($startid_q + $how_many_to_show >= $no_sounds) {
    $endid_show = $no_sounds;
}
$sql_limit = "{$startid_q}, {$endid}";
开发者ID:nperezg,项目名称:pumilio,代码行数:30,代码来源:browse_by_tag.php

示例10: mysqli_fetch_array

            $row_tagcloud = mysqli_fetch_array($result_tagcloud);
            extract($row_tagcloud);
            $no_times = query_one("SELECT COUNT(*) FROM Tags WHERE Tag='{$Tag}'", $connection);
            array_push($tags_count, $no_times);
        }
        $max_tag_count = max($tags_count);
        $result_tagcloud = query_several("SELECT DISTINCT Tag FROM Tags ORDER BY RAND()", $connection);
        $nrows_tagcloud = mysqli_num_rows($result_tagcloud);
        echo "<p>";
        $counter = 0;
        if ($nrows_tagcloud > 10) {
            $counter_break = 5;
        } else {
            $counter_break = 10;
        }
        for ($tc = 0; $tc < $nrows_tagcloud; $tc++) {
            $row_tagcloud = mysqli_fetch_array($result_tagcloud);
            extract($row_tagcloud);
            $no_times = query_one("SELECT COUNT(*) FROM Tags WHERE Tag='{$Tag}'", $connection);
            $this_tag_size = 10 + round(round($no_times / $max_tag_count) * 10);
            echo "<a href=\"browse_by_tag.php?Tag={$Tag}\" style=\"font-size: {$this_tag_size};\">{$Tag}</a> &nbsp;&nbsp; ";
            $counter++;
            if ($counter > $counter_break) {
                $counter = 0;
                echo "<br>";
            }
        }
    }
} else {
    echo "<p>There are no tags in the database.";
}
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:tagcloud.php

示例11: mysqli_query

         echo "<tr><td>\n\t\t\t\t\t&nbsp;</td><td><strong>File</strong></td><td>&nbsp;</td><td><strong>Status</strong></td></tr>\n";
         $query_1 = "SELECT * from FilesToAddMembers WHERE FilesToAddID='{$FilesToAddID}' ORDER BY ReturnCode DESC";
         $result_1 = mysqli_query($connection, $query_1) or die(mysqli_error($connection));
         $nrows_1 = mysqli_num_rows($result_1);
         if ($nrows_1 > 0) {
             for ($j = 0; $j < $nrows_1; $j++) {
                 $row_1 = mysqli_fetch_array($result_1);
                 extract($row_1);
                 echo "<tr><td>&nbsp;</td><td>{$FullPath}</td><td>&nbsp;</td>\n";
                 if ($ReturnCode == 1) {
                     echo "<td> <img src=\"images/database.png\"> To add</td></tr>\n";
                 } elseif ($ReturnCode == 0) {
                     echo "<td> <img src=\"images/accept.png\"> Added to archive</td></tr>\n";
                 } elseif ($ReturnCode == 2) {
                     echo "<td> <img src=\"images/ajax-loader.gif\"> Working... ";
                     $mins_working = query_one("SELECT TIMESTAMPDIFF(MINUTE, TimeStamp, NOW()) FROM FilesToAddMembers\n\t\t\t\t\t\t\t\t\t\tWHERE ToAddMemberID='{$ToAddMemberID}'", $connection);
                     if ($mins_working > 5) {
                         echo "(working for more than five minutes, <a href=\"file_manager.php?ToAddMemberID={$ToAddMemberID}&tab={$i}&action=1\" title=\"Reset\">reset</a> or\n\t\t\t\t\t\t\t\t\t\t<a href=\"file_manager.php?ToAddMemberID={$ToAddMemberID}&tab={$i}&action=2\" title=\"Reset\">delete</a>?)";
                     }
                     echo "</td></tr>\n";
                 } elseif ($ReturnCode == 9) {
                     echo "<td> <img src=\"images/error.png\"> Error: {$ErrorCode}<br>\n\t\t\t\t\t\t\t\t\t<a href=\"file_manager.php?ToAddMemberID={$ToAddMemberID}&tab={$i}&action=1\" title=\"Reset\">reset</a> |\n\t\t\t\t\t\t\t\t\t<a href=\"file_manager.php?ToAddMemberID={$ToAddMemberID}&tab={$i}&action=2\" title=\"Reset\">delete</a>\n\t\t\t\t\t\t\t\t\t</td></tr>\n";
                 }
             }
         }
         echo "</table>\n";
     } else {
         echo "<p><a href=\"file_manager.php?tab={$i}\" title=\"Show details\">Show details</a>";
     }
     echo "</div>\n";
 }
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:file_manager.php

示例12: stats_in_background

function stats_in_background($absolute_dir, $connection)
{
    $cores_to_use = query_one("SELECT Value from PumilioSettings WHERE Settings='cores_to_use'", $connection);
    if ($cores_to_use == "" || $cores_to_use == "0") {
        $cores_to_use = 1;
    }
    require "config.php";
    $bg_processes = bgHowMany();
    if ($bg_processes < $cores_to_use) {
        $random_value = mt_rand();
        $tmp_dir = 'tmp/' . $random_value;
        mkdir($tmp_dir, 0777);
        #make htaccess to protect files
        $myFile = $tmp_dir . '/.htaccess';
        $fh = fopen($myFile, 'w') or die("Can't write the configuration file {$myFile}. Please check that the webserver can write the tmp directory.");
        fwrite($fh, "order allow,deny" . PHP_EOL);
        fwrite($fh, "deny from all" . PHP_EOL);
        fclose($fh);
        #write config file
        $myFile = $tmp_dir . '/configfile.php';
        $fh = fopen($myFile, 'w') or die("Can't write the configuration file {$myFile}. Please check that the webserver can write the tmp directory.");
        fwrite($fh, "<?php" . PHP_EOL);
        fwrite($fh, "{$host}" . PHP_EOL);
        fwrite($fh, "{$database}" . PHP_EOL);
        fwrite($fh, "{$user}" . PHP_EOL);
        fwrite($fh, "{$password}" . PHP_EOL);
        fwrite($fh, "{$absolute_dir}/" . PHP_EOL);
        fwrite($fh, "{$random_value}" . PHP_EOL);
        fwrite($fh, "{$R_ADI_db_value}" . PHP_EOL);
        fwrite($fh, "{$R_ADI_max_freq}" . PHP_EOL);
        fwrite($fh, "{$R_ADI_freq_step}" . PHP_EOL);
        fwrite($fh, "{$R_H_segment_length}" . PHP_EOL);
        fwrite($fh, "?>");
        fclose($fh);
        copy('include/R/stats_pumiliodb.py', $tmp_dir . '/stats_pumiliodb.py');
        copy('include/R/getstats.R', $tmp_dir . '/getstats.R');
        exec('chmod +x ' . $tmp_dir . '/*', $out, $retval);
        exec('chmod -R 777 ' . $tmp_dir . '', $out, $retval);
        exec('cd ' . $tmp_dir . '; ./stats_pumiliodb.py > /dev/null 2> /dev/null & echo $!', $out, $retval);
    }
}
开发者ID:nperezg,项目名称:pumilio,代码行数:41,代码来源:functions.php

示例13: unlink

                if (is_file("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile)) {
                    unlink("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile);
                }
                $ImageFile = query_one("SELECT ImageFile FROM SoundsImages WHERE SoundID='{$SoundID}' AND ImageType='spectrogram-small'", $connection);
                if (is_file("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile)) {
                    unlink("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile);
                }
                $ImageFile = query_one("SELECT ImageFile FROM SoundsImages WHERE SoundID='{$SoundID}' AND ImageType='waveform-small'", $connection);
                if (is_file("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile)) {
                    unlink("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile);
                }
                $ImageFile = query_one("SELECT ImageFile FROM SoundsImages WHERE SoundID='{$SoundID}' AND ImageType='spectrogram-large'", $connection);
                if (is_file("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile)) {
                    unlink("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile);
                }
                $ImageFile = query_one("SELECT ImageFile FROM SoundsImages WHERE SoundID='{$SoundID}' AND ImageType='waveform-large'", $connection);
                if (is_file("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile)) {
                    unlink("sounds/images/{$ColID}" . "/" . $DirID . "/" . $ImageFile);
                }
                $query_file = "DELETE FROM SoundsImages WHERE SoundID='{$SoundID}'";
                $result_file = mysqli_query($connection, $query_file) or die(mysqli_error($connection));
            }
            #Check if there are mp3
            if (is_file("{$absolute_dir}/sounds/previewsounds/{$ColID}/{$DirID}/{$AudioPreviewFilename}")) {
                unlink("{$absolute_dir}/sounds/previewsounds/{$ColID}/{$DirID}/{$AudioPreviewFilename}");
            }
        }
    }
}
header("Location: {$where_to}&md={$howmany}");
die;
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:del_multiple_files2.php

示例14: mysqli_fetch_array

    if ($nrows > 0) {
        for ($i = 0; $i < $nrows; $i++) {
            $row = mysqli_fetch_array($result);
            extract($row);
            query_one("ALTER TABLE {$TABLE_NAME} ENGINE = MyISAM", $connection);
        }
    }
    #Change collation
    $query = "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '{$database}' AND TABLE_COLLATION != 'utf8_unicode_ci'";
    $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
    $nrows = mysqli_num_rows($result);
    if ($nrows > 0) {
        for ($i = 0; $i < $nrows; $i++) {
            $row = mysqli_fetch_array($result);
            extract($row);
            query_one("ALTER TABLE {$TABLE_NAME} DEFAULT CHARSET=utf8 COLLATE='utf8_unicode_ci'", $connection);
        }
    }
    #Change OtherSoundID to null
    $query = "UPDATE Sounds SET OtherSoundID = NULL WHERE OtherSoundID = '0'";
    $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
    #Optimize tables
    $query_opt = "OPTIMIZE TABLE CheckAuxfiles, Collections, Cookies, Kml, ProcessLog, PumilioLog, PumilioSettings, QualityFlags, Queue, QueueJobs, SampleMembers, Samples, Scripts, Sensors, Sites, SitesPhotos, Sounds, SoundsImages, SoundsMarks, Tags, Tokens, Users, WeatherData, WeatherSites";
    $result_opt = mysqli_query($connection, $query_opt) or die(mysqli_error($connection));
    echo "<h4><div class=\"alert alert-success\"><span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span> Database fields were updated</div></h4>\n\t<br><br><br>\n\t<p><a href=\"#\" onClick=\"window.close();\">Close window</a>\n";
} else {
    echo "<meta http-equiv=\"refresh\" content=\"1;url=checkdb.php?run=TRUE\">\n\n\t</head>\n\t<body>\n\n\t<div style=\"padding: 10px;\">\n\n\t\t<br><br><br>\n\t\t<h3>Working... \n\t\t<br>Please wait... <i class=\"fa fa-cog fa-spin\"></i>\n\t\t</h3>\n\n\t\t<br><br><br>\n\t<br><p><a href=\"#\" onClick=\"window.close();\">Cancel and close window</a>";
}
?>

</div>
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:checkdb.php

示例15: query_one

            $allowuse = TRUE;
        } else {
            $allowuse = FALSE;
        }
    } else {
        if (sessionAuthenticate($connection)) {
            $allowuse = TRUE;
        }
    }
}
if ($allowuse == FALSE) {
    echo "<p>You have to be logged in to use this tool.";
    die;
}
$username = $_COOKIE["username"];
$UserID = query_one("SELECT UserID FROM Users WHERE UserName='{$username}' LIMIT 1", $connection);
#Sanitize inputs:
$t_min = filter_var($_POST["t_min"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$t_max = filter_var($_POST["t_max"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$f_min = filter_var($_POST["f_min"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$f_max = filter_var($_POST["f_max"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$SoundID = filter_var($_POST["SoundID"], FILTER_SANITIZE_NUMBER_INT);
$from_db = filter_var($_POST["from_db"], FILTER_SANITIZE_STRING_INT);
#Escape to prevent SQL injection
$mark_tag = mysqli_real_escape_string($connection, $_POST["mark_tag"]);
if (isset($_COOKIE["fft"])) {
    $fft_size = $_COOKIE["fft"];
} else {
    $fft_size = 2048;
}
#Build query
开发者ID:nperezg,项目名称:pumilio,代码行数:31,代码来源:add_mark2.php


注:本文中的query_one函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。