كمك مي خوام! كد نوشتم كار نمي كنه!

qwertyuiop71944

New Member
الو سلام!
آقا من اين كد رو نوشتم كه وقتي توي يه فرم html اي كه دارم url و description وارد بشه اونارو توي يه folder توي خود سايت ذخيره مي كنه. حالا نمي دونم چيكار كنم؟ احتمالاpath ذخيره كردن رو اشتباه وارد مي كنم!
كمك كنين



handleform.php


<?
function WriteToFile ($url, $description) {
/* function writetofile takes two arguments--url and description--which will be written to an external file. */
$the file = "data.txt";
$open = fopen ($thefile, "a");
if ($open) {
fwrite ($open, "$url\ t$description\n");fclose ($open);
$worked = true;
} else {
$worked = false;
}
return $worked;
} // end of writetofile function.
?>
<html>
<head>
<title>using files</title>
<body>
<?php
/*this page receives and handles the data generated by "form.html". */
$pattern = "(http://)?([^[:space:]]+) ([[:alnum:]\.,-_?/&=])";
if (eregi($pattern, $array["url"])) {
$replace = "<a href=\"http://www.4thcongress.com\\2\\3\" target=\"_new\"> \\2\\3</a>";
$array["url"] = eregi_replace($pattern, $replace, $array["url"]);
$callfunction = writetofile ($array["url"], $array["description"];
if ($callfunction) {
print ("etelaa aat e shoma--
$array--successfully received!<br>\n"); ...HTML form contains GETING url and description
 

sama_sally

Member
منظورش اينه:
PHP:
handleform.php


<?
function WriteToFile ($url, $description) {
/* function writetofile takes two arguments--url and description--which will be written to an external file. */
$the file = "data.txt";
$open = fopen ($thefile, "a");
if ($open) {
fwrite ($open, "$url\ t$description\n");fclose ($open);
$worked = true;
} else {
$worked = false;
}
return $worked;
} // end of writetofile function.
?>
<html>
<head>
<title>using files</title>
<body>
<?php
/*this page receives and handles the data generated by "form.html". */
$pattern = "(http://)?([^[:space:]]+) ([[:alnum:]\.,-_?/&=])";
if (eregi($pattern, $array["url"])) {
$replace = "<a href=\"http://www.4thcongress.com\\2\\3\" target=\"_new\"> \\2\\3</a>";
$array["url"] = eregi_replace($pattern, $replace, $array["url"]);
$callfunction = writetofile ($array["url"], $array["description"];
if ($callfunction) {
print ("etelaa aat e shoma--
$array[url]--successfully received!<br>\n");
} else {
print ("ettelaa aate shoma ya az tarafe khodet ya taghsire system e tokhmiye ma be fuck raft!<br>\n");
}
} else {
print ("baba ye adrese dorosti behel!\n");
}
?>
</body>
</html>
 

sama_sally

Member
در ضمن
فايل وجود داره؟؟؟
اگه وجود نداره بسازش! ( چه راهنمايي جالبي ! )
 

جدیدترین ارسال ها

بالا