Auteur Topic: Hoe kan ik een php html script dat bij een index html hoort zien  (gelezen 529 keer)

Offline spidy601

  • Bedankjes
  • -Gegeven: 1
  • -Ontvangen: 0
  • Berichten: 8
DSM7.2.....

Ik heb een nieuwe nas en ik heb een stukje website dat gebruik maakt van een index html die verwijst weer door naar een index php file

Het is een website dat verzoekplaatjes door stuurt naar de radio

Nu kan ik met mijn url wel de index file te voorschijn halen door domijnnaamsynologyserver/test/request-index.html dit gaat goed

Maar als deze index webpagina dan door wil verwijzen naar domijnnaamsynology/test/song-request-resultaten.php

Dan krijg ik code 500 te zien.
Ik weet niet wat ik fout doe.
Of hoe ik dit instellen moet op de synology suport website wordt ik ook niet veel wijzer van veel te technisch.

Op mijn vorige ds 112j lade de song-request-resultaten.php wel maar kon ik de buttons niet gebruiken omdat de ds112j geen java scripts ondersteund

Ik heb nu maar de verzoekserver draaien op Windows desktop computer via xamp
Maar het zou mooi zijn als ik het op de synology webserver kan laten draaien

Maar hoe doe ik dat
  • Mijn Synology: Ds723+

Offline Wyodor

  • MVP
  • *
  • Bedankjes
  • -Gegeven: 1
  • -Ontvangen: 156
  • Berichten: 765
Re: Hoe kan ik een php html script dat bij een index html hoort zien
« Reactie #1 Gepost op: 30 mei 2024, 16:37:33 »
De domeinnamen zijn verschillend:

https://domijnnaamsynologyserver/test/request-index.html
en
https://domijnnaamsynology/test/song-request-resultaten.php

En Javascript wordt door de browser uitgevoerd. Niet door de server.

En error 500 is meestal een configuratiefout.

Wellicht is het tonen van echte code een goed idee.
  • Mijn Synology: DS720+
  • HDD's: 2 x ST4000VN008

Offline spidy601

  • Bedankjes
  • -Gegeven: 1
  • -Ontvangen: 0
  • Berichten: 8
Re: Hoe kan ik een php html script dat bij een index html hoort zien
« Reactie #2 Gepost op: 30 mei 2024, 17:38:15 »
ik probeer het script te plaatsen in dit forum maar het forum ziet het als spam
ik heb het bestand nu gedeelt vanaf mijn server.
php javascript geeft fout weet niet hoe dit komt  [mod edit: script staat in de volgende posting]

dit is het stukje website wat nu gehost wordt vanaf mijn computer via xamp
de werkende verzoek server als de computer aanstaat

dit is de website die ik heel simpel gemaakt heb waar ook de verzoek server op staat via iframe
de verzoek server in een iframe

mocht het toch iets wezen in de synology dan kan ik mijn teamvieuwer gegevesn van de synology server wel geven
  • Mijn Synology: Ds723+

Offline Briolet

  • Global Moderator
  • MVP
  • *
  • Bedankjes
  • -Gegeven: 179
  • -Ontvangen: 2654
  • Berichten: 16.478
Re: Hoe kan ik een php html script dat bij een index html hoort zien
« Reactie #3 Gepost op: 30 mei 2024, 18:22:22 »
Ik heb het bestand gedownload, maar ik krijg geen spammelding bij plaatsen.

<?php

$files 
glob("./request.*.txt");
$out fopen("request-playlist.txt""w");

foreach (
$files as $file) {
    
fwrite($outfile_get_contents($file));
}
fclose($out);

/*
MAKE SURE YOU HAVE THE FIRST PAGE OF HTML TOO.
THE FORM ON IT CALLS THIS 2ND PAGE.
WITHOUT IT THE DEMO WON&#39;T WORK!
*/

