The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > PHP


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 07-08-2007, 03:10 PM
Blood08's Avatar
Blood08 Blood08 is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial 
Total Awards: 2
Join Date: Jun 2007
Location: Source Code
Posts: 98
iTrader: (0)
Blood08 is on a distinguished road
[Tutorials] Create a Directory

This is a easy way to create a directory which can be edited and put into upload scripts ect anyway
PHP Code:
<?php
if($_POST[submit]){ // Sees if the form has been submitted
$form $_POST['directory']; // Gets the field from the form
$directory $_SERVER['DOCUMENT_ROOT'] . "/" $form// Asks where the directory is going to be created
if (!is_dir($directory))  // Checks if the directory is already created

mkdir($directory0777); // Creates the directory and chmods it to 777

}
?> 
<form method="POST">
    <p><input type="text" name="directory" size="20" value="Directory Name"><input type="submit" value="Submit" name="submit"></p>
</form>
This has been tested and does work but if you are having problems with it saying something like
Quote:
Warning: mkdir(/home/****/public_html/Test) [function.mkdir]: Permission denied in /home/****/public_html/create.php on line 7
Then just go back to public_html and then change the permissions to 777 then it should work if its still not working please email me or pm me.

Thanks to Peterk92

__________________
Fersk Webmasters' Forum
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 07-08-2007, 05:09 PM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
If you CHMOD a folder or even a file to 777 you must always make sure your script is fully secure, if it isn't someone could hack it by the means of something like a shell, these shells allow people to browse all the files on the server, they can get your config files if you have any and take all the user information in a database and also deface your website, so always be careful!

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #3 (permalink)  
Old 07-09-2007, 07:36 AM
ScottHughes ScottHughes is offline
Novice
Join Date: Jul 2007
Posts: 9
iTrader: (0)
ScottHughes is on a distinguished road
Quote:
Originally Posted by Lee View Post
If you CHMOD a folder or even a file to 777 you must always make sure your script is fully secure, if it isn't someone could hack it by the means of something like a shell, these shells allow people to browse all the files on the server, they can get your config files if you have any and take all the user information in a database and also deface your website, so always be careful!
I understand that 777 gives full rights to everyone, but how does it let people hack into your system? How can we make sure the file or folder is secure?

__________________
Check out the Hunger & Poverty Forums and the Costa Rica Forums!
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #4 (permalink)  
Old 07-09-2007, 07:38 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,111
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
I understand that 777 gives full rights to everyone, but how does it let people hack into your system? How can we make sure the file or folder is secure?
The way they will do is that they may connect to your webserver through the openings port probably *I never done it* (this is just my assumption) and then they use whatever editor on their shell program to open the file that you chmod 777. Because when you chmod a file to 777, that means the rights to the user is even be able to write, read, and execute.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #5 (permalink)  
Old 07-09-2007, 08:37 AM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
Quote:
Originally Posted by ScottHughes View Post
I understand that 777 gives full rights to everyone, but how does it let people hack into your system? How can we make sure the file or folder is secure?
You need to make sure you filter your inputs, if a username is put in a text box unless you filter/validate it, it may contain a command which could get all the information from your database, have a look around google for security on protecting against SQL injections, Shell attacks etc.

As far as the shell goes, there has to be a way to upload, like on one version of phpBB, i think it was 2.0.10 and below (thats a think) you could upload a shell as a .gif file and when the hacker loads the shell it would load as it should allowing them to browse you files and get to your databases and steal/destroy a lot of things.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 01:21 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50