Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. with cgi refresh webpage if...(in c/c++)

with cgi refresh webpage if...(in c/c++)

Scheduled Pinned Locked Moved Web Development
c++
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    porac69
    wrote on last edited by
    #1

    hi, does anyone know how i can refresh a webpage only if a certain variable is equal to some value in particular: ex-> int a; //get a from user using scanf if(a==7) //refresh webpage else //printf a message thanks porac69

    A 1 Reply Last reply
    0
    • P porac69

      hi, does anyone know how i can refresh a webpage only if a certain variable is equal to some value in particular: ex-> int a; //get a from user using scanf if(a==7) //refresh webpage else //printf a message thanks porac69

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      I wrote a nice long reply originally but accidently closed the damn window... Basically...what I suggested is you to execute to redirects.. Original to temp Temp to original using:

      if(a==10){
      printf("Location: http://www.domain.com/script2.cgi");
      printf("Location: http://www.domain.com/script1.cgi");
      }

      You could maybe try redirecting to the exact same page using the SCRIPT_NAME environment variable...if that is what its called...??? You will have to let the browser know not to use it's cached version though with the following headers I stole from a PHP script I have:

      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
      header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
      header("Cache-Control: no-store, no-cache, must-revalidate");
      header("Cache-Control: post-check=0, pre-check=0", false);

      gmdate() is a PHP function you'll have to find the equivelant in the CRT or library your using... Replace header() with printf() HTH Cheers :) How do I print my voice mail?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups