Visualizzazione dei risultati da 1 a 8 su 8

Discussione: redirect after header

  1. #1

    redirect after header

    scusate come si fa il redirect ad un altra pagina?
    senza usare header e quindi dopo che sono stati spediti?

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    potresti far scrivere un meta tag nel <head></head> della tua pagina.

    codice:
    <meta http-equiv="refresh" content="0;URL=http://www.google.com">
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  3. #3
    non è quello che mi serve
    praticamente io voglio fare alcune operazioni (creazione file) e poi redigere l'utente ad un altra pagina.
    in asp sarebbe response.redirect()

    già che ci sono...le operazione if(condizione) AND/OR/ (condizione) come si fanno in php?
    grazie ciao

  4. #4
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    in php se hai mandato della roba in output al browser non si può più fare il redirect. Quindi, se quella è la situazione, non ci sono molte altre alternative (via javascript è l'altra). Se invece non hai avuto output a browser, puoi continuare a fare il redirect come

    header("Location: tuapaginadidestinazione.php");

    2)

    if ($sky=="blue" && $still_in_front_of_computer) {
    echo("you must be crazy");
    }
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  5. #5
    allora c'è qualcosa che mi sfugge
    devo per forza mandare la roba al client a pezzi? non posso dirgli ok fai questo e poi questo e poi quest'altro alla fine mandami li.
    tra l'altro mi sfugge perchè nel mio codice in realtà non credo di avergli ancora mandato nulla, voglio dire:

    codice:
    <?php
    error_reporting("55");
    $connection = mysql_connect("localhost" , "rivera" , "rivera");
    $db = mysql_select_db("saf" , $connection);
    $query = "INSERT INTO artist(artist ,sub_title ,page, description ,link , submitted,meta_author ,meta_desc ,meta_key ,born ,dead) VALUES
    ('$_POST[artist]','$_POST[sub_title]','$_POST[page]','$_POST[desc]','/pages/artist/$_POST[letter]/$_POST[link]', now() ,'$_POST[meta_author]' ,'$_POST[meta_desc]' ,'$_POST[meta_key]','$_POST[born]','$_POST[dead]')";
    $result = mysql_query($query);
    $artistinfo = mysql_insert_id();
    mkdir($_SERVER['DOCUMENT_ROOT']."/pages/artist/$_POST[letter]/$_POST[link]/");
    touch($_SERVER['DOCUMENT_ROOT']."/pages/artist/$_POST[letter]/$_POST[link]/index.php");
    $filename = $_SERVER['DOCUMENT_ROOT']."/pages/artist/$_POST[letter]/$_POST[link]/index.php";
    
    $somecontent .= "<?php \n";
    $somecontent .= "\$connection = mysql_connect(\"localhost\" , \"rivera\" , \"rivera\");\n";
    $somecontent .= "\$db = mysql_select_db(\"saf\" , \$connection);\n";
    $somecontent .= "\$query = \" SELECT * FROM artist WHERE artistid='$artistinfo' \"; \n";
    $somecontent .= "\$result = mysql_query(\$query);\n";
    $somecontent .= "\$array = mysql_fetch_array(\$result);\n";
    $somecontent .= "?> \n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/head.php\"); ?>\n";
    $somecontent .= "<style type=\"text/css\" media=\"all\"></style>\n";
    $somecontent .= "<meta name=\"author\" content=\"<?=\$array['meta_author']?> - Sound And Freedom\">\n";
    $somecontent .= "<meta name=\"description\" content=\"Sound And Freedom - Music Around the World - <?=\$array['meta_desc']?> \">\n";
    $somecontent .= "<meta name=\"keywords\" content=\"<?=\$array['meta_key']?> sound music mp3 player guitar artist lyrics tabs\">\n";
    $somecontent .= "<title>SoundAndFreedom.com - <?=\$array['artist']?></title>\n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].'/include/php_pages/body1.php'); ?>\n";
    $somecontent .= "												
    
    <h1><?=\$array['artist']?></h1></p>\n";
    $somecontent .= "												
    
    <h2><?=\$array['sub_title']?></h2></p>\n";
    $somecontent .= "												
    
    <img class=\"gimg\" src=\"<?=\$array['imgsrc']?>\" alt=\"[ <?=\$array['title']?> image ]\"><a class=\"dlink\" href=\"<?=\$array['imgsrc']?>\">d</a><?=\$array['page']?>";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/body2.php\"); ?>\n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/wiewnews.php\"); ?>\n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/body3.php\"); ?>\n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/wiewextras.php\"); ?>\n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/body4.php\"); ?>\n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/bestlinks.php\"); ?>\n";
    $somecontent .= "<?php include(\$_SERVER['DOCUMENT_ROOT'].\"/include/php_pages/bottom.php\"); ?>\n";
    
    $handle = fopen($filename, 'r+');
    fwrite($handle, $somecontent);
    header("Location: addartistimage?id=".$artistinfo."&location=".$_SERVER['DOCUMENT_ROOT']."/pages/artist/$_POST[letter]/$_POST[link]/");
    ?>
    dovè che mando qualcosa? :master:

  6. #6
    aehm questo && è AND o OR?

  7. #7
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    Sei sicuro di non avere righe vuote prima di <?php in alto ?
    Basta anche uno spazio bianco perché venga interpretato come output a browser.

    Per quanto riguarda gli operatori logici, sono sempre quelli:

    http://it.php.net/manual/it/language.operators.php

    http://it.php.net/manual/it/language...rs.logical.php
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  8. #8
    già che ci sono, le session di .net e asp non sono le session di php vero?
    come si crea una sessione ovvero se ad esempio voglio registrare username e password inviati da un determinato client in due variabili per un determinato periodo di tempo quando naviga nelle pagine protette?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.