Advertisement
Advertisement
| 07.01.2008 at 01:32AM PDT, ID: 23529397 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: |
#html file
<html>
<head>
<script type="text/javascript" src="ajax.js"> </script>
<script type="text/javascript" src="dir.js"> </script>
</head>
<body>
<div id="main">
<form id="pfad">
<input type="text" name="pfad-eingabe" id="pfad-eingabe" >
/*Input for the Path we want to look up */
<input type="button" name="submit" value="List Dir" onClick="listdir();" \>
/*Submit Button calls the function which sends the Path to the Server */
</form>
<div id="result">
/*Results should be here */
</div>
</div>
</body>
</html>
#ajax.js
var anfrage = null;
try {
anfrage = new XMLHttpRequest();
} catch (versuchmicrosoft) {
try {
anfrage = new ActiveXObject("Msxml2.XMLHTTP");
} catch (anderesmicrosoft) {
try {
anfrage = new ActiveXObject("Microsoft.XMLHTTP");
} catch (fehlschlag) {
anfrage = null;
}
}
}
if (anfrage == null)
alert("Fehler beim Erzeugen des Anfrage-Objekts!");
/* This is just to create the Object for Sending/Receiving the Data */
#dir.js
function listdir() {
var pfad = document.getElementById("pfad-eingabe").value;
var url = "list.php";
/* the server-side script */
anfrage.open("POST", url, true);
/* send by Post */
anfrage.onreadystatechange = updateSeite;
/* call Update Function */
anfrage.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
anfrage.send("pfad-eingabe=" + escape(pfad));
}
function updateSeite() {
if (anfrage.readyState == 4) {
if (anfrage.status == 200) {
/* Antwort vom Server empfangen */
/* If we got correct response */
var dirlist = anfrage.responseXML;
/* read XML */
var dirlistText = anfrage.responseText;
/* for testing purposes, read the Text-Only Contents */
/* This is where I am stuck, what to do now? */
} else
alert("Fehler! Anfragestatus ist " + anfrage.status + " / " + anfrage.statusText);
}
}
#PHP File, XML Sample
//Pfad
$pfad = $_REQUEST['pfad-eingabe'];
if (!isset($_REQUEST['pfad-eingabe'])) {
header("pfad-eingabe nicht gesetzt", true, 400);
echo " ";
exit;
}
//opendir func
$dir_handle = @opendir($pfad) or die("Unable to open $pfad");
header("Content-Type: text/xml");
//send content header
echo '<?xml version=\"1.0\" encoding=\"utf-8\"?>';
echo "Directory Listing von ".$pfad;
echo "<listing>";
//running the while loop
$iter = "0";
while ($entry = readdir($dir_handle))
{
echo "<entry id=".$iter.">";
echo "$entry";
echo "</entry>";
$iter++;
}
echo "</listing>";
//closing the directory
closedir($dir_handle);
|