Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{"username":"User1","password":"Password"},
- {"username":"User5","password":"passWord"},]
- <?php $username = $_POST["username"]; ?><br>
- <?php $password = $_POST["password"]; ?><br>
- <?php
- $currentData = file_get_contents('UserJSON.txt');
- $array_data = json_decode($currentData, true);
- $extra = array(
- 'username' => $username,
- 'password' => $password
- );
- $array_data[] = $extra;
- $final_data = json_encode($array_data);
- if(file_put_contents('UserJSON.txt',$final_data)) {
- print("working");
- }
- ?>
- <?php
- $urlText = $_REQUEST["urlText"];
- $currentData = file_get_contents('UserJSON.txt');
- $array_data = json_decode($currentData, true);
- //for loop
- $array_data[i]['Posts'] = $urlText;
- //end for loop
- $final_data = json_encode($array_data);
- if(file_put_contents('UserJSON.txt',$final_data)) {
- }
- ?>
- [{"username":"User1","password":"Password","Posts:{"This is a post"}},
- {"username":"User5","password":"passWord"},"Posts:{"This is a post2"}}]
Add Comment
Please, Sign In to add comment