Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplay html files based on the filename by searching it from the server
    text
    copied!<p>this is little complicated for me: say my server has 1200 files for example:</p> <p><code>file:///D:/xampp/htdocs/bibek/address/WRTRThu-05-Jul-2012-14-02-14pm.html</code><br/> <code>file:///D:/xampp/htdocs/bibek/address/WRTRThu-05-Jul-2012-13-02-23pm.html</code><br/> <code>file:///D:/xampp/htdocs/bibek/address/BRTRThu-05-Jul-2012-13-05-35pm.html</code><br/> <code>file:///D:/xampp/htdocs/bibek/address/BRTRThu-05-Jul-2012-12-06-52pm.html</code> etc.</p> <p>as one can see each of them has a name: WRTR and BRTR and a day date and time. i have to write a script with php mysql javascript(only the last the last resort), to let a user to enter the date time day and the name (wrtr or brtr) and he will be able to view the corresponding files. can anyone suggest how to proceed?</p> <p>according to sugesstion and with the help of maxhud, i got this, hats off to you...</p> <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function showFile(){ var name = document.getElementById("name").value; var dday = document.getElementById("dday").value; var month = document.getElementById("month").value; var year = document.getElementById("year").value; var hour =document.getElementById("hour").value; var minute = document.getElementById("minute").value; var second = document.getElementById("second").value; var ofday = document.getElementById("ofday").value; var day = document.getElementById("day").value; var ofday=document.getElementById("ofday").value; window.location = "address/" + name + day + "-" + dday+ "-" + month + "-" + year + "-" +hour + "-" + minute + "-" + second + ofday + ".html"; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; Name: &lt;input id="name" placeholder="accountname"/&gt;&lt;br/&gt; Date: &lt;input id="dday" placeholder="01-31"/&gt; - &lt;input id="month" placeholder="month"/&gt; - &lt;input id="year" placeholder="year"/&gt;&lt;br/&gt;&lt;br/&gt; Time: &lt;input id="hour" placeholder="24hours"/&gt; - &lt;input id="minute" placeholder="minute"&gt; - &lt;input id="second" placeholder="second"/&gt; of Day &lt;input id="ofday" placeholder="am/pm"/&gt; &lt;br/&gt;&lt;br/&gt; Day: &lt;input id="day"/&gt; &lt;br/&gt;&lt;br/&gt; &lt;button onclick="showFile()"&gt;Take me to the file&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and the php script: fileLocator2.php</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Ethernet database check&lt;/title&gt; &lt;style type="text/css"&gt; body { width:90%; max-height:auto; min-height:600px; background-color:#000; color:white; font-size:17px; } br{ margin-bottom:1em; } #textleft { float:left; text-align:left; } #textright { float:right; margin-right:2em; } .inputcont{ float:left; width:20%; margin-left:0.1em; autofocus:autofocus; } a:link { text-decoration:none; color:white; } title { border-radius:5px; font-size:3em; background-color:blue; color:white; } .yellobutton { background-color:yellow; margin-top:1%; float:right; margin-right:2%; width:10em; height:2.4em; border:1px solid blue; border:inset 1px solid black; box-shadow:2px 2px 5px #fff; color:black; font-weight:bold; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;header style="height:4em;font-size:2em;"&gt; Employee Access Only&lt;/header&gt; &lt;div style="margin:2em;padding:1em 1em 4em 1em;height:auto;border:1px solid #000;border-radius:5px;-moz-box-shadow:0 0 5px 2px #ddb;box-shadow:0 0 5px 2px #ddd;"&gt; &lt;form method="POST" action="confirm.php"&gt; &lt;div id="textleft"&gt;Path or folder:&lt;br&gt;&lt;/div&gt; &lt;div id="textright"&gt; &lt;input id="path" name="path" placeholder="address no/"/&gt;[?]&lt;/div&gt;&lt;br/&gt; &lt;div id="textleft"&gt;Name of file:&lt;br/&gt;&lt;/div&gt; &lt;div id="textright"&gt; &lt;input id="name" name="name" placeholder="filename"/&gt;&lt;a href="#" title="WRTR &amp;#13;BRTR"&gt;[?]&lt;/a&gt;&lt;/div&gt;&lt;br/&gt; &lt;div id="textleft"&gt;Day:&lt;br/&gt;&lt;/div&gt; &lt;div id="textright"&gt; &lt;input id="day" name="day"/&gt;&lt;a href="#" title="Mon Tue Wed Thu Fri Sat"&gt;[?]&lt;/a&gt;&lt;/div&gt; &lt;br/&gt; &lt;div id="textleft"&gt;Date:&lt;/div&gt; &lt;div id="textright"&gt;&lt;input id="ddate" placeholder="01-31" name="ddate"/&gt; - &lt;input id="month" placeholder="month" name="month"/&gt; - &lt;input id="year" placeholder="2001-2011" name="year"/&gt;&lt;a href="#" title="date:01-02-03..31 &amp;#13;month:Jan,Feb,Mar,Apr,May,Jun,Jul,Aug&amp;#13; year:2001...2011"&gt;[?]&lt;/a&gt;&lt;/div&gt;&lt;br/&gt; &lt;div id="textleft"&gt;Time:&lt;br/&gt;&lt;/div&gt; &lt;div id="textright"&gt;&lt;input id="time" name="time"/&gt;&lt;a href="#" title="hours-mins-seconds &amp;#13; 13-20-23"&gt;[?]&lt;/a&gt;&lt;/div&gt;&lt;/br&gt; &lt;input type="submit" class="yellobutton" id="submit" name="submit" value="show me"/&gt; &lt;/form&gt; &lt;/div&gt; &lt;footer style="font-size:1.4em ;margin-top:20%;"&gt;&amp;copy;Bibek Agarwal Scripts&lt;/footer&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and confirm.php</p> <pre><code>&lt;?php if(isset($_POST['submit'])) { $pathfolder=trim($_POST['path']); $filename=trim($_POST['name']); $day=trim($_POST['day']); $ddate=trim($_POST['ddate']); $dmonth=trim($_POST['month']); $dyear=trim($_POST['year']); $time=trim($_POST['time']); /*echo 'path '.$pathfolder.'&lt;br/&gt;'; echo 'filename '.$filename. '&lt;br/&gt;'; echo 'day' . $day.'&lt;br/&gt;'; echo 'time ' .$time. '&lt;br/&gt;';*/ if((!empty($pathfolder)) &amp;&amp; (!empty($filename)) &amp;&amp; (!empty($day)) &amp;&amp; (!empty($ddate)) &amp;&amp; (!empty($dmonth)) &amp;&amp; (!empty($dyear)) &amp;&amp; (!empty($time))) { list($hour,$minute,$second)=explode("-",$time); echo 'hours '.$hour.'&lt;br/&gt;'; echo 'minutes '.$minute.'&lt;br/&gt;'; echo 'seconds '.$second.'&lt;br/&gt;'; if(($hour&gt;=12) &amp;&amp; ($hour&lt;=59)) $flag="pm"; if(($hour&gt;=00) &amp;&amp; ($hour&lt;=11)) $flag="am"; $filesever=$pathfolder."/".$filename.$day."-".$ddate."-".$dmonth."-".$dyear."-".$hour."-".$minute."-".$second.$flag.".html"; header("Location:$filesever") ; } else 'Empty Inputs'; } ?&gt; </code></pre>
 

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