PDA

View Full Version : Fwrite,Fopen,Fread...in admincp


kiril_cvetkov
03-31-2009, 08:34 PM
Can we use Fopen,Fwrite,Fread php functions in admincp programming
here is my code

if($_REQUEST['do'] == 'addplaylist')
{
print_form_header('admin_podcast_box', 'do_addplaylist');

print_table_header('Add podcast playlist song', 3);
print_input_row('Podcast Name', 'podcastname', '', 0, '50');
print_input_row('Podcast(url)','podcasturl','',0,5 0);

print_submit_row($vbphrase['add']);
}
//Do Add Category
if($_REQUEST['do'] == 'do_addplaylist')


{
$file = "music.xml";
$fh = fopen($file, 'a');
$string = "New text\n";
fwrite($fh, $string);
fclose($fh);
$vbulletin->input->clean_array_gpc('p', array(
'podcastname' => TYPE_STR,
'podcasturl' => TYPE_STR,
));



$db->query_write("
INSERT INTO " . TABLE_PREFIX . "podcastinfo
(
name
) VALUES (
'" . $db->escape_string($vbulletin->GPC['podcastname']) . "'
)");


define('CP_REDIRECT', "admin_podcast_box.php?do=deletepodcast");
print_stop_message('droplink_category_added', $vbulletin->GPC['deftitle']);

}I don't get nothing in the text file, nothing is writed, i am using app serv on windows xp (maybe there are no permissions for writing)

Any help or sugestions?

Dismounted
04-01-2009, 07:06 AM
Check the error logs, are there any errors from that script?

Why don't you just use file_put_contents()?

kiril_cvetkov
04-01-2009, 08:05 AM
:) Omg all is ok I just have checked bad directory