<?php set_time_limit(12); include "connect.inc"; if (!($link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))) { printf("[001] Connect failed, [%d] %s\n", mysql_errno(), mysqlerror()); } if (!($res = mysql_query("SELECT SLEEP(6)", $link))) { printf("[002] [%d] %s\n", mysql_errno($link), mysql_error($link)); } var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); mysql_close($link); print "done!";
<?php //MYSQL QUERY $con = mysql_connect("mysql.squashysquash.com", "antaressql", "password"); if (!$con) { die('Could not connect: ' . mysqlerror()); } mysql_select_db("catseverywhere", $con); $result = mysql_query("SELECT path FROM photo"); while ($info = mysql_fetch_array($result)) { $content[] = $info; } $count = count($content); $result = array(); for ($i = 0; $i < $count; $i++) { $result[] = $content[$i]['path']; } echo json_encode($result); //while ($row = mysql_fetch_array($result)) { // echo $row["path"]; //} mysql_close($con);
<? //register a globals variable for security $GLOBALS['vlDC']=true; include "conf.php"; //just so we know it is broken //error_reporting(E_ALL); set_time_limit(360); //get the image from the db $sql = "SELECT file,type,mimeType,name,size FROM vl_filenames WHERE id=$wR"; //the result of the query $result = mysqlquery("$sql") or die("incorrect query: " . mysqlerror()); //log file downloaded $p=0; $p="download"; $a=0; $a=mysqlresult($result,0,'name'); //logHit(); //set the header for the file if(getFileTypeFromExtension(mysqlresult($result,0,'type'))=="img") { //images header("Content-type: ".(mysqlresult($result,0,'mimeType')?mysqlresult($result,0,'mimeType'):getMIME(mysqlresult($result,0,'name')))); } else { //other binary data header("Content-length: ".mysqlresult($result,0,'size')); header("Content-type: ".(mysqlresult($result,0,'mimeType')?mysqlresult($result,0,'mimeType'):getMIME(mysqlresult($result,0,'name')))); header("Content-Disposition: attachment; filename=".mysqlresult($result,0,'name'));
/** * function to match data * @param: $table * @param: $option * @param: $info */ function matchData($table,$comparefields,$returnfield,$searchterm,$options) { if($searchterm) { $ha=array(); $ha=explode(",",$comparefields); //iterations foreach($ha as $h) { //trim $h=trim($h); //query $query=0; $query=mysqlquery("select $returnfield,match($h) against('$searchterm' in boolean mode) as score from $table where $options and (match($h) against('$searchterm' in boolean mode) or $h like '%$searchterm%') order by score desc limit 1"); if(!mysqlerror()) { if(mysqlnumrows($query)) { return mysqlresult($query,0,$returnfield); } } } } }
'".($viralLoadTestingIndication=="vlTestingRepeatTesting"?1:0)."', '".($viralLoadTestingIndication=="vlTestingRepeatTesting"?$repeatVLTestLastVLDate:"")."', '".($viralLoadTestingIndication=="vlTestingRepeatTesting"?$repeatVLTestValue:"")."', '".($viralLoadTestingIndication=="vlTestingRepeatTesting"?$repeatVLTestSampleTypeID:"")."', '".($viralLoadTestingIndication=="vlTestingSuspectedTreatmentFailure"?1:0)."', '".($viralLoadTestingIndication=="vlTestingSuspectedTreatmentFailure"?$suspectedTreatmentFailureLastVLDate:"")."', '".($viralLoadTestingIndication=="vlTestingSuspectedTreatmentFailure"?$suspectedTreatmentFailureValue:"")."', '".($viralLoadTestingIndication=="vlTestingSuspectedTreatmentFailure"?$suspectedTreatmentFailureSampleTypeID:"")."', '$lrCategory','$lrEnvelopeNumber','$lrNumericID', '$datetime','$trailSessionUser')"); if(mysqlerror()) die("3: ".mysqlerror()); //review logs and fix any duplicates fixDuplicateSampleIDs(); //redirect accordingly go("/samples/success/".vlEncrypt(getDetailedTableInfo2("vl_samples","createdby='$trailSessionUser' order by created desc limit 1","vlSampleID"))."/"); } else { $error.="<br /><strong>Duplicate Data Entry</strong><br /> Patient with ART Number <strong>$artNumber</strong> from <strong>".getDetailedTableInfo2("vl_facilities","id='$facilityID' limit 1","facility")."</strong> has already been entered with Form Number <strong>$formNumber</strong>.<br /> Kindly input this record with an alternative Form or ART Number.<br />"; } } } ?> <script Language="JavaScript" Type="text/javascript"> <!-- function validate(samples) {
logTableChange("vl_samples","treatmentStatusID",$sampleID,getDetailedTableInfo2("vl_samples","id='$sampleID'","treatmentStatusID"),$treatmentStatusID); //update mysqlquery("update vl_samples set districtID='$districtID', hubID='$hubID', facilityID='$facilityID', currentRegimenID='$currentRegimenID', collectionDate='$collectionDate', treatmentInitiationDate='$treatmentInitiationDate', sampleTypeID='$sampleTypeID', treatmentStatusID='$treatmentStatusID' where id='$sampleID'"); if(mysqlerror()) die("1: ".mysqlerror()); } } //update facilities and IPs for($i=2;$i<=$excelData->sheets[1]['numRows'];$i++) { //Facility $facilityID=0; $facilityID=logNewFacility(trim($excelData->sheets[1]['cells'][$i][1]),trim($excelData->sheets[1]['cells'][$i][2])); //District $districtID=0; $districtID=logNewDistrict(trim($excelData->sheets[1]['cells'][$i][2])); //Hub $hubID=0;
function budgeter($user) { $currencysymbol = currencysymbol($user); echo "<h3>Budget</h3>\n\t\t<h4>This Month - " . date("F") . "</h4>"; $part = date("j") / date("t"); $starttime = mktime(0, 0, 0, date('m'), 1, date('Y')); $query = "SELECT * FROM labels WHERE UserID='{$user}'"; $result = mysql_query($query) or die(mysqlerror('BU1')); while ($row = mysql_fetch_assoc($result)) { $budget = forcedecimals($part * $row['Budget']); $query = "SELECT * FROM payments WHERE LabelID='" . $row['LabelID'] . "' AND Timestamp>='{$starttime}' AND Timestamp<'" . time() . "'"; $result2 = mysql_query($query) or die(mysqlerror('BU2')); $spent = 0; while ($row2 = mysql_fetch_assoc($result2)) { $spent += $row2['PaymentAmount']; } $spent = forcedecimals(-$spent); echo "<span style='color:" . $row['Colour'] . "'>" . stripslashes($row['LabelName']) . "</span> Budget: " . $currencysymbol . $budget . " Spent: " . $currencysymbol . $spent . "<br>"; } if (date('n') == 1) { $month = 12; $year = date("Y") - 1; } else { $year = date("Y"); $month = date('n') - 1; } $time = mktime(0, 0, 0, $month, 1, $year); echo "<h4>Last Month - " . date("F", $time) . "</h4>"; $query = "SELECT * FROM labels WHERE UserID='{$user}'"; $result = mysql_query($query) or die(mysqlerror('BU3')); while ($row = mysql_fetch_assoc($result)) { $budget = forcedecimals($row['Budget']); $query = "SELECT * FROM payments WHERE LabelID='" . $row['LabelID'] . "' AND Timestamp>='{$time}' AND Timestamp<'{$starttime}'"; $result2 = mysql_query($query) or die(mysqlerror('BU4')); $spent = 0; while ($row2 = mysql_fetch_assoc($result2)) { $spent += $row2['PaymentAmount']; } $spent = forcedecimals(-$spent); echo "<span style='color:" . $row['Colour'] . "'>" . stripslashes($row['LabelName']) . "</span> Budget: " . $currencysymbol . $budget . " Spent: " . $currencysymbol . $spent . "<br>"; } }