Hi frnds...

I have some doubts regarding this PHP...

1)i need to display an add in between two pages.....i.e. when i post data from 1st page to 2nd page than, i want to display an add before redirecting the 2nd page...by using PHP or JavaScript...

2)Can we pass input value by using Javascript Sessions...

3)Can we write php variables in Java script.....


Plz reply asap...if any possiblities give me a suggetions how i can do.......

Dani AI

Generated

Short answer: do not forward raw POSTed credentials through a third‑party ad page. Store only what you need on the server, show the ad from your own origin, then continue—this prevents exposing sensitive form data and avoids cross‑domain leaks.

A safe, practical flow (addresses the OP and ties into previous replies): validate the form on submit, write required fields to a server session, render an interstitial page from your domain that embeds any third‑party ad (iframe or ad script) and shows a short countdown, then redirect the browser to the next route which reads the session and completes processing. That keeps credentials on the server and avoids posting them to an external ad URL. ’s meta‑refresh or ’s overlay are possible ways to time the transition, but prefer a same‑origin page with a JavaScript redirect for better control and accessibility. Note and ’s UX warnings—users dislike forced interstitials; keep them short and clearly labeled.

Clarifications on storage and passing data: there is no built‑in “JavaScript session” that replicates server sessions. Cookies, sessionStorage and localStorage are different tools: cookies are sent with HTTP requests and should use Secure and HttpOnly flags for sessions; sessionStorage/localStorage stay client‑side and must never hold passwords. For passing server values into client JS safely, encode on the server side (JSON) rather than printing raw variables to avoid XSS.

Example (safe server→JS pattern):

<?php
// server side
$jsSafe = json_encode($value);
?>
<script>
var serverValue = <?php echo $jsSafe; ?>;
</script>

Security checklist: always use HTTPS, regenerate session IDs after login, avoid including sensitive data in query strings or third‑party pages, and clear server session data once consumed. If JavaScript is unavailable, provide an accessible fallback (simple informative page with a manual continue link or meta‑refresh as last resort).

Recommended Answers

All 7 Replies

Well it isn't elegant but one way is to first direct the user to the ad page, then in the meta refresh section of the ad page, put in the number of seconds you want the user to stay on the ad page until they are redirected to the second page.

An alternative would be to use a javascript function that on submit shows the ad on the form page (in some kind of overlay possibly) and then after a certain period of time continues the form submission

Member Avatar for Member #120589

You sure you want to do this? I'd bail out on principle if confronted by something like that. Can't you put an ad somewhere "normal"?

Well it isn't elegant but one way is to first direct the user to the ad page, then in the meta refresh section of the ad page, put in the number of seconds you want the user to stay on the ad page until they are redirected to the second page.

Hi khess..

Thanks 4 ur reply...Yah, Surely u r very good...but, I have another doubt here.when we direct to the add page, here i need to post data...if i post data to the add page, than again i need to post data from add page to my next page..is it secure?

Eg:

when we enter our credentials in login page,after submitting form to add page, than i need to get all variables in add page. here is the problem which i phase,...


thanks...

This advertisement is completely unfriendly.
however if you must,
if the top of the interstitial advertising page includes one of those progress bars stating 'Processing your form please wait' (even a fake), you can pretty much put whatever you want on the lower 90% of the page, for ~10 seconds before people get offended

Answers to other questions:
2. Javascript sessions? They don't exist (or it would be a horrible shock if i discovered they do!)
3. Yep! Something like this:

$script = <<<END
<script type="text/javascript">
var myJavascriptVar = $myPhpVar
</script>
END;
print($script);

But be careful: it simply prints the variable $myPhpVar when downloading the page, it wont treat them as the same variable ($myPhpVar never existed, for all your browser knows).

2)Can we pass input value by using Javascript Sessions...

Just to let you know, Javascript Sessions are called Cookies. The client side version of Sessions. More can be found about cookies at http://www.w3schools.com/JS/js_cookies.asp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.