Friday, July 31, 2009

How do I create an "Exit" page for a php script doing registrations and logins?

Basically I have the db setup, the php registration script working. Now I need to figure out how to refer a user to a specific page once the registration/login is complete. Anyone out there able to help?

How do I create an "Exit" page for a php script doing registrations and logins?
Use the header redirect





header ("Location: whateveryourpagetilteis.php")


exit;





Put the exit there so nothing will execute after the redirect. You can use a full URL or a direct relative path to the page. You can also use Java Script to do it:





%26lt;SCRIPT%26gt;


window.location="whateveryourpagetilte...


%26lt;/SCRIPT%26gt;





or





echo "%26lt;SCRIPT%26gt;\n";


echo "window.location='whateveryourpagetiltei...


echo "%26lt;/SCRIPT%26gt;\n";
Reply:Text and a hyperlink can be used to refer a user to another page.
Reply:Ya, we can redirect one page from another page after the registration call the following function.


function exec_refresh()


{


window.status = "Redirecting..." + myvar;


myvar = myvar + " .";


var timerID = setTimeout("exec_refresh();",0);


// 0 means the time to redirect


if (timeout %26gt; 0)


{


timeout -= 1;


}


else


{


clearTimeout(timerID);


window.status = "";





window.location ="./forum.php";


//location for the next page.


}


}


this function should be in the tag.


%26lt;script type="text/javascript"%26gt;


%26lt;/script%26gt;


//this should be in head tag





calling block


%26lt;script%26gt;"exec_refresh();%26lt;/script%26gt;


//this should be in body tag.


No comments:

Post a Comment