Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] Logowanie - dostęp do podstron
buddha
post
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 7.09.2017

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


Witajcie.

Postaram się wam opisać mój problem.

Moim głównym założeniem jest ustawienie na stronie głównej
formularza do wyszukiwania innych użytkowników, lecz niestety
po przejściu dalej zdjęcia oraz inne szczegółowe dane
użytkowników są nie widoczne.

Próbowałem wyłączyć logowanie czy też ustawić standard
na zalogowany, lecz cały portal ma w sobie bardzo wiele złożonych
funkcji. Myślę że jednym z sposobów będzie ustawienie dla każdej
nie zalogowanej osoby id

  1. function isLogged() {
  2.  
  3. global $mysqli;
  4.  
  5.  
  6.  
  7. if (!empty($_SESSION['user']) && is_numeric($_SESSION['user']) && $_SESSION['user'] > 0) {
  8.  
  9. $user_id = secureEncode($_SESSION['user']);
  10.  
  11. $query = "SELECT COUNT(id) AS count FROM usuarios WHERE id=$user_id";
  12.  
  13. $sql_query = $mysqli->query($query);
  14.  
  15. $sql_fetch = mysqli_fetch_assoc($sql_query);
  16.  
  17.  
  18.  
  19. return $sql_fetch['count'];
  20.  
  21. }
  22.  
  23. }


oraz

  1. function getSearchUserInfo($uid) {
  2. global $mysqli,$sm;
  3. $uid = secureEncode($uid);
  4. $user = $mysqli->query("SELECT id,name,city,country,online_day,age,fake,gender FROM users WHERE id = '".$uid."'");
  5. $u = $user->fetch_object();
  6. $first_name = explode(' ',trim($u->name));
  7. $first_name = explode('_',trim($first_name[0]));
  8. //CURENT USER
  9. $current_user['id'] = $u->id;
  10. $current_user['first_name'] = $first_name[0];
  11. $current_user['name'] = $u->name;
  12. $current_user['profile_photo'] = profilePhoto($u->id);
  13. $current_user['city'] = $u->city;
  14. $current_user['country'] = $u->country;
  15. $current_user['age'] = $u->age;
  16. $current_user['gender'] = $u->gender;
  17. $current_user['link'] = clean($first_name[0]);
  18. $current_user['fake'] = $u->fake;
  19. $current_user['online_day'] = $u->online_day;
  20. $sm['search'] = $current_user;
  21. }


Macie jakieś pomysły? Rozwiązanie zapewne banalne, ale cos nie moge wymyślić.

_____________________


Na początku pliku profile/content.php mam taki kod

  1. if($_GET['id'] != NULL ){
  2.  
  3. $usid = secureEncode($_GET['id']);
  4.  
  5. getUserInfo($usid,1);
  6.  
  7. }




Ten post edytował buddha 12.10.2017, 19:42:03
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
buddha
post
Post #2





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 7.09.2017

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


Zmienić na fetch_assoc?
Tak, szukam użytkowników przez preferencje z bazy

Mój cały kod strony z wyszukiwaniem wygląda tak
( wszystko działa, lecz niestety tylko gdy jestem zalogowany )

  1. <?php $e_age = explode( ',', $sm['user']['s_age'] ); $age = $e_age[2]; $age2 = $e_age[1]; $age1 = $e_age[0]; ?>
  2. <script>
  3. url = "search";
  4. </script>
  5. <div class="search-people-container" style="display:none">
  6. <div class="container relative search-people">
  7. <div class="search-text"> </div>
  8. <div class="search-form" style="display:none;">
  9. <h2 class="show-me"><?= $sm['lang'][109]['text']; ?></h2>
  10. <input type="hidden" value="0" id="meet_filter_limit" data-filter="meet_filter_limit" />
  11. <select class="select1" data-filter="meet_filter_gender" id="meet_filter_gender">
  12. <option value="2" <?php if($sm[ 'user'][ 's_gender']==2 ) { echo 'selected'; } ?>>
  13. <?= $sm['lang'][110]['text']; ?>
  14. </option>
  15. <option value="1" <?php if($sm[ 'user'][ 's_gender']==1 ) { echo 'selected'; } ?>>
  16. <?= $sm['lang'][111]['text']; ?>
  17. </option>
  18. <option value="3" <?php if($sm[ 'user'][ 's_gender']==3 ) { echo 'selected'; } ?>>
  19. <?= $sm['lang'][112]['text']; ?>
  20. </option>
  21. </select>
  22. <input class="select2" style="width: 115px;" value="<?= $age1;?>" type="number" min="18" max="99" data-filter="meet_filter_age1" id="meet_filter_age1" />
  23. <input class="select2" style="width: 115px;left:550px;" value="<?= $age2;?>" type="number" min="18" max="99" data-filter="meet_filter_age2" id="meet_filter_age2"/>
  24.  
  25. <input class="input" type="text" id="meet_filter_city" value="<?= $sm['user']['city']; ?>" />
  26. <div class="input-location"><i class="material-icons">location_on</i></div>
  27. <select class="select3" data-filter="meet_filter_radius" id="meet_filter_radius">
  28. <option value="300" <?php if($sm[ 'user'][ 's_radius']==100) { echo 'selected'; } ?>>All the city</option>
  29. <option value="10000000" <?php if($sm[ 'user'][ 's_radius']==1000) { echo 'selected'; } ?>>
  30. <?= $sm['twoo_lang'][6]['text']; ?>
  31. </option>
  32. </select>
  33. <select class="select4" id="meet_filter_online" data-filter="meet_filter_online">
  34. <option value="0" selected>
  35. <?= $sm['twoo_lang'][9]['text']; ?>
  36. </option>
  37. <option value="1">
  38. <?= $sm['twoo_lang'][10]['text']; ?>
  39. </option>
  40. </select>
  41. <h2 class="show-me-more"><?= $sm['lang'][109]['text']; ?></h2>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="search-result-container">
  46.  
  47. <div class="container relative margin-bottom-50">
  48.  
  49. <div class="search-section">
  50. <div id="searching">
  51. <div class="pulse"></div>
  52. <div class="pulse-photo" data-back-photo="1" data-src="<?= $sm['user']['profile_photo']; ?>"></div>
  53. </div>
  54. <div id="meet_section"> </div>
  55. </div>
  56. </div>
  57. <div class="rings" style="display:none">
  58. <div class="user-photo" data-back-photo="1" data-src="<?= $sm['user']['profile_photo']; ?>"></div>
  59. <div class="ring__ringlet"></div>
  60. <div class="ring__ringlet"></div>
  61. <div class="ring__ringlet"></div>
  62. </div>
  63. </div>


Ten post edytował buddha 13.10.2017, 07:56:43
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 11.10.2025 - 20:01