iGraphics Posted November 12, 2017 Share Posted November 12, 2017 Hello Everyone;Please Help me to make this:I want to make a page and inside this page input for text and submit button: (Like This Below): When someone write Text in the input for example runand when he click on Create should a new page open and Go to this Link:example.com/run/image.jpgand if someone write hello in the input and click on Create should a new page open and Go to this Link:example.com/hello/image.jpgPlease write this code for me Thanks. Link to comment Share on other sites More sharing options...
codeminer Posted November 20, 2017 Share Posted November 20, 2017 (edited) I think if im getting it your looking for something like this <a title="HOWDY, YOU CAN PUT WHATEVER YOU WANT HERE MAKE SURE TO CHANGE THE LINK TO THE PAGE YOU WANT IT TO WORK ON." href="HTTP://127.0.0.1/SOMEWHEREONTHEPLANET/"><code>HOWDY</code></a> OR YOU MIGHT WANT SOMETHING LIKE THIS YOU NEED TO CREATE MORE FILE TO MAKE IT WORK //put this in your index.php in any kind of tag that works <form action ="createFile.php" method ="POST"> <input type = "hidden" name ="MAX_FILE_SIZE" value ="10000000"/> <input type = "text" name = "name" placeholder ="Project name"> | <input type = "submit" value = "submit"><p> </form></center><br/> <?php $full_path = "."; $dir = @opendir($full_path) or die ("Unable to open directory"); while($file = readdir($dir)) { if($file == "." || $file == ".." || $file == "index.php" || $file == "create_file.php" || $file == "edit_file.php" || $file == "edit.php" || $file == "delete.php" || $file == "uploads") continue; #contents in here echo"<ul class ='menu'><li><a href ='$file'>$file</a><br/> <a href='edit.php?name=$file'>Edit</a> | <a href='delete.php?name=$file'>Delete</a> <br/></li></ul><!--closes new file menu-->"; #content ends here } closedir($dir); ?> ----------------------------------------------------------------- create file called createFile.php -------------------------------------------------------------- <?php $pre_file_name = $_POST['name']; $ext = ".html"; $file_name = $pre_file_name.$ext; fopen($file_name,'w'); ?> <html> <form action ="edit_file.php" enctype = "multipart/form-data" method ="POST"> <input type = "hidden" name ="MAX_FILE_SIZE" value ="10000000"/> <textarea name="edit" cols="70" rows ="20" placeholder="edit"> <?php # can include anthing in here('ar2.php');?> </textarea><p> <input type = "hidden" name = "file_name"value = "<?php echo $file_name; ?>"> <input type = "submit" value = "Save"> </form> <p> <h2>Files</h2> </html> -------------------------------------------------------------------- create file called edit_file.php ------------------------------------------------------------------------- <?php $edit = $_POST['edit']; $file_name = $_POST['file_name']; $file = fopen($file_name,'w'); fwrite($file,$edit); //fclose($file);?> <?php echo $_POST['edit'];?> <?php fclose($file); echo "<br/>"; echo "File saved! <a href = 'index.php'>Click Here To Continue</a> "; ;?> ------------------------------------------------------------------------- make file name edit.php --------------------------------------------------------------------- <?php $file_name = $_GET['name']; $file_read = fopen($file_name,"r"); $contents = fread($file_read,filesize($file_name)); fclose($file_read); ?> <form action ="edit_file.php"method ="post"> <input type = "hidden" name ="MAX_FILE_SIZE" value ="10000000"/> <textarea name="edit" cols="100" rows ="15" placeholder="edit"> <?php echo $contents;?> </textarea><p> <input type = "hidden" name = "file_name"value = "<?php echo $file_name; ?>"> <input type="submit" name="submit" size="20" value="save" placeholder="save"> <input type="reset" size="20" name ="reset"><br/> </a> <p> <h2>this is edit.php</h2> ---------------------------------------------------------------- make a file named delete.php ---------------------------------------------------------------------- <?php $file = $_GET['name']; unlink($file); header("location: index.php"); echo"<h3>File Deleted!</h3><a href='index.php'>Click Here To Continue</a>"; ?> there you go. you need to figure out how to make this secure im trying to learn that right now don't even think about using this as is on live site Edited November 20, 2017 by codeminer Link to comment Share on other sites More sharing options...
eleczo Posted November 23, 2017 Share Posted November 23, 2017 Hi, i think codeminer post helped you to overcome the issue facing by you. would like to suggest instead of developing website through manually by encrypting code, it is better to utilise web development sites like word press, magneto and many more.. Link to comment Share on other sites More sharing options...
Ingolme Posted November 24, 2017 Share Posted November 24, 2017 14 hours ago, eleczo said: Hi, i think codeminer post helped you to overcome the issue facing by you. would like to suggest instead of developing website through manually by encrypting code, it is better to utilise web development sites like word press, magneto and many more.. I disagree. From my experience, general-purpose content management systems often fail to meet requirements and often get in the way when trying to code a solution. Their main purpose is to provide a way to make website to those without coding skills. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now