/    Sign up×
Community /Pin to ProfileBookmark

hi! this is the structure of the site

[url]www.mysite.com/tutorial/[/url] and in the tutorial folder, many php as well as html files exist

the problem is when you type [url]www.mysite.com/tutorial/[/url] in the url box and enter all the lists of files in my folder are exposed.

how can I hide them? or what can I do to show a certain page when you type and enter [url]www.mysite.com/tutorial/[/url] ?

thanks in advanced!

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Jan 23.2007 — Simply add either index.php or index.html (or whichever is the default page for your server). Include code to redirect the visitors to where you want them to go or display a message saying "No,no...".

You can also prevent a directory listing by using .htaccess but the above is by far the simplest.
Copy linkTweet thisAlerts:
@MichaelttkkauthorJan 23.2007 — I'd like something like this link http://www.dmcinsights.com/phorum/ it isn't my site
Copy linkTweet thisAlerts:
@MichaelttkkauthorJan 23.2007 — http://positive0.negative0.net/articles/ someone could try to view the files let's say I have a personal file in that folder and I only want http://positive0.negative0.net/articles/ to appear and not the other

please check
Copy linkTweet thisAlerts:
@NightShift58Jan 23.2007 — Well, these two examples are a little bit different than hiding the exposed files. You actually want to not only expose them but publish the contents of the directory.

At a minimum, you'll need a database table where you can store all the additional information concerning the files in your tutorial directory.

Your table will need a few fields to describe each tutorial, such as file name, title, synopsis/description, perhaps tutorial date and author.
Copy linkTweet thisAlerts:
@MichaelttkkauthorJan 23.2007 — could you give a scatch of it?

let's say, I have already put the titles in the title field of tutorial tablename and description or contents in the description field of tutorial tablename

to retrieve
[code=php]
$query = "select * from tutorial where title='$title', contents='$contents';
$result = MySql_query($query);
while ($data = MySql_fetch_array ($result)){
echo $data[title] - $data[contents];
}...
[/code]


I'm still new in php so I was just coding it as fast as I could, I may need to check the syntaxes.

If I use it with database then I don't think I would have any problem with not exposing a certain file from my folder.

at this instance, I'm not gonna use Database but I'm gonna use folder to store the files.

Could you give abit more explanation on how I can have this kind of URL http://www.dmcinsights.com/phorum/ with a page Using folder (and files can't be seen if you type in http://www.dmcinsights.com/phorum/ or try to see the files of a folder
Copy linkTweet thisAlerts:
@NightShift58Jan 23.2007 — [code=php]<?php
// Do the database connection things

// To produce a listing of ll that's in your table, don't use WHERE....
$sql = "SELECT * FROM tutorial ";
$qry = mysql_query($sql) or die("SQL Error: $sql<br>" . mysql_error());

while ($data = mysql_fetch_array($qry)){
echo "<hr />";
echo <span style='font-weight:bold'>$data['title']</span> . "<br />";
echo $data[contents] . "<br /">
}
?>[/code]

If you put this page in your tutorials folder and called it "index.php" then your files will not be openly displayed and visitors will only see the listing made by the script.
Copy linkTweet thisAlerts:
@MichaelttkkauthorJan 23.2007 — thank you NightShift58! I learned something very useful. all the best!
Copy linkTweet thisAlerts:
@NightShift58Jan 23.2007 — You're welcome!
×

Success!

Help @Michaelttkk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...