Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]nie mogę sie zalogować
Johnas
post
Post #1





Grupa: Zarejestrowani
Postów: 650
Pomógł: 16
Dołączył: 5.07.2010
Skąd: Ściśle Tajne

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


Witam mam problem z zalogowaniem sie nie wiem czemu... na stronie cs-master.xaa.pl wszystko działa a na nowej pod linkiem youphoto po prubie zalogowania sie wyskakuje okno i nic sie nie robi jak by $_post nie działał... kod mam taki
  1. if (isset($_SESSION['login'])) { // dostęp dla niezalogowanego użytkownika
  2.  
  3.  
  4. header("Location: profile.php");
  5. } else {
  6. ?>
  7. <h2>Panel logowania</h2>
  8. <div class="box">
  9. <div class="inner">
  10. <div class="wrapper">
  11. <?php
  12. if ($_POST['logowanie']) { // jeżeli formularz został wysłany, to wykonuje się poniższy skrypt
  13.  
  14.  
  15. $tabela = 'rejestracja'; // zdefiniowanie tabeli MySQL
  16.  
  17. $login = mb_strtolower($_POST["login"]);
  18. $haslo = $_POST["pass"];
  19.  
  20. $haslo = md5($haslo); // szyfrowanie podanego hasła
  21.  
  22. $wynik=mysql_query("SELECT * FROM $tabela WHERE
  23. login='$login' and haslo='$haslo' and status=0");
  24.  
  25.  
  26. // jeżeli użytkownik zarejestrował się, a nie aktywował swojego konta, to wyświetla się komunikat
  27. if (mysql_num_rows($wynik) == 1) {
  28. $informacja = mysql_fetch_array($wynik);
  29. echo '<span class="blad">Nie aktywowałeś jeszcze swojego konta. Aby to zrobić, wejdź w swoją skrzynkę odbiorczą, a następnie znajdź wiadmość z linkiem aktywacyjnym i aktywuj swoje konto</span>';
  30. }
  31.  
  32. // jeżeli wszystko jest dobrze, użytkownik się loguje
  33. $wynik=mysql_query("UPDATE $tabela SET online=1 WHERE
  34. login='$login' and haslo='$haslo' and status=1");
  35. $wynik=mysql_query("SELECT * FROM $tabela WHERE
  36. login='$login' and haslo='$haslo' and status=1");
  37.  
  38. if (mysql_num_rows($wynik) == 1) {
  39. $informacja = mysql_fetch_array($wynik);
  40. $_SESSION["login"] = $informacja["login"];
  41. $_SESSION["email"] = $informacja["email"];
  42. $_SESSION["imie"] = $informacja["imie"];
  43. $_SESSION["nazwisko"] = $informacja["nazwisko"];
  44. $_SESSION["id"] = $informacja["id"];
  45. $_SESSION["id_rangi"] = $informacja["id_rangi"];
  46.  
  47. header('Location: profile.php?act=o_mnie ');
  48. } else {
  49. echo '<span class="blad">Nie poprawny login lub hasło!</span> ';
  50. }
  51.  
  52. }
  53.  
  54. ?>
  55. <!-- PANEL LOGOWANIA -->
  56.  
  57. <form action="index.php" method="post">
  58. <input type="hidden" name="logowanie" value="TRUE" />
  59. <div id="logowanie">
  60. <p>Login: <input type="text" name="login" id="acpro_inp0"></p>
  61. <p>Hasło: <input type="password" name="pass" id="acpro_inp0"></p>
  62. </div>
  63.  
  64. <p><input type="checkbox" name="nazwa" value="wartość" id="acpro_inp0" /> Zapamiętaj
  65.  
  66. <center><input align="center" class="submit" type="submit" value="Zaloguj" /></center>
  67.  
  68. </form>
  69. <hr />
  70. <a href="memory.php">Zapomniałeś hasła? Kliknij tutaj!</a>
  71. <!-- KONIEC PANELU -->
  72. <div class="clear"></div>
  73. </div>
  74. </div>
  75. </div>


To jest tylko fragment odpowiedzialny za logowanie... nie wiem co może być nie tak


Dodam że przenoszę strone na VPS
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Johnas
post
Post #2





Grupa: Zarejestrowani
Postów: 650
Pomógł: 16
Dołączył: 5.07.2010
Skąd: Ściśle Tajne

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


Teraz się rozpiszę trochę bo idę zaraz do pracy pomóc koledze. Wszystko w rejestracji działa po usunięciu tego fragmentu kodu. w profilu też wszystko działa po za klasą zmiany zdjęć (tutaj nie dodaje napisu friendsbook i nie zmienia formatu z png na jpg) oraz uploadu avataru (nie uploaduje i nie daje jednocześnie zapytania do sql.

AVatar wygląda tak:
  1. elseif ($_GET['actphoto'] == "avatar")
  2. {
  3.  
  4. if ($_GET['photoid'] ){
  5. $idphoto = $_GET['photoid'];
  6. $infop = mysql_fetch_array(mysql_query("SELECT * FROM photo WHERE id=$idphoto"));
  7.  
  8. if ($infop) {
  9. $iddodajacego = $infop['iduser'];
  10. if ($iddodajacego == $myid) {
  11. $avat = $infop['link'];
  12. // ================================================Start avat =========================================================
  13. $los = rand(1, 9999999999999999);
  14. $upload_dir = "upload_pic"; // The directory for the images to be saved in
  15. $upload_path = $upload_dir."/"; // The path to where the image will be saved
  16. $large_image_name = $avat; // New name of the large image
  17. $thumb_image_name = "avat_".$login."_". $los .".jpg"; // New name of the thumbnail image
  18. $max_file = "1148576"; // Approx 1MB
  19. $max_width = "500"; // Max width allowed for the large image
  20. $thumb_width = "100"; // Width of thumbnail image
  21. $thumb_height = "100"; // Height of thumbnail image
  22. $wyniksql = $upload_path.$thumb_image_name;
  23.  
  24.  
  25. //Image functions
  26. //You do not need to alter these functions
  27. function resizeImage($image,$width,$height,$scale) {
  28. $newImageWidth = ceil($width * $scale);
  29. $newImageHeight = ceil($height * $scale);
  30. $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
  31. $source = imagecreatefromjpeg($image);
  32. imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);
  33. imagejpeg($newImage,$image,90);
  34. chmod($image, 0777);
  35. return $image;
  36. }
  37. //You do not need to alter these functions
  38. function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){
  39. $newImageWidth = ceil($width * $scale);
  40. $newImageHeight = ceil($height * $scale);
  41. $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
  42. $source = imagecreatefromjpeg($image);
  43. imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHe
    ight,$width,$height);
  44. imagejpeg($newImage,$thumb_image_name,90);
  45. chmod($thumb_image_name, 0777);
  46. return $thumb_image_name;
  47. }
  48. //You do not need to alter these functions
  49. function getHeight($image) {
  50. $sizes = getimagesize($image);
  51. $height = $sizes[1];
  52. return $height;
  53. }
  54. //You do not need to alter these functions
  55. function getWidth($image) {
  56. $sizes = getimagesize($image);
  57. $width = $sizes[0];
  58. return $width;
  59. }
  60.  
  61. //Image Locations
  62. $large_image_location = $large_image_name;
  63. $thumb_image_location = $upload_path.$thumb_image_name;
  64.  
  65. //Create the upload directory with the right permissions if it doesn't exist
  66. if(!is_dir($upload_dir)){
  67. mkdir($upload_dir, 0777);
  68. chmod($upload_dir, 0777);
  69. }
  70.  
  71. //Check to see if any images with the same names already exist
  72. if (file_exists($large_image_location)){
  73. if(file_exists($thumb_image_location)){
  74. $thumb_photo_exists = "<img src=\"".$upload_path.$thumb_image_name."\" alt=\"Thumbnail Image\"/>";
  75. }else{
  76. $thumb_photo_exists = "";
  77. }
  78. $large_photo_exists = "<img src=\"".$upload_path.$large_image_name."\" alt=\"Large Image\"/>";
  79. } else {
  80. $large_photo_exists = "";
  81. $thumb_photo_exists = "";
  82. }
  83.  
  84. if (isset($_POST["upload"])) {
  85. //Get the file information
  86. $userfile_name = $_FILES['image']['name'];
  87. $userfile_tmp = $_FILES['image']['tmp_name'];
  88. $userfile_size = $_FILES['image']['size'];
  89. $filename = basename($_FILES['image']['name']);
  90. $file_ext = substr($filename, strrpos($filename, '.') + 1);
  91.  
  92. //Only process if the file is a JPG and below the allowed limit
  93. if((!empty($_FILES["image"])) && ($_FILES['image']['error'] == 0)) {
  94. if (($file_ext!="jpg") && ($userfile_size > $max_file)) {
  95. $error= "ONLY jpeg images under 1MB are accepted for upload";
  96. }
  97. }else{
  98. $error= "Select a jpeg image for upload";
  99. }
  100. //Everything is ok, so we can upload the image.
  101. if (strlen($error)==0){
  102.  
  103. if (isset($_FILES['image']['name'])){
  104.  
  105. move_uploaded_file($userfile_tmp, $large_image_location);
  106. chmod($large_image_location, 0777);
  107.  
  108. $width = getWidth($large_image_location);
  109. $height = getHeight($large_image_location);
  110. //Scale the image if it is greater than the width set above
  111. if ($width > $max_width){
  112. $scale = $max_width/$width;
  113. $uploaded = resizeImage($large_image_location,$width,$height,$scale);
  114. }else{
  115. $scale = 1;
  116. $uploaded = resizeImage($large_image_location,$width,$height,$scale);
  117. }
  118. //Delete the thumbnail file so the user can create a new one
  119. if (file_exists($thumb_image_location)) {
  120. unlink($thumb_image_location);
  121. }
  122. }
  123. //Refresh the page to show the new uploaded image
  124. header("location:".$_SERVER["PHP_SELF"]);
  125. exit();
  126. }
  127. }
  128.  
  129. if (isset($_POST["upload_thumbnail"]) && strlen($large_photo_exists)>0) {
  130. //Get the new coordinates to crop the image.
  131. $x1 = $_POST["x1"];
  132. $y1 = $_POST["y1"];
  133. $x2 = $_POST["x2"];
  134. $y2 = $_POST["y2"];
  135. $w = $_POST["w"];
  136. $h = $_POST["h"];
  137. //Scale the image to the thumb_width set above
  138. $scale = $thumb_width/$w;
  139. $cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale);
  140. //Reload the page again to view the thumbnail
  141. if ($avatar == 'img/avatar-start.png'){
  142. $wynik = mysql_query("UPDATE rejestracja SET avatar='$wyniksql' WHERE id=$myid");
  143. } else {
  144. unlink($avatar);
  145. $wynik = mysql_query("UPDATE rejestracja SET avatar='$wyniksql' WHERE id=$myid");
  146. }
  147. header("location: profile.php?avat=good");
  148. exit();
  149. }
  150.  
  151. if ($_GET['a']=="delete"){
  152. if (file_exists($large_image_location)) {
  153. unlink($large_image_location);
  154. }
  155. if (file_exists($thumb_image_location)) {
  156. unlink($thumb_image_location);
  157. }
  158. header("location:".$_SERVER["PHP_SELF"]);
  159. exit();
  160. }
  161. if(strlen($large_photo_exists)>0){
  162. $current_large_image_width = getWidth($large_image_location);
  163. $current_large_image_height = getHeight($large_image_location);?>
  164. <script type="text/javascript">
  165. function preview(img, selection) {
  166. var scaleX = <?php echo $thumb_width;?> / selection.width;
  167. var scaleY = <?php echo $thumb_height;?> / selection.height;
  168.  
  169. $('#thumbnail + div > img').css({
  170. width: Math.round(scaleX * <?php echo $current_large_image_width;?>) + 'px',
  171. height: Math.round(scaleY * <?php echo $current_large_image_height;?>) + 'px',
  172. marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px',
  173. marginTop: '-' + Math.round(scaleY * selection.y1) + 'px'
  174. });
  175. $('#x1').val(selection.x1);
  176. $('#y1').val(selection.y1);
  177. $('#x2').val(selection.x2);
  178. $('#y2').val(selection.y2);
  179. $('#w').val(selection.width);
  180. $('#h').val(selection.height);
  181. }
  182.  
  183. $(document).ready(function () {
  184. $('#save_thumb').click(function() {
  185. var x1 = $('#x1').val();
  186. var y1 = $('#y1').val();
  187. var x2 = $('#x2').val();
  188. var y2 = $('#y2').val();
  189. var w = $('#w').val();
  190. var h = $('#h').val();
  191. if(x1=="" || y1=="" || x2=="" || y2=="" || w=="" || h==""){
  192. alert("Musisz zaznaczyć obszar avataru");
  193. return false;
  194. }else{
  195. return true;
  196. }
  197. });
  198. });
  199.  
  200. $(window).load(function () {
  201. $('#thumbnail').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview });
  202. });
  203.  
  204. </script>
  205. <?php }?>
  206.  
  207. <?php
  208. //Display error message if there are any
  209. if(strlen($error)>0){
  210. echo "<ul><li><strong>Error!</strong></li><li>".$error."</li></ul>";
  211. }
  212. if(strlen($large_photo_exists)>0 && strlen($thumb_photo_exists)>0){
  213. echo "<p><strong>NOTE:</strong> If the thumbnail image looks the same as the previous one, just hit refresh a couple of times.</p>";
  214. echo $large_photo_exists."&nbsp;".$thumb_photo_exists;
  215. echo "<p><a href=\"".$_SERVER["PHP_SELF"]."?a=delete\">Delete Images</a></p>";
  216. }else{
  217. if(strlen($large_photo_exists)>0){
  218. echo <<< av
  219.  
  220.  
  221. <div style="padding: 0 0 0 270px;">
  222. <img src="$large_image_name" style="float: left; margin-right: 10px;" id="thumbnail" alt="Create Thumbnail" />
  223. <div style="float:left; position:relative; overflow:hidden; width:{$thumb_width}px; height:{$thumb_height}px;">
  224. <img src="$large_image_name" style="position: relative;" alt="Thumbnail Preview" />
  225. </div>
  226. <br style="clear:both;"/>
  227. <form name="thumbnail" action="" method="post">
  228. <input type="hidden" name="x1" value="" id="x1" />
  229. <input type="hidden" name="y1" value="" id="y1" />
  230. <input type="hidden" name="x2" value="" id="x2" />
  231. <input type="hidden" name="y2" value="" id="y2" />
  232. <input type="hidden" name="w" value="" id="w" />
  233. <input type="hidden" name="h" value="" id="h" />
  234. <input type="submit" name="upload_thumbnail" class="submit" value="Zapisz" id="save_thumb" />
  235. </form>
  236. </div>
  237. <br>
  238. av;
  239.   }
  240. echo <<< a
  241.  
  242. a;
  243. }
  244.  
  245. //==================================================END===========================
    ======================
  246. }

Dodam że tu opcja register_globals jest włączona a na localu nie mam i śmiga

Czy to może być wina braku isset`ów?

Wie ktoś może czemu tutaj nie wykonuje mi $_POST ? Ja nie widzę żadnego błędu (IMG:style_emoticons/default/sad.gif)

znalazłem też funkcje wyłączoną na serwerze gdzie stronka nie działa, a gdzie działa to jest włączona. nie wiem czy to od tego zależy. funkcja nazywa się allow_call_time_pass_reference
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: 14.10.2025 - 21:53