Problème redirection

page 1 page 2
Répondre
Morganpog
Morganpog
Déconnecté
Bonjour,
J'ai un problème avec mon header.
Ce bout de code et sur toutes les pages mais il ne fonctionne pas correctement par quoi le remplacer ?

session_start();
$_SESSION['login'] = $_POST['login'];
header('Location: http//:www.monsite.com/membre/membre.php');
Morganpog
Morganpog
Déconnecté
Je voudrai mettre un chemin absolu a la place de http//:www.monsite.com/
j'ai vu que l'on pouvais mettre ceci $_SERVER['HTTP_HOST'] , j'ai essayer de le placer à plusieur endroit mais rien ne se passe.
diablo
diablo
Déconnecté
.:[ UTB ]:. Diablo xo0 Au royaume des aveugles, les bornes sont rois...
  1. <?php
  2. $_SESSION['login'] = $_POST['login'];  
  3. ?>
  4.  


$_POST est défini sur toutes les pages ?

Sinon,

  1. <?php
  2. header('Location: /membre/membre.php');  
  3. ?> 


Devrait suffire non ?
Morganpog
Morganpog
Déconnecté
non car j'utilise un modèle et il me faudrait un chemin absolu pour qu'il retrouve la page à tous les endrois du site

J'ai essayer ca mais ca ne fonctionne pas.

<?php
header('Location: http://www.monsite/membre/membre.php');
?>
LA GLOBULE
LA GLOBULE
Déconnecté
111 111 111 x 111 111 111 = 12 345 678 987 654 321
Ben pourtant ça fonctionne ça.

Tu ne dois pas faire exactement ça :)
Morganpog
Morganpog
Déconnecté
voici le code de mon fichier de connection.

http://www.lephpfacile.com/wall/wall-1547.php

En local j'avais mi header("Location: http://127.0.0.1/memb.membre.php"); et ca fonctionner parfaitement et dés que je l'ai mis sur le serveur il ne m'affiche pas la page membre
Tiller
Tiller
Déconnecté
Sur le serveur t'as pas mis "127.0.0.1"?

Si tu l'as mis, remplace par le domaine en question
Tiller
Tiller
Déconnecté
Désolé comme d'habitude je parle trop vite -_-'

J'avais pas lu tout tes messages :x

Bref, as-tu, juste pour essayer, essayer avec un autre navigateur?
Peut etre que t'as un bug de navigateur car le code est bon :x

La seul façon que ton code marche pas est que tu es un message d'erreur php avant.
Morganpog
Morganpog
Déconnecté
je viens d'essayer avec mozilla et ca fait exactement pareil et je n'est meme pas d'erreur php.
Ce que je ne comprend pas c'est qu'en local ca fonctionne trés bien mais sur mon serveur non
Morganpog
Morganpog
Déconnecté
Quand je me connecte a mon espace membre, je n'arrive pas à acceder à membre/membre.php
mais si je rentre directement l'adresse dans le navigateur j'arrive à y acceder tous en etant connecter à mon espace membre (je ne perd pas la session)
voici en gros à quoi ressemble ma page membre

http://www.lephpfacile.com/wall/wall-1548.php
LA GLOBULE
LA GLOBULE
Déconnecté
111 111 111 x 111 111 111 = 12 345 678 987 654 321
C'est mort, tu as forcement des erreurs PHP (ou alors tu ne les affiches pas) car tu fais des header après avoir écrit du texte (ton <head>).
Tiller
Tiller
Déconnecté
<?php session_start();?>
<?php

Ici aussi c'est mauvais, un saut de ligne entre les ?> et <? correspond a un caractere donc mauvais.
Morganpog
Morganpog
Déconnecté
comment on fais pour afficher les erreur en php car avant j'utilisé easyphp il m'afficher des erreurs mais pas tout a mon avis. Maintenant je suis sur wamp et c'est pareil que easyphp.
Es-ce qu'il faut configurer php ou lui ajouter une extention ??
Et laquel??
LA GLOBULE
LA GLOBULE
Déconnecté
111 111 111 x 111 111 111 = 12 345 678 987 654 321
Non, il suffit de modifier le fichier php.ini.
Notammement la valeur du display_error et l'error_reporting.
Morganpog
Morganpog
Déconnecté
voici comment sont configurer mes deux valeurs.
- display_errors = On [Security]
; With this directive set to off, errors that occur during the execution of
; scripts will no longer be displayed as a part of the script output, and thus,
; will no longer be exposed to remote users. With some errors, the error message
; content may expose information about your script, web server, or database
; server that may be exploitable for hacking. Production sites should have this
; directive set to off.
; - log_errors = On [Security]
; This directive complements the above one. Any errors that occur during the
; execution of your script will be logged (typically, to your server's error log,
; but can be configured in several ways). Along with setting display_errors to off,
; this setup gives you the ability to fully understand what may have gone wrong,
; without exposing any sensitive information to remote users.
; - output_buffering = 4096 [Performance]
; Set a 4KB output buffer. Enabling output buffering typically results in less
; writes, and sometimes less packets sent on the wire, which can often lead to
; better performance. The gain this directive actually yields greatly depends
; on which Web server you're working with, and what kind of scripts you're using.
; - register_argc_argv = Off [Performance]
; Disables registration of the somewhat redundant $argv and $argc global
; variables.
; - magic_quotes_gpc = Off [Performance]
; Input data is no longer escaped with slashes so that it can be sent into
; SQL databases without further manipulation. Instead, you should use the
; function addslashes() on each input element you wish to send to a database.
; - variables_order = "GPCS" [Performance]
; The environment variables are not hashed into the $_ENV. To access
; environment variables, you can use getenv() instead.
; - error_reporting = E_ALL [Code Cleanliness, Security(?)]
; By default, PHP suppresses errors of type E_NOTICE. These error messages
; are emitted for non-critical errors, but that could be a symptom of a bigger
; problem. Most notably, this will cause error messages about the use
; of uninitialized variables to be displayed.


Il y a t'il un champ mal remplit? j'ai mis display_errors sur On
page 1 page 2
Répondre
Accès rapide :

Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Breizh Blog