За последние 24 часа нас посетили 20956 программистов и 1107 роботов. Сейчас ищут 429 программистов ...

ошибка 500... из-за чего?

Тема в разделе "PHP и базы данных", создана пользователем Pomaska, 1 сен 2010.

  1. Gromo

    Gromo Активный пользователь

    С нами с:
    24 май 2010
    Сообщения:
    2.786
    Симпатии:
    2
    Адрес:
    Ташкент
    Pomaska
    в зависимости от того КАК у тебя устроен код системы, строку session_start() надо добавлять в САМОЕ начало кода пхп
     
  2. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    ока... тогда я его сделаю в хедаре перед инклудом... а вот как мне сделать чтобы небыло этого лага что я всё время гость в статусе?(((
     
  3. Gromo

    Gromo Активный пользователь

    С нами с:
    24 май 2010
    Сообщения:
    2.786
    Симпатии:
    2
    Адрес:
    Ташкент
    пришли мне код, нужный для воспроизведения данного бага. посмотрю, отпишусь.
     
  4. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    всмысле?

    вот мой header.php
    PHP:
    1. <?php include('conf.php');
    2.    if(session_id() == ''){session_start();}
    3.    
    4.  if($_SESSION['login'] == '')
    5.  {
    6.  $_SESSION['login'] = 'Гость';}
    7.    
    8.  ?>
    всё из-за него...
     
  5. Apple

    Apple Активный пользователь

    С нами с:
    13 янв 2007
    Сообщения:
    4.984
    Симпатии:
    2
    Pomaska
    Во-первых, никаких byte order mark.
    Во-вторых буферизацию вывода делать, если контролировать выходной поток нет возможности.
     
  6. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    эээ а теперь понятным для новичка языком=)))

     
  7. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    может сессию нельзя определять POSTом??? а нужно только GETом???
    но если я ставлю GET, то у меня не работают страницы типа
    index.php?mode=login
    index.php?mode=loging
    index.php?mode=logout
    и т.д
     
  8. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    такое ощущение, как будто сессии выключенны.... я просто прописываю
    $_SESSION['login'] = $_GET['login'];
    делаю в адресной строке этот логин и мне пишет что я Ромашка (ну логин такой), а когда перехожу на другую страницу, то всё заного становится... как будто сессии и небыло вообще никогда...(((

    может реально что-то с конфигом?
    вот мой php.ini (только про сессии)

    как спойлер сделать?
    PHP:
    1. [Session]
    2. ; Handler used to store/retrieve data.
    3. session.save_handler = files
    4.  
    5. ; Argument passed to save_handler.  In the case of files, this is the path
    6. ; where data files are stored. Note: Windows users have to change this
    7. ; variable in order to use PHP's session functions.
    8. ;
    9. ; As of PHP 4.0.1, you can define the path as:
    10. ;
    11. ;     session.save_path = "N;/path"
    12. ;
    13. ; where N is an integer.  Instead of storing all the session files in
    14. ; /path, what this will do is use subdirectories N-levels deep, and
    15. ; store the session data in those directories.  This is useful if you
    16. ; or your OS have problems with lots of files in one directory, and is
    17. ; a more efficient layout for servers that handle lots of sessions.
    18. ;
    19. ; NOTE 1: PHP will not create this directory structure automatically.
    20. ;         You can use the script in the ext/session dir for that purpose.
    21. ; NOTE 2: See the section on garbage collection below if you choose to
    22. ;         use subdirectories for session storage
    23. ;
    24. ; The file storage module creates files using mode 600 by default.
    25. ; You can change that by using
    26. ;
    27. ;     session.save_path = "N;MODE;/path"
    28. ;
    29. ; where MODE is the octal representation of the mode. Note that this
    30. ; does not overwrite the process's umask.
    31. ;session.save_path = "/tmp"
    32.  
    33. ; Whether to use cookies.
    34. session.use_cookies = 1
    35.  
    36. ;session.cookie_secure =  
    37.  
    38. ; This option enables administrators to make their users invulnerable to
    39. ; attacks which involve passing session ids in URLs; defaults to 0.
    40. ; session.use_only_cookies = 1
    41.  
    42. ; Name of the session (used as cookie name).
    43. session.name = PHPSESSID
    44.  
    45. ; Initialize session on request startup.
    46. session.auto_start = 0
    47.  
    48. ; Lifetime in seconds of cookie or, if 0, until browser is restarted.
    49. session.cookie_lifetime = 0
    50.  
    51. ; The path for which the cookie is valid.
    52. session.cookie_path = /
    53.  
    54. ; The domain for which the cookie is valid.
    55. session.cookie_domain =
    56.  
    57. ; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript.
    58. session.cookie_httponly =  
    59.  
    60. ; Handler used to serialize data.  php is the standard serializer of PHP.
    61. session.serialize_handler = php
    62.  
    63. ; Define the probability that the 'garbage collection' process is started
    64. ; on every session initialization.
    65. ; The probability is calculated by using gc_probability/gc_divisor,
    66. ; e.g. 1/100 means there is a 1% chance that the GC process starts
    67. ; on each request.
    68.  
    69. session.gc_probability = 1
    70. session.gc_divisor     = 100
    71.  
    72. ; After this number of seconds, stored data will be seen as 'garbage' and
    73. ; cleaned up by the garbage collection process.
    74. session.gc_maxlifetime = 1440
    75.  
    76. ; NOTE: If you are using the subdirectory option for storing session files
    77. ;       (see session.save_path above), then garbage collection does *not*
    78. ;       happen automatically.  You will need to do your own garbage
    79. ;       collection through a shell script, cron entry, or some other method.
    80. ;       For example, the following script would is the equivalent of
    81. ;       setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
    82. ;          cd /path/to/sessions; find -cmin +24 | xargs rm
    83.  
    84. ; PHP 4.2 and less have an undocumented feature/bug that allows you to
    85. ; to initialize a session variable in the global scope, albeit register_globals
    86. ; is disabled.  PHP 4.3 and later will warn you, if this feature is used.
    87. ; You can disable the feature and the warning separately. At this time,
    88. ; the warning is only displayed, if bug_compat_42 is enabled.
    89.  
    90. session.bug_compat_42 = 1
    91. session.bug_compat_warn = 1
    92.  
    93. ; Check HTTP Referer to invalidate externally stored URLs containing ids.
    94. ; HTTP_REFERER has to contain this substring for the session to be
    95. ; considered as valid.
    96. session.referer_check =
    97.  
    98. ; How many bytes to read from the file.
    99. session.entropy_length = 0
    100.  
    101. ; Specified here to create the session id.
    102. session.entropy_file =
    103.  
    104. ;session.entropy_length = 16
    105.  
    106. ;session.entropy_file = /dev/urandom
    107.  
    108. ; Set to {nocache,private,public,} to determine HTTP caching aspects
    109. ; or leave this empty to avoid sending anti-caching headers.
    110. session.cache_limiter = nocache
    111.  
    112. ; Document expires after n minutes.
    113. session.cache_expire = 180
    114.  
    115. ; trans sid support is disabled by default.
    116. ; Use of trans sid may risk your users security.
    117. ; Use this option with caution.
    118. ; - User may send URL contains active session ID
    119. ;   to other person via. email/irc/etc.
    120. ; - URL that contains active session ID may be stored
    121. ;   in publically accessible computer.
    122. ; - User may access your site with the same session ID
    123. ;   always using URL stored in browser's history or bookmarks.
    124. session.use_trans_sid = 0
    125.  
    126. ; Select a hash function
    127. ; 0: MD5   (128 bits)
    128. ; 1: SHA-1 (160 bits)
    129. session.hash_function = 0
    130.  
    131. ; Define how many bits are stored in each character when converting
    132. ; the binary hash data to something readable.
    133. ;
    134. ; 4 bits: 0-9, a-f
    135. ; 5 bits: 0-9, a-v
    136. ; 6 bits: 0-9, a-z, A-Z, "-", ","
    137. session.hash_bits_per_character = 4
    138.  
    139. ; The URL rewriter will look for URLs in a defined set of HTML tags.
    140. ; form/fieldset are special; if you include them here, the rewriter will
    141. ; add a hidden <input> field with the info which is otherwise appended
    142. ; to URLs.  If you want XHTML conformity, remove the form entry.
    143. ; Note that all valid entries require a "=", even if no value follows.
    144. url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
     
  9. Gromo

    Gromo Активный пользователь

    С нами с:
    24 май 2010
    Сообщения:
    2.786
    Симпатии:
    2
    Адрес:
    Ташкент
    Pomaska
    из тех данных, что ты предоставляешь, очень сложно понять причину твоей ошибки - нужно видеть весь код.
     
  10. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    весь код страниц?
    я предоставил все данные хедара... это весь код...
    щас не могу скинуть, но завтра (вечером) скину коды остальных страниц..

    или вам всё содержимое php.ini?
     
  11. Apple

    Apple Активный пользователь

    С нами с:
    13 янв 2007
    Сообщения:
    4.984
    Симпатии:
    2
    Да не при чем тут php.ini
    Конфигурация тут вообще не при чем. Зато вот вывод ошибок отключен, вот и тыкаешь пальцем в небо.
    Логи давай сюда ёпт.
     
  12. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    логи все норм.... там тока что ошибка в картинке пхп и ошибка файла favicon.ico
    а остальные старые..
     
  13. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    я почти разобрался... можете сказать как настроить sendmail, я просто винду переустановил и php несколько раз переустанавливал, и теперь с домашнего компа ничего не отправляется...
    и как включить "показ" ошибок...?
     
  14. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    типа как тут
    http://cs-gtp.levrom.com/

    тут идут ошибки инклудов... я хочу себе на сайт такую же штуку, тока незнаю как включить, а в php.ini копатся не очень хочу...
     
  15. igordata

    igordata Суперстар
    Команда форума Модератор

    С нами с:
    18 мар 2010
    Сообщения:
    32.410
    Симпатии:
    1.768
    в лог смотри. там все есть. нотисы, эрроры. а на страницу их не надо пускать.
     
  16. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    не, мне просто надо чтобы было на странице... а то бывает что я код написал рабочий, но в логе всё время ошибка.. а я хочу уже грамотно научится писать наконец то... (хоть не по русски, но ладно XD)
     
  17. admyx

    admyx Активный пользователь

    С нами с:
    14 мар 2008
    Сообщения:
    2.159
    Симпатии:
    1
    Pomaska

    На время разработки в начало скрипта
    PHP:
    1. <?php
    2. ini_set('display_errors', 'on');
     
  18. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    a в php.ini вписать (если навсегда хочу)
    display_errors = on ?
     
  19. admyx

    admyx Активный пользователь

    С нами с:
    14 мар 2008
    Сообщения:
    2.159
    Симпатии:
    1
    Соответственно, да :)
     
  20. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0
    Всем привет...
    как сделать вот такую вот страницу, что бы был адрес:
    index.php?mode=admin&id=*
    * = любая цыферка..

    проблема в том, что когда ?mode=admin, то просто пустая страница стоновится (там где начинается инклуд _admin.php)..
    как сделать чтобы там где просто mode=admin был вывод всех админов у которых брали интервью, а когда mode=admin&id=*
    то высвечивались вопросы и ответы, и инфа про * админа...

    в файле index.php прописано:
    PHP:
    1. <?php
    2.  if(isset($_GET['mode'])){
    3. switch ($_GET['mode']) {
    4. case 'admin':include('_admin.php');
    5. break;
    6. case 'player':include('_player.php');
    7. break;
    8. case 'clan':include('_clan.php');
    9. break;
    10. case 'vopros':include('_vopros.php');}}
    11. else {echo("
    12. <table cellpadding='0' cellspacing='0' width='100%'>
    13. <tr>
    14. <td class='cs-l'></td>
    15. <td class='cs-c'>Интервью:</td>
    16. <td class='cs-r'></td></tr></table>
    17. <table cellpadding='0' cellspacing='0' width='100%'>
    18. <tr>
    19. <td class='cs-b'>
    20.  Скоро мы будем брать интервью у игроков сервера, у админов других серверов и у кланов нашего сервера.
    21. <br>
    22.  Интнрвью у <a href='?mode=admin'>админов</a><br>
    23.  Интнрвью у <a href='?mode=player'>игроков</a><br>
    24.  Интнрвью у <a href='?mode=clan'>кланов</a><br><br>
    25.  Вопросы интервью <a href='?mode=vopros'>тут</a>
    26.  
    27.  
    28.  
    29.  
    30. </td></tr></table> ");}?>
    а в файде _admin.php
    PHP:
    1. <?
    2. $con = mysql_connect("DBServer","DBUser","DBPass");
    3. if (!$con)
    4.    {
    5.    die('Could not connect: ' . mysql_error());
    6.    }
    7.  
    8. mysql_select_db("DBName", $con);
    9.  if(isset($_GET['id'])){
    10.  $result = mysql_query("SELECT * FROM `intervy_admin` WHERE `id`='$_GET[id]'");
    11.  $row = mysql_fetch_array($result);
    12. switch ($_GET['id']) {
    13. case '$row[id]':echo("
    14. <table cellpadding='0' cellspacing='0' width='100%'>
    15. <tr>
    16. <td class='cs-l'></td>
    17. <td class='cs-c'>Интервью у ".$row[name]."</td>
    18. <td class='cs-r'></td></tr></table>
    19. <table cellpadding='0' cellspacing='0' width='100%'>
    20. <tr>
    21. <td class='cs-b'>
    22. ".$row[foto]."<br><br>
    23. ".$row[vopros1]."? <br> ".$row[otvet1]."<br><br>
    24. ".$row[vopros2]."? <br> ".$row[otvet2]."<br><br>
    25. ".$row[vopros3]."? <br> ".$row[otvet3]."<br><br>
    26. ".$row[vopros4]."? <br> ".$row[otvet4]."<br><br>
    27. ".$row[vopros5]."? <br> ".$row[otvet5]."<br><br>
    28. ".$row[vopros6]."? <br> ".$row[otvet6]."<br><br>
    29. ".$row[vopros7]."? <br> ".$row[otvet7]."<br><br>
    30. ".$row[vopros8]."? <br> ".$row[otvet8]."<br><br>
    31. ".$row[vopros9]."? <br> ".$row[otvet9]."<br><br>
    32. ".$row[vopros10]."? <br> ".$row[otvet10]."<br><br>
    33.  
    34. ");}}
    35. else {echo("
    36. Пока что интервью нискем не было, но вскоре появится!
    37. ");}
    38.  
    39.  
    40.  
    41.  
    42. </td></tr></table>
    43. <?
    дело всё в if(isset($_GET['id']))
    что делать чтобы было нормальное отображение данных?
    может if($_GET[mode] = admin and isset($_GET[id])) {...}else{..} ????
    помогите как правельно...
     
  21. Pomaska

    Pomaska Активный пользователь

    С нами с:
    8 июн 2010
    Сообщения:
    58
    Симпатии:
    0