Help Me Create My First Php Script

Started on the old forum in December 2007 · view the original in the archive · old links redirect here

5 replies · 755 views · started 18 years ago · 1 min read

Guest #1

i want to create a simple picture gallery with wapbuddy script but the problem is that it echos all the other html n php files within that directory all i want it to do is echo only the links of image files.....to be more specific files with .gif,.jpg.jpeg.png and.wbmp extension

it ill be my first php script if you help me out so please help me!!!!!

here is the wapbuddy script

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<?
 extract($_REQUEST);
?>
<? include("../css.php"); ?>

<title>wallapapers section</title><body>
<?php
include("../wapbuddy_settings.php");
if (!isset($_GET['page'])) $page =$_GET['page'];
$total = 0;

if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array(); 
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php" and $file != "search.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
?>
</head>
<body bgcolor="#000000" text="#00FF00" link="#FFFFFF" vlink="#FF0000" alink="#FFFFFF">

<img src='[url]http://c.wen.ru/256908.wbmp?Nahsorhsed'[/url] alt='Создай сайт! Create site!'/>

<big>NAHSORHSEDA</big>

[url="upload.html"]upoad your pics[/url]

<?php include("../menu.php"); ?>

<?

echo "[size="1"]";

echo "[b][u]These downloads Are So Cool![/u][/b]
";

if ($file_count > 0)
{
$first_record = $page * $conf["items_per_page"];
$last_record = $first_record + $conf["items_per_page"];

while (list($fileIndexValue, $file_name) = each ($file_array))
{

if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
{

echo "<a href=\"$file_name\">$file_name</a> (". round(filesize($file_name)/1024,1) . "kb)
------
";
$total = $total + filesize($file_name);
}
}

if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "
<a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev Page</a>
";
}

if (($file_count > 0) AND ($last_record < $file_count))
{
// next button
$next_page = $page + 1;
echo "
<a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next Page</a>
";
}
echo "
Total Files:
$file_count ";
if ($file_count == 1)
{echo "file";}
else
{echo "files";}

echo " (" . round($total/1024,1) . "kb)";
}
closedir($dp);
echo "[/size]";
?>

<?
echo '<form action="process.php" method="post">'
          .'search file: <input name="q" title="search:" size="5" maxlength="99999999999"/>
'
          .'<input type="submit" value="go"/></form>' ?>

[size="1"]page:<? echo"$page"; ?>[/size]

<?
echo '<form action="'.$_SERVER["PHP_SELF"].'" method="get">'
          .'Jump to Page: <input name="page" title="Jump to Page:" size="3" maxlength="3"/>
'
          .'<input type="submit" value="Jump"/></form>' ?>

[size="1"][url="http://nahsorhseda.wen9.com/Rock2.html"]home[/url][/size]
</p>
</body>
</html>
Guest #2

why doesnt any one help me out

subzero Super moderator Fellow · 3,954 posts #3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<?
extract($_REQUEST);
?>
<? include("../css.php"); ?>

<title>wallapapers section</title><body>
<?php
include("../wapbuddy_settings.php");
if (!isset($_GET['page'])) $page =$_GET['page'];
$total = 0;

if(!($dp = opendir("images/"))) die ("Cannot open ./");
$file_array = array(); 
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php" and $file != "search.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
?>
</head>
<body bgcolor="#000000" text="#00FF00" link="#FFFFFF" vlink="#FF0000" alink="#FFFFFF">

<img src='[url]http://c.wen.ru/256908.wbmp?Nahsorhsed'[/url] alt='Создай сайт! Create site!'/>

<big>NAHSORHSEDA</big>

[url="upload.html"]upoad your pics[/url]

<?php include("../menu.php"); ?>

<?

echo "[size="1"]";

echo "[b][u]These downloads Are So Cool![/u][/b]
";

if ($file_count > 0)
{
$first_record = $page * $conf["items_per_page"];
$last_record = $first_record + $conf["items_per_page"];

while (list($fileIndexValue, $file_name) = each ($file_array))
{

if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
{

echo "<a href=\"$file_name\">$file_name</a> (". round(filesize($file_name)/1024,1) . "kb)
------
";
$total = $total + filesize($file_name);
}
}

if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "
<a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev Page</a>
";
}

if (($file_count > 0) AND ($last_record < $file_count))
{
// next button
$next_page = $page + 1;
echo "
<a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next Page</a>
";
}
echo "
Total Files:
$file_count ";
if ($file_count == 1)
{echo "file";}
else
{echo "files";}

echo " (" . round($total/1024,1) . "kb)";
}
closedir($dp);
echo "[/size]";
?>

<?
echo '<form action="process.php" method="post">'
          .'search file: <input name="q" title="search:" size="5" maxlength="99999999999"/>
'
          .'<input type="submit" value="go"/></form>' ?>

[size="1"]page:<? echo"$page"; ?>[/size]

<?
echo '<form action="'.$_SERVER["PHP_SELF"].'" method="get">'
          .'Jump to Page: <input name="page" title="Jump to Page:" size="3" maxlength="3"/>
'
          .'<input type="submit" value="Jump"/></form>' ?>

[size="1"][url="http://nahsorhseda.wen9.com/Rock2.html"]home[/url][/size]
</p>
</body>
</html>

make images folder upload there lol

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

Guest #4

i knew i could make a new folder but ill be adding many sripts like delete and upload in the same folder and other login essentials the problem of making another folder is when the link is echoed for example i have a file "cccccccar ttt.jpg" when it is in the sme folder it gives me the correct download link but if i make a subdirectory
itill echo the link something like src="cccccccc" and the rest is removed even the extention

do you have a way in which i can i exclude all php files in the directory and echo all other files

and tell me something about the code below

if(substr($file,0,1) != '.' and $file != "index.php" and $file != "search.php")
subzero Super moderator Fellow · 3,954 posts #5

you wont a format script??

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

Guest #6

you wont a format script??

i really dont know what you mean by that i think your try to say delete script ....i got thaat please tell me how to exclude all php files from echoing in the wapbuddy script

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close