Jump to content

tourer

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tourer's Achievements

Member

Member (2/5)

0

Reputation

  1. Any help please. I have stuck completly here..
  2. hi friends. i am working on a php which would be added up to the scheduled tasks. This php will compare the Current server time & the endtime fetched from the database. Suppose endtime field consists of 8 values & anyone value is equal to the currnt time, then the php page will execute a script. Here is my humble try so far. But i am able to fetch value, but when i echo the results, the result for all the condition is displayed:_ endtime.php:- <?php date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'XXXX'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'fsdfsd'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); //$Tdate = date('H') * 60 + date('i'); //$site = "http://118.102.191.40/experiments/e1.html"; $Tdate = 720; $sql = "SELECT endtime FROM reservations"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); //Fetch Data and use $row to get fields data While ($row = mysql_fetch_array($result)) { //echo "End Time: ".$row['endtime']; //} if ($Tdate == $row["endtime"]) { echo "Yeah, Gud Going"; //exit($site); } else { echo "Work Hard"; } } ?> the Result it displays:- Work HardWork HardYeah, Gud GoingWork HardWork HardWork Hard This shows that 720 is my 3rd entry from the bottom. Although i want the php to fetch all the table endtime Value's, Compare them with current server time, if any value matches, then a specified html page needs to be exited. Also can some one lead me through this exit stuff. Now this html page is running a swf file. The user books a slot to use this swf file. He mentions a starttime & endtime. Now the entering mechanism i have installed n started up. This endtime php will check the end time & force the html to exit. so is it possible to run some php scheduled for every 5 min, to end a html webpage at any remote PC. Cuz it is running through my Webserver. Can i abort that page whenever i want.....
  3. Hey friends. i am trying to set up a cookie in my php page which needs to be sent to the next page. So as to link both the pages. The first php where the condition will be matched is given below. Here the user enters a resid. Now i also want to enable the function that only if the user enters some value in the resid column, then only the cookie should be set as true. <?php date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'labview'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'phpscheduleit'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); // Make timestamp for today's date $dv = array(); $today = getdate(); $dv['month'] = $today['mon']; $dv['day'] = $today['mday']; $dv['year'] = $today['year']; $default = true; $dv['todayTs'] = mktime(0,0,0, $dv['month'], $dv['day'], $dv['year']); $Tdate = date('H') * 60 + date('i'); $userId = $_POST["resid1"]; [b]if(isset($_POST["resid1"])){ setcookie("validation", "true", time()+(3600), "/"); } else { echo "Please Enter the Resid."; }[/b] $sql = "SELECT resid, start_date, starttime, endtime FROM reservations WHERE resid = '$userId'"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); //Fetch Data and use $row to get fields data if ($dv['todayTs'] == $row["start_date"]){ if($Tdate >= $row["starttime"] && $Tdate < $row["endtime"]) { header("Location: http://118.102.191.40/experiment/e1.html"); } else { echo "This is not your time slot"; }}else { echo "Your slot is booked for some other day"; }}else{ echo "Wrong Reservation id"; } ?> This cookie needs to be sent to different page. This php page calls a swf file. Now the swf file shpuld be called & played only when the php page gets the cookie and that also with a value of true. <?php <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- BEGIN Browser History required section --> <link rel="stylesheet" type="text/css" href="history/history.css" /> <!-- END Browser History required section --> <title></title> <script src="AC_OETags.js" language="javascript"></script> <!-- BEGIN Browser History required section --> <script src="history/history.js" language="javascript"></script> <!-- END Browser History required section --> <style> body { margin: 0px; overflow:hidden } </style> <script language="JavaScript" type="text/javascript"> <!-- // ----------------------------------------------------------------------------- // Globals // Major version of Flash required var requiredMajorVersion = 9; // Minor version of Flash required var requiredMinorVersion = 0; // Minor version of Flash required var requiredRevision = 28; // ----------------------------------------------------------------------------- // --> </script> </head> <body scroll="no"> <script language="JavaScript" type="text/javascript"> <!-- // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) var hasProductInstall = DetectFlashVer(6, 0, 65); // Version check based upon the values defined in globals var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); if ( hasProductInstall && !hasRequestedVersion ) { // DO NOT MODIFY THE FOLLOWING FOUR LINES // Location visited after installation is complete if installation is required var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; var MMredirectURL = window.location; document.title = gaurav.slice(0, 47) + " - Flash Player Installation"; var MMdoctitle = document.title; AC_FL_RunContent( "src", "playerProductInstall", "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", "width", "1021", "height", "610", "align", "middle", "id", "e1", "quality", "high", "bgcolor", "#ffffff", "name", "e1", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer" ); } else if (hasRequestedVersion) { // if we've detected an acceptable version // embed the Flash Content SWF when all tests are passed AC_FL_RunContent( "src", "e1", "width", "1021", "height", "610", "align", "middle", "id", "e1", "quality", "high", "bgcolor", "#ffffff", "name", "e1", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer" ); } else { // flash is too old or we can't detect the plugin var alternateContent = 'Alternate HTML content should be placed here. ' + 'This content requires the Adobe Flash Player. ' + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; document.write(alternateContent); // insert non-flash content } // --> </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="e1" width="1021" height="610" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\blazeds\e1.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\blazeds\e1.swf" quality="high" bgcolor="#ffffff" width="1021" height="610" name="e1" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"> </embed> </object> </noscript> ?> </body>
  4. here is my e1.html file. I am unable to even start. You can please have a look on the previous 2 files and this one which is called finally. Thnx & Regards: <!-- saved from url=(0014)about:internet --> <html lang="en"> <!-- Smart developers always View Source. This application was built using Adobe Flex, an open source framework for building rich Internet applications that get delivered via the Flash Player or to desktops via Adobe AIR. Learn more about Flex at http://flex.org // --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- BEGIN Browser History required section --> <link rel="stylesheet" type="text/css" href="history/history.css" /> <!-- END Browser History required section --> <title></title> <script src="AC_OETags.js" language="javascript"></script> <!-- BEGIN Browser History required section --> <script src="history/history.js" language="javascript"></script> <!-- END Browser History required section --> <style> body { margin: 0px; overflow:hidden } </style> <script language="JavaScript" type="text/javascript"> <!-- // ----------------------------------------------------------------------------- // Globals // Major version of Flash required var requiredMajorVersion = 9; // Minor version of Flash required var requiredMinorVersion = 0; // Minor version of Flash required var requiredRevision = 28; // ----------------------------------------------------------------------------- // --> </script> </head> <body scroll="no"> <script language="JavaScript" type="text/javascript"> <!-- // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) var hasProductInstall = DetectFlashVer(6, 0, 65); // Version check based upon the values defined in globals var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); if ( hasProductInstall && !hasRequestedVersion ) { // DO NOT MODIFY THE FOLLOWING FOUR LINES // Location visited after installation is complete if installation is required var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; var MMredirectURL = window.location; document.title = gaurav.slice(0, 47) + " - Flash Player Installation"; var MMdoctitle = document.title; AC_FL_RunContent( "src", "playerProductInstall", "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", "width", "1021", "height", "610", "align", "middle", "id", "e1", "quality", "high", "bgcolor", "#ffffff", "name", "e1", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer" ); } else if (hasRequestedVersion) { // if we've detected an acceptable version // embed the Flash Content SWF when all tests are passed AC_FL_RunContent( "src", "e1", "width", "1021", "height", "610", "align", "middle", "id", "e1", "quality", "high", "bgcolor", "#ffffff", "name", "e1", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer" ); } else { // flash is too old or we can't detect the plugin var alternateContent = 'Alternate HTML content should be placed here. ' + 'This content requires the Adobe Flash Player. ' + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; document.write(alternateContent); // insert non-flash content } // --> </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="e1" width="1021" height="610" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\blazeds\e1.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\blazeds\e1.swf" quality="high" bgcolor="#ffffff" width="1021" height="610" name="e1" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"> </embed> </object> </noscript> </body> </html>
  5. I'm not sure what your SWF actually contains but if it's important than you should add checks to that as well, or disallow access except through the page. This is what i am trying to initialize. But how to limit the swf. Maybe if we can just disable the webpage opening directly using url then it may solve my purpose....
  6. Hello friends. i have implemented a slot booking system for performing live experiments virtually. The Virtual experiment is a swf file which is called by a html page. Now for performing the experiment, the user has to enter a resid which matches the booking date & time booked by the user. Then the html file is opened. The code for the same is provided below. logintest.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <form name="form1" method="post" action="honda.php"> <table width="400" border="1" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="150">Reservation Id</td> <td><input name="resid1" type="text" id="resid"></td> </tr> <tr> <td width="150"> </td> <td><input type="submit" name="btnLogin" value="Login"></td> </tr> </table> </form> </head> [b]honda.php[/b] <?php date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'XXXX'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'phpscheduleit'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); // Make timestamp for today's date $dv = array(); $today = getdate(); $dv['month'] = $today['mon']; $dv['day'] = $today['mday']; $dv['year'] = $today['year']; $default = true; $dv['todayTs'] = mktime(0,0,0, $dv['month'], $dv['day'], $dv['year']); $Tdate = date('H') * 60 + date('i'); $userId = $_POST["resid1"]; $sql = "SELECT resid, start_date, starttime, endtime FROM reservations WHERE resid = '$userId'"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); //Fetch Data and use $row to get fields data if ($dv['todayTs'] == $row["start_date"]){ if($Tdate >= $row["starttime"] && $Tdate < $row["endtime"]) { [color=green][u][u][b]header("Location: http://58.68.9.203/experiment/e1.html");[/b][/u][/u][/color] } else { echo "This is not your time slot"; } }else { echo "Your slot is booked for some other day"; } }else{ echo "Wrong Reservation id"; } ?> The problem i am facing here is if the url to the html file to be opened is directly pasted in the address bar, then it bypasses the verification of the resid part and opens the swf file directly. My whole idea of automating the system got crushed. Now is there any way or some code which i may include which will enable the html file only when the user came from the previous page or went through the resid check procedure..
  7. hey friends . I have written a code where i want to compare the Server Current Time & Date with the Start_date, starttime & endtime fetched from the database. but i am finding some trouble with the sql query. The sql query for the field resid is working, but its not fetching start_date, starttime & endtime. the resid is entered by the user which is compared withe one in datebase. Aftere which the Start_date & Current date are compared on the backend. The Start_date is stored in a Unix timestamp format. such as for yesterday, it shows 1259778600 as date. and start & end time are converted in minutes, i:e: for 3.00 pm it shows 900 in the DB. Can anyone please help me out of this: <?php date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'labview'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'phpscheduleit'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); //$start_date = 1259865000; //$starttime = 900; //$endtime = 960; // Make timestamp for today's date $dv = array(); $today = getdate(); $dv['month'] = $today['mon']; $dv['day'] = $today['mday']; $dv['year'] = $today['year']; $default = true; $dv['todayTs'] = mktime(0,0,0, $dv['month'], $dv['day'], $dv['year']); $Tdate = date('H') * 60 + date('i'); $userId = $_POST['resid1']; $sql = "SELECT resid, start_date, starttime, endtime FROM reservations WHERE resid = '$userId'"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result)) { if ($dv['todayTs'] == "$start_date"){ if($Tdate >= "$starttime" && $Tdate < "$endtime") { echo "www.localhost/e1.html(user should navigate to this page)"; } else { echo "This is not your time slot"; }}else { echo "Your slot is booked for some other day"; }}else{ echo "Wrong Reservation id"; } ?>
  8. Moreover i need to get these values from the database and compare them to the current server time & date. is there any other function which i am supposed to use. Please help.
  9. The Start_date is stored in a Unix timestamp format. such as for yesterday, it shows 1259778600 as date. and start & end time are converted in minutes, i:e: for 3.00 pm it shows 900 in the DB.
  10. Me too require some shweet little help moderators.
  11. hey friends . I have written a code where i want to compare the Server Current Time & Date with the Start_date, starttime & endtime fetched from the database. but i am finding some trouble with the sql query. The sql query for the field resid is working, but its not fetching start_date, starttime & endtime. the resid is entered by the user which is compared withe one in datebase. Aftere which the Start_date & Current date are compared on the backend. Can anyone please help me out of this: <?php require_once('lib/ReservationTime.class.php'); date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'XXX'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'phpscheduleit'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); // set values to user defined starting day of week $dv = array(); $today = getdate(); $dv['month'] = $today['mon']; $dv['day'] = $today['mday']; $dv['year'] = $today['year']; $default = true; // Make timestamp for today's date $dv['todayTs'] = mktime(0,0,0, $dv['month'], $dv['day'], $dv['year']); $Tdate = date('H') * 60 + date('i'); $userId = $_POST['resid1']; $sql = "SELECT 'resid', 'start_date', 'starttime', 'endtime' FROM reservations WHERE resid = '$userId'"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { if ($dv['todayTs'] == "$start_date"){ if($Tdate >= "$starttime" && $Tdate < "$endtime") { echo "www.localhost/e1.html(user should navigate to this page)"; } else { echo "This is not your time slot"; }}else { echo "Your slot is booked for some other day"; }}else{ echo "Wrong Reservation id"; } ?>
  12. Thank you very much for such a speedy reply. so i made it like below: <?php date_default_timezone_set('Asia/Kolkata'); $date = date('H') * 60 + date('i'); echo "$date"; ?> Thanks Again.
  13. Hey friends. I was looking for a Code which can convert my current server time into minutes: as in if its 12.00 am, it should show 0 minutes, then for 01.00 am it shows 60, till upto 1439 minutes for 11.59 pm. Please anyone can help me. Actually my Mysql DB stores time in minutes format nd somewhere i need to compare the current server time with the time stored in the Database. My Humble try is added below: <?php date_default_timezone_set('Asia/Kolkata'); $T_time = date("H:i:s"); ?>
  14. 1. Here is the function where i will be allowed to consume the slot booked by me. 2. Here i check the unique reservation id, current server time & date. 3. Then i ask the user to enter the Unique reservation id, and i check it against the value of reservation id stored in my database. If it matches then the server sate is measured with the Start_date of the booking and also 4. the server time is matched with the reservation start time & endtime. If the current server time falls in between these two reservation times, then only the user is allowed to move to the real thing for which he booked the slot. This is the code for the above mentioned but it is not working: logintestform.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <!-- Created with the CoffeeCup HTML Editor 2008 --> <!-- http://www.coffeecup.com/ <tr> <td width="150">Start date</td> <td><input name="start_date1" type="int" id="start_date"></td> </tr> <tr> <td width="150">Start Time</td> <td><input name="starttime1" type="int" id="starttime"></td> </tr> --> <!-- Brewed on 11/19/2009 12:46:32 PM --> <head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <form name="form1" method="post" action="testing.php"> <table width="400" border="1" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="150">Reservation Id</td> <td><input name="resid1" type="text" id="resid"></td> </tr> <tr> <td width="150"> </td> <td><input type="submit" name="btnLogin" value="Login"></td> </tr> </table> </form> </head> testing.php <?php date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbuser = 'XXX'; $dbpass = 'XXX'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'phpscheduleit'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); $userId = $_POST["resid1"]; $sql = "SELECT 'resid', 'start_date', 'starttime', 'endtime' FROM reservations WHERE resid = '$userId'; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { //$query1 = "SELECT 'start_date', 'starttime', 'endtime' //FROM reservations"; //$result1 = mysql_query($query1) // or die('Query failed. ' . mysql_error()); $today = date("H:i:s"); $today_date = date("m-d-y"); if ($today_date == 'start_date'){ } elseif($today >= 'starttime' && $today < 'endtime') { echo "www.localhost/e1.html{user should navigate to this page}"; } elseif($today == 'endtime') { echo "www.localhost/index.php" } else{ echo " today is not your booking day" } else { echo "Please check your reservation id"; } } ?>
  15. tourer

    Help!!

    Here the user is entering some unique reservation id which is matched with the same userid stored in the database. Also i select the start date, start time & end time of the slot booked by the user whose values are already stored in the Mysql database. The functionality i require here is to check the reservation id first. Then the start date has to be checked with the current date in the server. Then the following code to be inserted somewhere: if {(servertime=>starttime)&&(servertime<endtime)] { allow the user to go to (www.localhost/XXX.html); if (server=endtime) {close the page} } else echo "It is not your time". Below is the code which i have written so far. I am no gud in php & Mysql. Just in case anyone can help. <?php $dbhost = 'localhost'; $dbuser = 'XXX'; $dbpass = 'XXXX'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'phpscheduleit'; mysql_select_db($dbname,$conn) or die ("could not open db".mysql_error()); if (isset($_POST['resid1']) ) { $userId = $_POST['resid1']; $sql = "SELECT resid,start_date,starttime,endtime FROM reservations WHERE resid = '$userId'"; $result = mysql_query($sql) or die('Query failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { echo "Yah It is Your Time "; } else { echo "Sorry, wrong user resid"; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.