Ron Ron - 4 years ago 98
PHP Question

Enter Data Into a PHP File, Using PHP

This is the same project as the other question I had.

I'm wondering how to use a .php to enter data into a CERTAIN LOCATION to another php file, so think of it as remotely adding in data.

I've Googled, and haven't found much, and I'm sure I got the php editing down, I'm just clueless on how I would enter the data into a specific point.

Any help would be appreciated.


// Parameters (Leave this Alone)
$Message = $_GET["message"];
$Username = htmlspecialchars($_GET["username"]);
$time = ($_GET["time"]);

// User Banning
$data = file_get_contents('Banned.txt');
if(strpos($data, $Username) !== FALSE)
// --------------- Staff Members ---------------- //
// Admins //
If ($Username=="!divider!user") $Username="!divider![Admin] user";
If ($Username=="!divider!user2") $Username="!divider![Admin] user2";

// File Writing (Leave this Alone)
$File = "Chat.txt";
$Handle = fopen($File, "a");
fwrite($Handle, $Username);
fwrite($Handle, ": ");
fwrite($Handle, $Message);
fwrite($Handle, " -:-:- ");
fwrite($Handle, $time);
fwrite($Handle, "\r\n");
print "Data Written";

I'm trying to use another php file, to add staff under the staff list.

So in (edit.php) have a textarea input, and whatever I submit, it enters the submitted data under:

//-----Staff Members-----//

the client I will be using will fill in everything in front and behind of the username for php.

Answer Source

Your question is not clear, but it sounds like you want to add another php file somewhere in your code. You could user require, require_once or include to handle this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download