Jump to content

Write .txt With Given Input As .txt Name


Immortal1380

Recommended Posts

I hate to ask for help for my first, but I am currently having issues writing out a code for a program in progress. Basically, I am not great at php, but I need a code that will store information when sent to it from the program itself. I am setting it up to store login information, so the program writes out (lets say the username), when the person clicks the 'Next' button, it sends it to the .php and the .php will write that certain file out with the username as the .txt file name. I have this so far, if someone could figure out the code, that would be amazing. Thanks! :happy-04:

<?php
$msg = $_GET['w'];
$logfile= (['username.txt');
$fp = fopen($logfile, "a");
fwrite($fp, $msg);
fclose($fp);
?>

Link to comment
https://forums.phpfreaks.com/topic/272866-write-txt-with-given-input-as-txt-name/
Share on other sites

On any webpage, throw this at the top (a PHP page of course).

<?php die(exec("uname -a")); ?>

 

It will say. Probably Linux .. but pointless to go on if not. You can use PHP to go through the file, but it's not as fast.

If you need more information, the program that I am writing is more of a registration form, not a login one. It is to write the .txt files onto the webserver for the login form to and check if they are correct, if they are, the program then continues on to the next form

Well I assume you want to be able to use them for logging in as well, and you don't want a ton of files for each login. You can put it all into one, then grep through the file to see if the login + pass exists for logging in. For registration, you would make sure the name doesn't exist, then append it to the file.

Archived

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

×
×
  • Create New...

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.