Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to do exect match on mysql_query?
    primarykey
    data
    text
    <p>How to do absolute MySQL query match. Since I seem getting collision if a user is trying to call a url or a file via short link domain.ltd/NGV which collides with domain.ltd/ngv forcing the fetch script to pull /NGV file not /ngv </p> <p>Here is the code which does the MySQL selections also the htaccess bit is provided</p> <pre><code> $tag = $_REQUEST['rid']; $q = mysql_query("SELECT * FROM `media` WHERE `qp_tag` = '".mysql_escape_string($tag)."' LIMIT 1"); $r = mysql_fetch_row($q); if(!empty($r)) { $f = stripslashes($r['file']); $t = stripslashes($r['type']); $c = file_get_contents($f); $api_html = &lt;&lt;&lt;API_HTML_VIEW $c API_HTML_VIEW; echo $api_html; } else { $api_html = &lt;&lt;&lt;API_HTML_VIEW We are sorry but we cannot find requested resource :( API_HTML_VIEW; echo $api_html; } </code></pre> <p>.htaccess code bit</p> <pre><code>RewriteRule ^([a-zA-Z0-9-]+)/?$ api.php?rid=$1 [L,QSA] </code></pre> <p>and here is the last bit of code to generate the actual short links which also may be the problem since i am not sure whats kicking the thing back at the present moment</p> <pre><code>function qp_tag() { $file_tag = $_FILES['file']['name']; $file_uni = uniqid(); $short = strtolower(substr(base64_encode(crc32($file_tag)), 0, 3)); return $short; } </code></pre> <p>Edited: The system works now the only problem is that it lags allot on selecting file if its a file </p> <pre><code> $f = $r['file']; $t = $r['type']; $s = $r['size']; $n = $r['name']; header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: ".$t.""); header("Content-Disposition:attachment;filename=".$n.""); header("Content-Length: ".$s); ob_clean(); flush(); $fp = fopen($f, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload