2012-07-07 3 views
1

에서 검색하여이 나를 위해 조금 복잡하다 :디스플레이 HTML 파일 서버

file:///D:/xampp/htdocs/bibek/address/WRTRThu-05-Jul-2012-14-02-14pm.html
file:///D:/xampp/htdocs/bibek/address/WRTRThu-05-Jul-2012-13-02-23pm.html
file:///D:/xampp/htdocs/bibek/address/BRTRThu-05-Jul-2012-13-05-35pm.html
file:///D:/xampp/htdocs/bibek/address/BRTRThu-05-Jul-2012-12-06-52pm.html

: 내 서버 예를 들어 1200 개 파일이 말한다

각각은 이름이 있습니다 : WRTR 및 BRTR과 날짜 날짜가 있습니다. 나는 php mysql javascript (최후의 최후의 수단)로 스크립트를 작성하여 사용자가 날짜와 요일 (wrtr 또는 brtr)을 입력 할 수있게하고 해당 파일을 볼 수있게된다. 누구든지 진행 방법을 제안 할 수 있습니까?

는 sugesstion에와 maxhud의 도움으로 따라, 나는이 당신에게 떨어져 모자 ...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<script type="text/javascript"> 
    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"; 
    } 
</script> 
</head> 
<body> 

    Name: <input id="name" placeholder="accountname"/><br/> 

    Date: <input id="dday" placeholder="01-31"/> - <input id="month" placeholder="month"/> - <input id="year" placeholder="year"/><br/><br/> 


    Time: <input id="hour" placeholder="24hours"/> - <input id="minute" placeholder="minute"> - <input id="second" placeholder="second"/> 
    of Day <input id="ofday" placeholder="am/pm"/> 
    <br/><br/> 
    Day: <input id="day"/> 
    <br/><br/> 

    <button onclick="showFile()">Take me to the file</button> 
</body> 
</html> 

와 PHP 스크립트 가지고 : fileLocator2.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 

    <title>Ethernet database check</title> 
<style type="text/css"> 
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; 
} 

</style> 
</head> 
<body> 
     <header style="height:4em;font-size:2em;"> Employee Access Only</header> 
     <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;"> 
       <form method="POST" action="confirm.php"> 

      <div id="textleft">Path or folder:<br></div> 
      <div id="textright"> <input id="path" name="path" placeholder="address no/"/>[?]</div><br/> 

      <div id="textleft">Name of file:<br/></div> 
      <div id="textright"> <input id="name" name="name" placeholder="filename"/><a href="#" title="WRTR &#13;BRTR">[?]</a></div><br/> 

      <div id="textleft">Day:<br/></div> 
      <div id="textright"> <input id="day" name="day"/><a href="#" title="Mon Tue Wed Thu Fri Sat">[?]</a></div> 
      <br/> 
      <div id="textleft">Date:</div> 
      <div id="textright"><input id="ddate" placeholder="01-31" name="ddate"/> - <input id="month" placeholder="month" name="month"/> - <input id="year" placeholder="2001-2011" name="year"/><a href="#" title="date:01-02-03..31 &#13;month:Jan,Feb,Mar,Apr,May,Jun,Jul,Aug&#13; year:2001...2011">[?]</a></div><br/> 
      <div id="textleft">Time:<br/></div> 
      <div id="textright"><input id="time" name="time"/><a href="#" title="hours-mins-seconds &#13; 13-20-23">[?]</a></div></br> 

     <input type="submit" class="yellobutton" id="submit" name="submit" value="show me"/> 
    </form> 
    </div> 
    <footer style="font-size:1.4em ;margin-top:20%;">&copy;Bibek Agarwal Scripts</footer> 

</body> 
</html> 

및 확인 에 .php

<?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.'<br/>'; 
    echo 'filename '.$filename. '<br/>'; 
    echo 'day' . $day.'<br/>'; 
    echo 'time ' .$time. '<br/>';*/ 
    if((!empty($pathfolder)) && (!empty($filename)) && (!empty($day)) && (!empty($ddate)) && (!empty($dmonth)) && (!empty($dyear)) && (!empty($time))) 
     { 
      list($hour,$minute,$second)=explode("-",$time); 


      echo 'hours '.$hour.'<br/>'; 
      echo 'minutes '.$minute.'<br/>'; 
      echo 'seconds '.$second.'<br/>'; 
      if(($hour>=12) && ($hour<=59)) 

       $flag="pm"; 

      if(($hour>=00) && ($hour<=11)) 
        $flag="am"; 

         $filesever=$pathfolder."/".$filename.$day."-".$ddate."-".$dmonth."-".$dyear."-".$hour."-".$minute."-".$second.$flag.".html"; 
         header("Location:$filesever") ; 
     } 
     else 'Empty Inputs'; 

} 

?>  
+1

뭐 당신은 들여다 보았습니까/시도 했습니까? 그리고 PHP가 시스템 하드 드라이브 ('file : ///')에서이 파일들을 호출하기를 원합니까? – Utkanos

+0

예. 그들은 나에게 프로젝트와 HTML PHP를 사용하여 그것을 할 the saif 준. 아니 그들은 서버에서 말한 하드 ​​드라이브에서 말하지 않았다. – argentum47

답변

1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<script type="text/javascript"> 
    function showFile(){ 
     var name = document.getElementById("name").value; 
     var time = document.getElementById("time").value; 
     var dayom = document.getElementById("dayom").value; 
     var month = document.getElementById("month").value; 
     var year = document.getElementById("year").value; 
     var day = document.getElementById("day").value; 

     window.location = "address/" + name + day + "-" + dayom + "-" + month + "-" + year + "-" time + ".html"; 
    } 
</script> 
<style> 
    input{ 
     display:block; 
    } 
</style> 
</head> 
<body> 
    Name: <input id="name"/> 
    Time: <input id="time"/> 
    Day of the Month <input id="dayom"/> 
    Month: <input id="month"/> 
    Year: <input id="year"/> 
    Day: <input id="day"/> 
    <button onclick="showFile()">Take me to the file</button> 
</body> 
</html> 
+1

그리고 나서 어떻게됩니까? – argentum47

+0

사용자가 html 파일 – maxhud

+0

@ RobW로 리다이렉트 될 것입니다 ... ... 그는 현재 그가 사용하지 않는 한 PHP를 사용할 수 없도록 그 순간에 localhost 또는 그런 것을 사용하지 않습니다. – maxhud