I'v been messing around with scripts from online for days, trying to get them to work on my windows hosted webspace but they dont. A friend put them on his webspace (linux i think) and they worked.
This is a script from online, this is the index page, its for a news thing.
<?php
$display = 10;
if ( $handle = opendir("news/") )
{
while ( ( $file = readdir( $handle ) ) !== false )
{
if ( $file != "." && $file != ".." )
{
$news_array[] = $file;
}
}
closedir( $handle );
}
array_multisort( $news_array, SORT_NUMERIC, SORT_DESC );
array_splice( $news_array, $display );
$num_news = ( count( $news_array ) );
foreach ( $news_array as $val )
{
$news_file = file("news/$val");
$title = $news_file[1];
$date = $news_file[0];
$text = $news_file[2];
echo '<center><table width="98%"><tr><td align="left" class="news"><p align="left"><font size="3">'.$title.'</font><font size="2"><i>'.$date.'</i>';
echo '</font></td></tr>';
echo '<table width="98%"><tr><td align="left" class="news"><p><font size="2">'.$text.'</font></td></tr></table>';
echo '<br>';
echo '<p>Powered by <a href="http://timurkz.buildtolearn.net">KZ Server</a><br>';
}
?>
<!--And the button for admin page-->
<a href="admin.php" class="mirror"><font size="1">Admin</font></a>
When I run it, i get this:
Warning: opendir(news/) [function.opendir.php]: failed to open dir: Invalid argument in <------------my webspace--------------------> on line 61
Warning: array_multisort() [function.array-multisort.php]: Argument #1 is expected to be an array or a sort flag in <------------my webspace--------------------> on line 73
Warning: array_splice() [function.array-splice.php]: The first argument should be an array in <------------my webspace--------------------> on line 74
Warning: Invalid argument supplied for foreach() in <------------my webspace--------------------> on line 78
Admin
Any ideas?