jnerotrix Posted January 23, 2009 Share Posted January 23, 2009 is it possible to make a page like this INDEX.php <?php session_start(); ?> <title> View it </title> <center> <table border="1"> <form action="./build.php" method="post"> <tr> <td>Video Url:<input type="text" readonly="1" value="http://www.youtube.com/watch?v=" size="30"><input type="Text" name="url"></td> </tr> <tr> <td>(Number)<input type="text" name="times" value="10"> of Times to Display Video in <input type="text" name="reloadtime" value="5">(Seconds)</td> </tr> <tr> <td>Set Width <input type="text" name="setwidth" value="425"> Set Height <input type="text" name="setheight" value="344"> </tr> <tr> <td align="center" valign="center"><input type="submit" name="action" value="Submit"> <input type="hidden" name="submitted" value="yes"> </td> </tr> </form </table> Build.php <?php session_start(); ?> <title> View it </title> <center> <?php $_SESSION['numtimes'] = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $_SESSION['url'] = $_POST['url']; $_SESSION['reload'] = $_POST['reloadtime']; $_SESSION['w'] = $_POST['setwidth']; $_SESSION['h'] = $_POST['setheight']; $autoplay = "&autoplay=1"; if ($HTTP_POST_VARS["submitted"] == "yes"){ echo "<meta http-equiv='refresh' content='{$_SESSION['reload']}'>"; } for ($i=0; $i < $_SESSION['numtimes']; $i++) { echo "<object width='{$_SESSION['w']}' height='{$_SESSION['h']}'><param name='movie' value='http://www.youtube.com/v/{$_SESSION['url']}&hl=en&fs=1'></param><param name='allowFullScreen' value='false'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/{$_SESSION['url']}&hl=en&fs=1$autoplay' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='false' width='{$_SESSION['w']}' height='{$_SESSION['h']}'></embed></object>"; } ?> and then go to another page automatically after 30 seconds without losing the sessions data? Link to comment https://forums.phpfreaks.com/topic/142100-solved-sessions-help/ Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 You;ve kind of got the right idea. As long as you use session_start() at the top of the page you want to retrieve the data it will all remain in the stored session untill the seesions over (usually about 26 minutes or a browser close) Link to comment https://forums.phpfreaks.com/topic/142100-solved-sessions-help/#findComment-744192 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.