background image

$folderpath

="../newslist/".

$foldername

;

if

(!

file_exists

(

$folderpath

))

{

mkdir

(

$folderpath

);

}

$filename

=

date

("H-i-s").".html";

$filepath

="$folderpath/$filename";

if

(!

file_exists

(

$filepath

))

{

$fp

=

fopen

(

$filepath

,"w");

fputs

(

$fp

,

$str

);

fclose(

$fp

);

}

$filepath

=

$foldername

."/".

$filename

;

$sql

="insert into newscontent (newstypeid,newstitle,newspath,newssource,newstime) values 

($typ,'$title','$filepath','$source','".

date

("Y-m-d H:i:s")."')";

mysql_query(

$sql

);

header("location:add.php");
}
?>