$search $_POST[&#39;search&#39;];
$search str_replace(&#39;|&#39;,&#39;&#39;,$search); //remove pipe delimiter as database uses it
$search str_replace(&#39;\"&#39;,&#39;"&#39;,$search); //fix difference between PHP4 and 5!
$search strip_tags($search); //remove HTML tags
//remove spaces before or after a word:
$search rtrim($search);
$search ltrim($search);

//remove multiple spaces:
while ((substr_count($search,&#39;  &#39;) >= 1)) {
//echo substr_count($search,&#39; &#39;);
//echo &#39;<pre>&#39;.$search.&#39;</pre>&#39;;
  
$search str_replace(&#39;  &#39;,&#39; &#39;,$search);
}

//remove multiple speech marks:
while ((substr_count($search,&#39;""&#39;) >= 1)) {
  
$search str_replace(&#39;""&#39;,&#39;"&#39;,$search);
}

//define globals so they can be returned by functions
$GLOBALS[&#39;highlight1&#39;] = &#39;&#39;;
$GLOBALS[&#39;highlight2&#39;] = &#39;&#39;;
$GLOBALS[&#39;result&#39;] = &#39;&#39;;


function debug($lineno) {
  echo &
#39;<em>PHP line no: &#39;.$lineno.&#39;</em>&#39;;
}


function 
test($variable,$lineno) {
  echo &
#39;

<p><em>PHP line no: &#39;.$lineno.&#39;</em> TEST VARIABLE = &#39;.$variable.&#39;</p>

&#39;;
}


function 
highlight($colloop,$thefield,$thesearch) {
  
$fieldlength strlen($thefield);
  
$searchlength strlen($thesearch);
  
$pos strpos($thefield$thesearch);
  
$stringend $searchlength $pos;
  
$slice1 substr($colloop0$pos);
  
$slice2 substr($colloop$pos$searchlength);
  
$slice3 substr($colloop$stringend);
  
$GLOBALS[&#39;result&#39;] = $slice1.$GLOBALS[&#39;highlight1&#39;].$slice2.$GLOBALS[&#39;highlight2&#39;].$slice3; //rebuild text with highlight
//  echo &#39;<br />&#39;.$GLOBALS[&#39;result&#39;];
}


$title = &#39;Hier zijn uw zoekresultaten!&#39;;
$title2 = &#39;Indien beschikbaar, gebruik dan de knop (Aanvragen) hieronder om uw nummer op ons station aan te vragen!&#39;;

echo <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<title>
$title</title>
<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Not Available";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</script>
 <script type="text/javascript" src="/js/common.js"></script>
        <!-- Javascript for request and songinfo actions -->
        <script type="text/javascript">
            /**
             * Open a popup window to send a song request to SAM
             */
            function request(songID)
            {
                var samhost = "94.211.174.100";
                var samport = "1221";
                requestAudioRealm(songID, samhost, samport);
            }
        </script>

<script>
function goBack() {
    window.history.back()
}
</script>

<style type="text/css">
html,body {color:#000; background-color:#eee}
body {padding-left:10px}
body, th, td, p, small {
font-family:&#39;Times New Roman&#39;,Times,serif;
font-size:100%;
color:#444
}

fieldset {border:1px solid #eee; padding:0}

pre {font-size:90%} /* for non-Firefox browsers */

table {
  background-color:#fff;
  border:1px solid #ccf;
padding:3px;
margin-top:10px;
margin-bottom:10px
}

table#database {margin-top:32px}

td, th {
background-color:#def;
padding:7px 20px 7px 20px
}
th {background-color:#dee; color:#677}
.top-th {background-color:#eee}

h1, h2 {font-size:140%; color:#558}
h2 {margin-top:32px; font-size:120%}
h1 .sortby {color:#855}

form {margin-top:16px}

legend {font-weight:bold; color:#666; padding:0}

.found {font-weight:bold; background-color:#ff9}

#found {color:#666}

.count {background-color:#dee; color:#677; font-weight:bold; color:#666}

em {color:#c00} /* for PHP debugging */
</style>

</head>

<body>

<h1>
$title</h1>
<h2>
$title2</h2>

HTML;


if ((
$search == &#39;&#39;) or ($search == &#39;"&#39;)) {exit(&#39;Geen bruikbare zoekreeks gevonden!<FORM METHOD="LINK" ACTION="request-index.html"><INPUT TYPE="submit" VALUE="Klik om opnieuw te zoeken"></FORM>&#39;);}


$fp fopen(&#39;request-playlist.txt&#39;,&#39;r&#39;);
if (!$fp) {exit(&#39;<p><b>ERROR: Unable to open database file!</b></p></body></html>&#39;);}

$row 0;

while (!
feof($fp)) {
$line fgets($fp,1024); //use 2048 if very long lines
  
$col[$row] = ($row 1).&#39;|&#39;.$line;
$row++;
}

fclose($fp);

// Avoid sort below if you have numbers at the start of each line!
//It puts all the lines beginning with 1 first, eg: 1, 10, 11, 12 etc.
//sort($col);
reset($col);

$arrays count($col) - 1;

$tablecells = &#39;&#39;;
$loop = -1;
$and $once $found $found1 $found2 $bothfound $search2also = &#39;no&#39;;
$count 0;
$speechmarks = &#39;&#39;;

//test for AND but not two words that must be together (""):
if ((strstr($search,&#39; AND &#39;)) and ($search[0] <> &#39;"&#39;)) {
  
$and = &#39;yes&#39;;
  
list ($word1$word2$word3) = explode (&#39; &#39;, $search); //remove AND
  
$word1 strtolower($word1);
  
$word3 strtolower($word3);
  if (
$word1 == $word3) {
    
$search $word1;
    
$and = &#39;no&#39;;
  
} else {
      
$search1 $word1;
      
$search2 $word3;
      while (
$loop $arrays) {
      
$loop++;
      
$field strtolower($col[$loop]);
      if ((
strstr($field,$search1)) and (strstr($field,$search2))) {
        
$found $found1 $found2 $bothfound = &#39;yes&#39;;
        //word1
        
highlight($col[$loop],$field,$search1);
        
$col[$loop] = $GLOBALS[&#39;result&#39;];
        //word2
        
$field strtolower($col[$loop]); //update field to include highlighted version from above
        
highlight($col[$loop],$field,$search2);
        
//add rows
        
$col[$loop] = explode(&#39;|&#39;,$GLOBALS[&#39;result&#39;]);
        
$tablecells.=&#39;
<tr>
<
td>&#39;.$col[$loop][1].&#39;</td>
<td>&#39;.$col[$loop][2].&#39;</td>
<td>&#39;.$col[$loop][3].&#39;</td>
<td>&#39;.$col[$loop][4].&#39;</td>
<td>&#39;.$col[$loop][5].&#39;</td>
<td>&#39;.$col[$loop][6].&#39;</td>
</tr>
&
#39;;
      
$count++;
      }
    }
  }
}


if ((
$and == &#39;no&#39;) and ($bothfound == &#39;no&#39;)) {

$search strtolower($search);

$search1 $search2 = &#39;&#39;;
if (strstr($search,&#39; &#39;)) {
  
list ($search1$search2) = explode (&#39; &#39;, $search);
  
if ($search2 == $search1) {//when both words are the same
    
$search $search1//make search just first word
    
$search1 $search2 = &#39;&#39;; //destroy both words from split
  
}
}

//test for space in search but not two words that must be together (""):
if ((strstr($search,&#39; &#39;)) and ($search[0] <> &#39;"&#39;)) {
  
list ($search1$search2) = explode (&#39; &#39;, $search);
  //search for two separate words
  
while ($loop $arrays) {
    
$loop++;
    
$search2also = &#39;no&#39;;
$field strtolower($col[$loop]);
 
$fieldkept $field//preserve text without web code
if (strstr($field,$search1)) {
      if (
strstr($field,$search2)) {$search2also $bothfound = &#39;yes&#39;;}
$found $found1 = &#39;yes&#39;;
      
highlight($col[$loop],$field,$search1);
      
$col[$loop] = $GLOBALS[&#39;result&#39;];
      
if ($search2also <> &#39;yes&#39;) { //only output once when both words on same row
        //add rows
        
$col[$loop] = explode(&#39;|&#39;,$GLOBALS[&#39;result&#39;]);
        
$tablecells.=&#39;
<tr>
<
td>&#39;.$col[$loop][1].&#39;</td>
<td>&#39;.$col[$loop][2].&#39;</td>
<td>&#39;.$col[$loop][3].&#39;</td>
<td>&#39;.$col[$loop][4].&#39;</td>
<td>&#39;.$col[$loop][5].&#39;</td>
<td>&#39;.$col[$loop][6].&#39;</td>
</tr>
&
#39;;
        
$count++;
      }
}
    
$field strtolower($col[$loop]); //update field to include highlighted version from above
    
if (strstr($fieldkept,$search2)) { //search on line without highlighting added
      
$found $found2 = &#39;yes&#39;;
      
highlight($col[$loop],$field,$search2);
      if ((
$search2also == &#39;yes&#39;) or ($found2 == &#39;yes&#39;)) {
        //add rows
        
$col[$loop] = explode(&#39;|&#39;,$GLOBALS[&#39;result&#39;]);
        
$tablecells.=&#39;
<tr>
<
td>&#39;.$col[$loop][1].&#39;</td>
<td>&#39;.$col[$loop][2].&#39;</td>
<td>&#39;.$col[$loop][3].&#39;</td>
<td>&#39;.$col[$loop][4].&#39;</td>
<td>&#39;.$col[$loop][5].&#39;</td>
<td>&#39;.$col[$loop][6].&#39;</td>
</tr>
&
#39;;
        
$count++;
      }
}
  }
} else {
  
//check if speech marks and remove them:
  
if ($search[0] == &#39;"&#39;) {
    
$search str_replace(&#39;"&#39;,&#39;&#39;,$search);
    
$speechmarks = &#39;\&#39;&#39;; //for output later
  
}
  if (
$search <> &#39;&#39;) {
    //do normal search
    
while ($loop $arrays) {
      
$loop++;
      
$field strtolower($col[$loop]);
      if (
strstr($field,$search)) {
        
$found $found1 = &#39;yes&#39;;
        
highlight($col[$loop],$field,$search);
        
//add rows
        
$col[$loop] = explode(&#39;|&#39;,$GLOBALS[&#39;result&#39;]);
        
$tablecells.=&#39;
<tr>
<
td>&#39;.$col[$loop][1].&#39;</td>
<td>&#39;.$col[$loop][2].&#39;</td>
<td>&#39;.$col[$loop][3].&#39;</td>
<td>&#39;.$col[$loop][4].&#39;</td>
<td>&#39;.$col[$loop][5].&#39;</td>
<td>&#39;.$col[$loop][6].&#39;</td>
</tr>
&
#39;;
      
$count++;
      }
    }
  } else {exit(&
#39;No usable search string found! <FORM METHOD="LINK" ACTION="request-index.html"><INPUT TYPE="submit" VALUE="Klik om opnieuw te zoeken"></FORM>&#39;);}
}

//if ($and == &#39;no&#39;)


if ($found == &#39;yes&#39;) {
  
echo &#39;<p>jouw zoek opdracht for <b>\&#39;&#39;.$speechmarks.$search.$speechmarks.&#39;\&#39;</b> werd gevonden in het volgende &#39;.$count.&#39; resultaten van onze mediabibliotheek voor radiostations:</p>

<table summary="List of database fields matching the search">
<tr><td colspan="7"><center><FORM METHOD="LINK" ACTION="request-index.html"><INPUT TYPE="submit" VALUE="Klik om opnieuw te zoeken">
</
FORM></center></td></tr>
<
tr>
<
th colspan="7" class="top-th">Zoekresultaten van de muziekbibliotheek van radiostations</th>
</
tr>

<
tr>
<
th>Cd-cover</th>
<
th>Artiest</th>
<
th>Nummer</th>
<
th>Album</th>
<
th>Verzoek</th>
<
th>Koop</th>
</
tr>
&
#39;.$tablecells.&#39;
<tr><td colspan="7"><center><FORM METHOD="LINK" ACTION="request-index.html"><INPUT TYPE="submit" VALUE="Klik om opnieuw te zoeken">
</
FORM></center></td></tr>
</
table>&#39;;
} else {
  echo &
#39;<p>Uw zoektopdracht naar <b>\&#39;&#39;.$speechmarks.$search.$speechmarks.&#39;\&#39;</b> was niet gevonden.</p><br><p><center><FORM METHOD="LINK" ACTION="request-index.html"><INPUT TYPE="submit" VALUE="Klik om opnieuw te zoeken"></FORM></center></p>&#39;;
}


echo &
#39;
<!-- Start of StatCounter Code for Default Guide -->
<
script type="text/javascript">
var 
sc_project=7937148
var 
sc_invisible=1
var 
sc_security="a5e51c3d"
</
script>
<
script type="text/javascript"
src="http://www.statcounter.com/counter/counter.js"></script>
<
noscript><div class="statcounter"><a title="web analytics"
href="http://statcounter.com/" target="_blank"><img
class="statcounter"
src="http://c.statcounter.com/7937148/0/a5e51c3d/1/"
alt="web analytics"></a></div></noscript>
<!-- 
End of StatCounter Code for Default Guide -->
</
body>
</
html>&#39;;
?>
  • Mijn Synology: DS415+
  • HDD's: 3x 3TB in SHR
  • Extra's: DS212J, RT1900ac

Offline jr212

  • MVP
  • *
  • Bedankjes
  • -Gegeven: 15
  • -Ontvangen: 36
  • Berichten: 368
Re: Hoe kan ik een php html script dat bij een index html hoort zien
« Reactie #4 Gepost op: 31 mei 2024, 07:23:07 »
Ik krijg al zeker 2 fouten
Warning: Undefined array key "search" in song-request-results.php on line 17
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in song-request-results.php on line 18

Het is trouwens een héééééél oud script. php 5 is al jaren dood.
Zoek eens iets recenter of schrijf zelf.
Hoewel voor nas vragen deze site 1 van de beste is, de beste in het NL, voor php vragen kan je misschien beter terecht op phphulp.nl
Verder zou je op zijn minst de log moeten aanstellen. Dan zie je dan wat het probleem is.

Ga naar webstation
kies voor scripttaalinstellingen
bewerk gebruikersprofiel (of een ander als je zelf iets anders heb gesteld als standaard)
kies tab core
zoek naar error_log
vul een correct en volledig pad naar een logbestand in. Bij mij is dit /volume7/web2/logs/ds2_error.log
zorg er voor dat deze log NIET onder web valt en dat http schrijfrechten heeft op deze share

kijk naar de inhoud van het bestand zodra je een foutmelding krijgt uit de 500 groep dus ook 501, 502,...
Begin altijd bovenaan omdat 1 lijn oplossen 10-tallen fouten kan oplossen. zie ook uw code. Als 17 ok is is 18 ook opgelost:)

terug naar uw code.
schrijven op dezelfde plaats als de via internettoegankelijke plaatsen. Dit moet buiten de root staan. Veiligheid!
Geen controle of er wel iets gepost is
het gebruik van globals ipv return

Jan
  • Mijn Synology: 2419+
  • HDD's: Zie handtekening
DS2419+ 22 TiB / 18 TiB / 3 X 14 TiB / 8 TiB 1 X SSD 0.5 TiB (90.5 TiB)
DS2415+ 2 X 8 TiB / 2 X 14 TiB / 16 TiB  / 22 TiB  (82 TiB)
DS415play 4 X 14 TiB (56 TiB)


 

Gebruiker geen NZBGet laten zien

Gestart door dennyBoard Synology DSM 5.1 en eerder

Reacties: 6
Gelezen: 2130
Laatste bericht 16 februari 2013, 23:16:48
door denny
File Station en Configuratiescherm->Gedeelde map zien geen gedeelde mappen

Gestart door MacFreakBoard Synology DSM algemeen

Reacties: 0
Gelezen: 869
Laatste bericht 29 december 2016, 11:58:22
door MacFreak
Mijn script voor verwijderen van 1 week oude bewakingsbeelden werkt niet goed

Gestart door dotternettaBoard Synology DSM algemeen

Reacties: 21
Gelezen: 2583
Laatste bericht 10 augustus 2021, 23:05:48
door dotternetta
VERPLAATST: Bestanden delen; hoe te zien wie het gedownload heeft?

Gestart door BirdyBoard Synology DSM 7.2

Reacties: 0
Gelezen: 176
Laatste bericht 05 juni 2024, 13:00:55
door Birdy
Spotweb laat geen spots zien

Gestart door cupiflowBoard Spotweb

Reacties: 8
Gelezen: 4656
Laatste bericht 27 april 2015, 11:36:16
door niekh