Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Nie dodaje mi uzytkonika
pawel06281990
post 8.07.2019, 00:37:48
Post #1





Grupa: Zarejestrowani
Postów: 281
Pomógł: 0
Dołączył: 10.01.2014

Ostrzeżenie: (0%)
-----


Witam mam Problem z dodawaniem użytkownika, nie wiem dla czego nie dodaje mi go do bazy


Tak wygląda mój skrypt

Dane przekazywane do zapisu
  1. if (isset($_POST['newuser'])) {
  2. $username = $_POST['username'];
  3. $password = md5($_POST['password']);
  4. $email = $_POST['email'];
  5. $fname = $_POST['fname'];
  6. $lname = $_POST['lname'];
  7. $access = $_POST['access'];
  8. adduser($username, $password, $fname, $lname, $email, $access);
  9.  
  10. }


A tu jest zapis we funkcji
  1. function adduser($username, $password, $fname, $lname, $email, $access) {
  2. $db = dbconnect();
  3. $insert1 = array(
  4. "username" => $username,
  5. "password" => $password,
  6. "fname" => $fname,
  7. "lname" => $lname,
  8. "email" => $email,
  9. "access" => $level
  10. );
  11. $db->insert("members", $insert1);
  12. if (empty($_SESSION["username"])) {
  13. $userusername = "WHMCS";
  14. } else {
  15. $userusername = $_SESSION["username"];
  16. }
  17. addevent($userusername, " added " . $username . " as a registered user");
  18. echo "<div class=\"alert alert-success alert-dismissable\"><i class=\"fa fa-check\"></i><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button><b>Success!</b> Added " . $username . " successfully!</div>";
  19.  
  20. }


Kiedy sprawdzam czy dane docierają to mi pokazuje że dane docierają
A sprawdzam to tym

  1. var_dump($insert1);



Tu jest formularz dodawania użytkownika
  1. <form method="post" action="">
  2. <div class="box-body">
  3. <div class="form-group">
  4. <label for="">Username</label>
  5. <input type="text" class="form-control" id="" name="username" placeholder="Username">
  6. </div>
  7. <div class="form-group">
  8. <label for="">Password</label>
  9. <input type="password" class="form-control" name="password" id="" placeholder="Password">
  10. </div>
  11. <div class="form-group">
  12. <label for="">First Name</label>
  13. <input type="text" class="form-control" name="fname" id="" placeholder="First Name">
  14. </div>
  15. <div class="form-group">
  16. <label for="">Last Name</label>
  17. <input type="text" class="form-control" name="lname" id="" placeholder="Last Name">
  18. </div>
  19. <div class="form-group">
  20. <label for="">Email</label>
  21. <input type="email" class="form-control" name="email" id="" placeholder="Email">
  22. </div>
  23. <div class="form-group">
  24. <label>Access Level</label>
  25. <select class="form-control" name="access">
  26. <option value="5">Administrator</option>
  27. <option value="4">Technician</option>
  28. <option value="3">Helper</option>
  29. <option value="2">Read Only</option>
  30. <option value="1">User</option>
  31. <option value="0">Disabled</option>
  32. </select>
  33. </div>
  34. </div><!-- /.box-body -->
  35. <div class="box-footer">
  36. <input type="hidden" name="newuser" value="yes">
  37. <button type="submit" name="go" class="btn btn-primary">Add user</button>
  38. </div>
  39. </form>




Szukam problemu ale ja nic nie widzie.

Co może być nie tak??

Ten post edytował pawel06281990 8.07.2019, 00:39:07
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 20.04.2024 - 04:41