WebbServerProg/www/public/Moment-3/dataBas/addUser.php

25 lines
540 B
PHP
Raw Normal View History

2024-09-13 14:45:04 +00:00
<?php
2024-09-16 08:26:33 +00:00
$file = "../../userM3.dat";
2024-09-13 14:45:04 +00:00
function addUser($newUser, $file) {
if(file_exists($file)){
$users = unserialize(file_get_contents($file));
2024-09-16 08:26:33 +00:00
$users[] = $newUser;
file_put_contents($file, serialize($users));
} else {
$users = array();
$users[] = $newUser;
2024-09-13 14:45:04 +00:00
file_put_contents($file, serialize($users));
2024-09-16 08:26:33 +00:00
}
2024-09-13 14:45:04 +00:00
}
2024-09-16 08:26:33 +00:00
function readUserData($file) {
2024-09-13 14:45:04 +00:00
if(file_exists($file)){
$users = unserialize(file_get_contents($file));
}
2024-09-16 08:26:33 +00:00
return $users;
2024-09-13 14:45:04 +00:00
}
?>