Jump to content

Archived

This topic is now archived and is closed to further replies.

johntp

Never Heard submit form

Recommended Posts

Hey guys I was wondering if somwhere out there, there is a way to make a dubmit from make a folder on the website.

A little more detail is somone puts their name in a stardard html box, and when they hit submit it will make a folder with that name they put in the box on it.

I know this sounds really odd but can it be done ??

Share this post


Link to post
Share on other sites
mkdir($_POST["dirname"]);

Share this post


Link to post
Share on other sites
It sounds like a potential security nightmare to me.  If you do it, you need to be extraordinarily careful about how you do it.

Share this post


Link to post
Share on other sites
in the script that processes the form inputs and AFTER you check the form inputs.  BE CAREFUL

Share this post


Link to post
Share on other sites
i believe this will work

<?php
$makedirectory = $_POST['dirname'];

mkdir($makedirectory);

?>

oh yea and if you didnt know

replace dirname with the name you give to your textbox

Share this post


Link to post
Share on other sites
Here you go i had fun putting this together this will make a directory with the users id as the directory name ,



The user will enter there register email address and then a directory will be made with there id.


good luck.

tested

[code]

<?php session_start();

$id='00000';

$id=$_POST['id'];
$dir=$_POST['dir'];
$email=$_POST['email'];


$db=mysql_connect("localhost","xxxxx","xxxxx");

$result=mysql_select_db("xxxx",$db)or die("sorry mysql problams");

$query="select * from members where id='$id'";

$result=mysql_query($query);

while($record=mysql_fetch_assoc($result)){

$name=($_POST['name']);

$name=$record['name'];


if(mysql_num_rows($result)){

mkdir($id);



echo "<html>

<head></head>

<title>directory been made</title>


<body bgcolor='blue'>


<table  align='center' bordercolor='black' border='4'>


<td align='center'>

Thank you $name directory made

</td>


</table></html></body>";

}
}
?>

[/code]


test.php
[code]
<?php session_start();

$id=$_POST['id'];
$dir=$_POST['dir'];
$email=$_POST['email'];

$id='00000';

$dir=$id;

if(is_dir($dir)){

echo "<html>

<head></head>

<title>makeing a directory</title>


<body bgcolor='blue'>


<table  align='center' bordercolor='black' border='4'>


<td align='center'>

sorry but you already got a directory

</td>


</table>";


exit;

}


?>

<html>
<head></head>

<title>makeing a directory</title>

<body bgcolor='blue'>

<div align='center'><h1><?php echo $user; ?> activate your user directory please</h1></div>

<br>
<br>

<table  align='center' bordercolor='black' border='4'>

<td align='center'>

<br>

<b><font color='red' > Plase activate your directory</font></b>

<br>
<br>

<b><font color='red'>Please enter you email address as entered when you join our website</font><b>

<br>
<br>

<form method="POST" action="test_result.php">

<input type="text" name="email">

<br>
<br>
<br>

<input type="submit" name="submit" value="Make my new usable directory">

<br>
<br>
<br>

</form>

</td>

</table>

</html>

</body>

[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.