0

Goo day, I am novice with PHP and I get multiple errors: Deprecated: Function session_unregister() is deprecated in /home/content/69/9988669/html/intranet/index.php on line 6

Deprecated: Function session_register() is deprecated in /home/content/69/9988669/html/intranet/index.php on line 20

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/content/69/9988669/html/intranet/index.php:6) in /home/content/69/9988669/html/intranet/index.php on line 20

Here is the code of my page:

<?php
session_start();
require '../common.inc';

$msg_err = $_SESSION["msgerr"];
session_unregister("msgerr");

session_unset();
session_destroy();
/*
session_unregister("con");
session_unregister("form_user_id");
session_unregister("form_password");
session_unregister('langue_user');
*/
$form_user_id = "";
$form_password = "";

$numero = $_GET["numero"];
session_register("numero");
?>
Getz
  • 3,914
  • 6
  • 34
  • 52
  • 1
    Read the manual http://php.net/manual/en/function.session-register.php and take it from there. As for headers already sent, make sure you've no output before header. Read this http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php – Funk Forty Niner Mar 31 '15 at 14:16
  • Thanks Fred. Do you see anything that could be wrong in my code? (Also novice in English and as in PHP, so its very hard to get all the information understood) Your frenchie, Karine – Karine Gagnon Mar 31 '15 at 14:24
  • Prego, bienvenue Karine. Voir la reponse ci-dessous (see the answer given below). Et, bienvenue a Stack! (benvenuti a Stack mi amica) ;-) et voir/and see http://stackoverflow.com/questions/3682615/how-to-fix-the-session-register-deprecated-issue – Funk Forty Niner Mar 31 '15 at 14:25
  • PHP.net est aussi disponible en beaucoup de langages, y incluant notre si belle langue francaise http://php.net/manual/fr/function.session-register.php et http://php.net/manual/fr/reserved.variables.session.php – Funk Forty Niner Mar 31 '15 at 14:28

1 Answers1

0

Don't use session_register("numero"); but use $_SESSION['numero'] = ...

Don't use session_unregister("msgerr"); but use unset($_SESSION['msgerr']; or $_SESSION['msgerr'] = NULL;

common.inc probally outputs some html, therefor you get the error message headers already sent but with the changes in this post, the error message should resolve itself

AgeDeO
  • 3,134
  • 2
  • 21
  • 57