Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6203413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:54:44+00:00 2026-05-24T04:54:44+00:00

how to create and write a file using url parameters for example: web.com/index.php?name=test.txt?input=halloworld file

  • 0

how to create and write a file using url parameters

for example:
web.com/index.php?name=test.txt?input=halloworld

file name should be test.txt and its content must be halloworld.

this is what i have so far

if(isset($_GET['name']))
{

    $File = $_GET['name']; 
    $Handle = fopen($File, 'w');
    $Data =  $_GET['input']; 
    fwrite($Handle, $Data);
    fclose($Handle); 
}

file output = test.txt?input=halloworld which is wrong

thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:54:46+00:00Added an answer on May 24, 2026 at 4:54 am

    Your error is in using ? instead of & in your url, it should be web.com/index.php?name=test.txt&input=halloworld

    That said you should never do things like this, because it’s extremely dangerous. In that way you’re exposing your server to any kind of attacks or defacing. An attacker could easily write a php file on your webserver and take control of it.

    Keep that in mind.

    Edit: I wrote it in question comment, but I rewrite it here, what if an attacker invoke your script with this parameters:

    web.com/index.php?name=evil.php&input=<?php exec('rm -rf /');
    

    and then request the url

    web.com/evil.php
    

    Your filesystem will be wiped out (if the user has privileges to do that). Other kind of attacks could be more subtle, one could inject a php shell in your server, and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create URL re-write rules for following URL in htaccess. http://example.com/vedios/category/fun/ ->
Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
I am trying to create a write only file in C on Linux (Ubuntu).
I have the following code which downloads video content: WebRequest wreq = (HttpWebRequest)WebRequest.Create(url); using
by using web services we are able to download file from cloud to buffer
I am trying to create a dynamic CSS file using the Django templating engine
I have managed to create the Excel file using HTMLTextwriter, but the returned file
I'm using the upload module to write the uploaded file to disk as soon
I have the following Rake file. Using RoR 2.3.8. desc Create shops sitemap task(:shops
I'm trying to write an RBGA pixel array to file using code found here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.