Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Błąd z logowaniem na nowym hostingu.
Forum PHP.pl > Forum > Przedszkole
bartek4175
Witam! mam błąd z logowaniem na stronie http://surfmig.pl/index.php

Kupiłem nowy hosting ( lepszy ) i teraz logowanie przestało działać. Po wgraniu plików i bazy działało wszystko a teraz nie loguje.
  1. <?
  2. define('BASEPATH', true);
  3. include('inc/config.php');
  4.  
  5. if($site['maintenance'] > 0){redirect('maintenance');}
  6. if (isset($_GET['ref']) && $_GET['ref'] != ""){setcookie("PlusREF", $db->EscapeString($_GET['ref']), time()+3600);}
  7.  
  8.  
  9. if(isset($_POST['logare'])) {
  10. $name = $db->EscapeString($_POST['login']);
  11. $pass = $db->EscapeString($_POST['pass']);
  12. $ltype = ($site['reg_logtype'] == 1 ? '`email`' : '`login`');
  13. $sql = $db->Query("SELECT id,login,banned,activate FROM `users` WHERE ".$ltype."='".$name."' AND `pass`=MD5('".$pass."')");
  14. $data = $db->FetchArray($sql);
  15.  
  16. if($data['banned'] > 0){
  17. $errMsg = "<h2>ERROR: Twoje konto zostało zablokowane!</h2>";
  18. }elseif($data['activate'] > 0){
  19. $errMsg = "<h2>ERROR: Musisz najpierw potwierdzić link w mailu!</h2>";
  20. }elseif($data['id'] != '') {
  21. $db->Query("UPDATE `users` SET `online`=NOW() WHERE `login`='".$data['login']."'");
  22. $_SESSION['EX_login'] = $data['login'];
  23. redirect('index.php');
  24. }else{
  25. $errMsg = "ERROR: Nick albo hasło zostały wprowadzone niepoprawnie !";
  26. }
  27. }
  28. ?>


  1. <div class="content text">
  2. <form method="post">
  3. <p>
  4. <label><?=($site['reg_logtype'] == 1 ? 'E-mail' : 'Login')?></label><br/>
  5. <input class="text big" type="<?=($site['reg_logtype'] == 1 ? 'email' : 'text')?>" value="" name="login" required="required" />
  6. </p>
  7. <p>
  8. <label>Hasło</label> <br/>
  9. <input class="password" type="password" value="" name="pass" required="required" />
  10. </p>
  11. <p>
  12. <input type="submit" class="button gray small" name="logare" value="Zaloguj" />
  13. </p>
  14. </form>
  15. </div>
Wazniak96
Skoro nie działa to musi wypływać błędy. Włącz raportowanie i pokaż co tam serwerowi nie pasuje.
bartek4175
Cytat(Wazniak96 @ 20.10.2014, 20:01:19 ) *
Skoro nie działa to musi wypływać błędy. Włącz raportowanie i pokaż co tam serwerowi nie pasuje.

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/surfmigp/domains/surfmig.pl/public_html/inc/libs/MySQL_connection.php on line 36

