johntp Posted August 29, 2006 Share Posted August 29, 2006 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 ?? Quote Link to comment Share on other sites More sharing options...
Ifa Posted August 29, 2006 Share Posted August 29, 2006 mkdir($_POST["dirname"]); Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 29, 2006 Share Posted August 29, 2006 It sounds like a potential security nightmare to me. If you do it, you need to be extraordinarily careful about how you do it. Quote Link to comment Share on other sites More sharing options...
johntp Posted August 29, 2006 Author Share Posted August 29, 2006 where do i put the mkdir($_POST["dirname"]); ? Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 29, 2006 Share Posted August 29, 2006 in the script that processes the form inputs and AFTER you check the form inputs. BE CAREFUL Quote Link to comment Share on other sites More sharing options...
perezf Posted August 29, 2006 Share Posted August 29, 2006 i believe this will work<?php $makedirectory = $_POST['dirname'];mkdir($makedirectory);?>oh yea and if you didnt knowreplace dirname with the name you give to your textbox Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 30, 2006 Share Posted August 30, 2006 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.