Warning: session_start()

Secţiune dedicată începatorilor.

Moderatori: Moderatori, Start Moderator

AlexVD
New Member
Mesaje: 3
Membru din: Joi Mai 05, 2016 11:11 pm

Warning: session_start()

Mesajde AlexVD » Sâm Sep 03, 2016 5:00 pm

Buna Ziua !

Am intampinat urmatoare eroare :
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/public_html/_include-config.php:1) in /home/public_html/_include-config.php on line 35

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/public_html/_include-config.php:1) in /home/public_html/_include-config.php on line 35

Fatal error: Call to undefined function quote_smart() in /home/public_html/_include-config.php on line 83


COD

Cod: Selectaţi tot

ENDHTML;
    exit;
  }

  include("_include-funcs.php");
session_start();
  if(isset($_SESSION['login'])) {
    $dbres                                = mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup`,UNIX_TIMESTAMP(`online`) AS `online` FROM `users` WHERE `login`='{$_SESSION['login']}'");
    $data                                = mysql_fetch_object($dbres);
  }



  if(((count($_POST) > 0 && !isset($_POST['omnilog'])) || ($_POST['omnilog'] == 1 && count($_GET) > 1)) && isset($OMNILOG)) {
    $forwardedFor                        = ($_SERVER['HTTP_X_FORWARDED_FOR'] != "") ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['HTTP_CLIENT_IP'];
    $forwardedFor                        = preg_replace('/, .+/','',$forwardedFor);
    $postVars                                = addslashes(var_export($_POST,TRUE));
    if($postVars == "array (\n)" || (count($_POST) == 1 && isset($_POST['omnilog'])))
      $postVars                                = "";
    $getVars                                = addslashes(var_export($_GET,TRUE));
    if($getVars == "array (\n)")
      $getVars                                = "";
    mysql_query("INSERT INTO `[omnilog]` VALUES(NOW(),'{$_COOKIE['login']}','{$_SERVER['REMOTE_ADDR']}','$forwardedFor','{$_SERVER['PHP_SELF']}','$postVars','$getVars')");
    mysql_query("INSERT INTO `[omnilog2]` VALUES(NOW(),'{$_COOKIE['login']}','{$_SERVER['REMOTE_ADDR']}','$forwardedFor','{$_SERVER['PHP_SELF']}','$postVars','$getVars')");
  }

  foreach($_POST as $key => $value) {
    if(gettype($_POST[$key]) == "array")
      foreach($_POST[$key] as $key2 => $value2) {
        $_POST[$key][$key2]                = addslashes($_POST[$key][$key2]);
        $_POST[$key][$key2]                = quote_smart($_POST[$key][$key2]);
    } else {
      $_POST[$key]                        = addslashes($_POST[$key]);
      $_POST[$key]                        = quote_smart($_POST[$key]);
      }
  }
  foreach($_GET as $key => $value) {
    if(gettype($_GET[$key]) == "array")
      foreach($_GET[$key] as $key2 => $value2) {
        $_GET[$key][$key2]                = addslashes($_GET[$key][$key2]);
        $_GET[$key][$key2]                = quote_smart($_GET[$key][$key2]);
    } else {
      $_GET[$key]                        = addslashes($_GET[$key]);
      $_GET[$key]                        = quote_smart($_GET[$key]);
  }
  }
  foreach($_COOKIE as $key => $value) {
    if(gettype($_COOKIE[$key]) == "array")
      foreach($_COOKIE[$key] as $key2 => $value2) {
        $_COOKIE[$key][$key2]                = addslashes($_COOKIE[$key][$key2]);
        $_COOKIE[$key][$key2]                = quote_smart($_COOKIE[$key][$key2]);
    } else {
      $_COOKIE[$key]                        = addslashes($_COOKIE[$key]);
      $_COOKIE[$key]                        = quote_smart($_COOKIE[$key]);
  }
  }

  $clientIP                                = $_SERVER['REMOTE_ADDR'];
  $dbres                                = mysql_query("SELECT `id` FROM `users` WHERE `IP`='$clientIP' AND `level`<='-50'");
  if(mysql_num_rows($dbres) != 0) {
    print <<<ENDHTML
   


Ma puteti ajuta si pe mine va rog ?



GeorgeValentin
PHPRomania Supporter
Mesaje: 16
Membru din: Mie Aug 03, 2016 11:33 pm

Re: Warning: session_start()

Mesajde GeorgeValentin » Sâm Sep 03, 2016 8:06 pm

session_start ar trebuii apelat inainte ca php sa printeze ceva, adica ar trebuii inainte de inceperea codului <head> sau chiar <html>

Avatar utilizator
Birkoff
Senior Member
Mesaje: 6380
Membru din: Joi Mar 18, 2004 2:34 pm
Localitate: Bucuresti
Contact:

Re: Warning: session_start()

Mesajde Birkoff » Mar Sep 06, 2016 1:20 am

discutii despre eroarea asta sunt in forum de cand am aparut eu pe aici (mai bine de 6-7 ani) ai cautat si tu inainte sa intrebi?
1) CMS, ERP, CRM, etc... (doar pentru clienti))
2) Portofoliu, servicii, contact, blog
3) Folositi aceasta clasa sql in proiectele voastre (open source)
4) Vrei un magazin virtual la cheie, usor de folosit, cu api-uri incluse pentru maximizarea vanzarilor si multe alte facilitati? Da un semn si discutam.


Înapoi la “PHP Incepători”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 70 vizitatori