plik MySQL_connection.php:
  1. <?php
  2. if(! defined('BASEPATH') ){ exit('Unable to view file.'); }
  3.  
  4.  
  5. class MySQLConnection {
  6.  
  7. private $sqlHost;
  8. private $sqlUser;
  9. private $sqlPassword;
  10. private $sqlDatabase;
  11.  
  12. private $mySqlLinkIdentifier = FALSE;
  13.  
  14. public $QueryFetchArrayTemp = array();
  15.  
  16. private $numQueries = 0;
  17.  
  18. public $UsedTime = 0;
  19.  
  20. public function __construct($sqlHost, $sqlUser, $sqlPassword, $sqlDatabase = FALSE) {
  21. $this->sqlHost = $sqlHost;
  22. $this->sqlUser = $sqlUser;
  23. $this->sqlPassword = $sqlPassword;
  24. $this->sqlDatabase = $sqlDatabase;
  25. }
  26.  
  27. public function __destruct() {
  28. $this->Close();
  29. }
  30.  
  31. public function Connect() {
  32. if($this->mySqlLinkIdentifier !== FALSE) {
  33. return $this->mySqlLinkIdentifier;
  34. }
  35.  
  36. $this->mySqlLinkIdentifier = mysql_connect($this->sqlHost, $this->sqlUser, $this->sqlPassword, TRUE); // Open new link on every call
  37. if($this->mySqlLinkIdentifier === FALSE) {
  38. return FALSE;
  39. }
  40.  
  41. if($this->sqlDatabase !== FALSE) {
  42. mysql_select_db($this->sqlDatabase, $this->mySqlLinkIdentifier);
  43. }
  44.  
  45. return $this->mySqlLinkIdentifier;
  46. }
  47.  
  48. public function Close() {
  49. if($this->mySqlLinkIdentifier !== FALSE) {
  50. mysql_close($this->mySqlLinkIdentifier);
  51. $this->mySqlLinkIdentifier = FALSE;
  52. }
  53. }
  54.  
  55. public function GetLinkIdentifier() {
  56. return $this->mySqlLinkIdentifier;
  57. }
  58.  
  59. public function Query($query) {
  60. $start = microtime(true);
  61. $result = mysql_query($query, $this->GetLinkIdentifier());
  62. $this->UsedTime += microtime(true) - $start;
  63. $this->numQueries++;
  64.  
  65. if( $result === false ){
  66. die($this->GetErrorMessage());
  67. }
  68.  
  69. return $result;
  70. }
  71.  
  72. public function FreeResult($result) {
  73. }
  74.  
  75. public function FetchArray($result) {
  76. return mysql_fetch_array($result, MYSQL_ASSOC);
  77. }
  78.  
  79. public function FetchArrayAll($result){
  80. $retval = array();
  81. if($this->GetNumRows($result)) {
  82. while($row = $this->FetchArray($result)) {
  83. $retval[] = $row;
  84. }
  85. }
  86. return $retval;
  87. }
  88.  
  89. public function GetNumRows($result) {
  90. return mysql_num_rows($result);
  91. }
  92.  
  93. public function GetNumAffectedRows() {
  94. return mysql_affected_rows($this->mySqlLinkIdentifier);
  95. }
  96.  
  97.  
  98. // Helper methods
  99. public function QueryFetchArrayAll($query) {
  100. $result = $this->Query($query);
  101. if($result === FALSE) {
  102. return FALSE;
  103. }
  104.  
  105. $retval = $this->FetchArrayAll($result);
  106. $this->FreeResult($result);
  107.  
  108. return $retval;
  109. }
  110.  
  111. public function QueryFirstRow($query) {
  112. $result = $this->Query($query);
  113. if($result === FALSE) {
  114. return FALSE;
  115. }
  116.  
  117. $retval = FALSE;
  118.  
  119. $row = $this->FetchArray($result);
  120. if($row !== FALSE) {
  121. $retval = $row;
  122. }
  123.  
  124. $this->FreeResult($result);
  125.  
  126. return $retval;
  127. }
  128.  
  129. public function QueryFirstValue($query) {
  130. $row = $this->QueryFirstRow($query);
  131. if($row === FALSE) {
  132. return FALSE;
  133. }
  134.  
  135. return $row[0];
  136. }
  137.  
  138. public function GetErrorMessage() {
  139. return "SQL Error: ".mysql_error().": ";
  140. }
  141.  
  142. public function EscapeString($string) {
  143. if (is_array($string))
  144. {
  145. $str = array();
  146. foreach ($string as $key => $value)
  147. {
  148. $str[$key] = $this->EscapeString($value);
  149. }
  150.  
  151. return $str;
  152. }
  153.  
  154. return get_magic_quotes_gpc() ? $string : mysql_real_escape_string($string, $this->mySqlLinkIdentifier);
  155. }
  156.  
  157. function GetNumberOfQueries() {
  158. return $this->numQueries;
  159. }
  160.  
  161. public function BeginTransaction() {
  162. $this->Query("SET AUTOCOMMIT=0");
  163. $this->Query("BEGIN");
  164. }
  165.  
  166. public function CommitTransaction() {
  167. $this->Query("COMMIT");
  168. $this->Query("SET AUTOCOMMIT=1");
  169. }
  170.  
  171. public function RollbackTransaction() {
  172. $this->Query("ROLLBACK");
  173. $this->Query("SET AUTOCOMMIT=1");
  174. }
  175.  
  176. public function GetFoundRows() {
  177. return $this->QueryFirstValue("SELECT FOUND_ROWS()");
  178. }
  179.  
  180. public function GetLastInsertId() {
  181. return $this->QueryFirstValue("SELECT LAST_INSERT_ID()");
  182. }
  183.  
  184.  
  185. public function QueryFetchArray($query, $all = false, $useCache = true)
  186. {
  187. $tempKey = sha1($query . ($all === true ? 'all' : 'notAll'));
  188. $temp = $this->QueryFetchArrayTemp[$tempKey];
  189.  
  190. if ($temp && $useCache === true)
  191. {
  192. return unserialize($temp);
  193. }
  194. else
  195. {
  196. $queryResult = $this->Query($query);
  197. $result = $all === true ? $this->FetchArrayAll($queryResult) : $this->FetchArray($queryResult);
  198.  
  199. $this->QueryFetchArrayTemp[$tempKey] = serialize($result);
  200. return $result;
  201. }
  202. }
  203. }
  204. ?>
Turson
Wklej kod błędu w google i poczytaj jak angielskiego nie znasz.
Albo robisz downgrade wersji PHP albo przerabiasz na PDO/MySQLi
nospor
Przeciez ten komunikat ma sie nachwilę obecną nijak do faktu, ze przestalo mu dzialac logowanie....

Temat: Jak poprawnie zada pytanie
Sprawdzaj wszystko po kolei, a moze cos znajdziesz.
bartek4175
dałem wersje php z 5.5 na 5.2 i działa smile.gif Do zamknięcia!
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.