-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Ahh before you make this as solved, I assume you found a bug and fixed it, as the debug code is ONLY for testing.. if it works you need to get the $_GET values
-
Works okay here, try this (forcing the values to today) <?php date_default_timezone_set('GMT'); $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; //Debug $day = 10; $cMonth = 8; $cYear = 2009; //End debug $today = time(); $request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second if($today > $request_date) { echo "Error, Post date"; // post date }else{ echo 'You are about to book a lesson for <div class="everyday">'.date('j F Y', $request_date ).'</div>'; }
-
Well the file has lines so read the file into an array line by line $lines = file('myfile.txt'); to split them up use explode $lineOneArray = explode(" ", $lines[1]); that's all you really need to know to do what your attempting!
-
considering the code I posted has 6 parameter I'll have to assume you did something wrong, can you post what you have, also do you want the error if its the same day ? as my first code doesn't return an error on the same day but the 2nd code will!
-
See updated line <?php $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; $today = time(); $date = mktime(0,0,0,$cMonth,$day,$cYear)-1; //updated if($today > $date) { echo "error"; // post date } ?>
-
ahh okay just change $day+1 to $day
-
A simple starting point would be something like this try it in its own file and it should update every 5 seconds, just replace the "results" line with a database query etc and you should get the idea <?php if(isset($_GET['Action'])) { switch($_GET['Action']) { case "getData": echo "results: ".time(); //whatever break; } die; } ?> <script language="javascript"> function ajaxFunction(ID, action) { var loaderphp = "<?php echo $_SERVER['PHP_SELF'] ?>"; var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); }catch(e){ // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { document.getElementById(ID).innerHTML = xmlHttp.responseText; } } xmlHttp.open("GET", loaderphp+"?Action="+action,true); xmlHttp.send(null); } setInterval( "ajaxFunction('test','getData')", 5000); //execute function doSomething(), every 5 seconds </script> <div id="test"> </div> Hope it helps
-
try this instead <?php $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; $today = time(); $date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second if($today > $date) { echo "error"; // post date } ?>
-
Here's a basic script I wrote to help people get started Dynamic DropDown PHP/AJAX see the "TRY this by itself first.. (single file)" if you need 3+ drop downs see the 2nd post
-
this is called pagination, however after skimming your code your not using $_GET['s'] ie $s = $_GET['s']
-
setInterval( "doSomething()", 5000 ); //execute function doSomething(), every 5 seconds
-
I think you have an older version as looking at the config.php (I downloaded to help you) you need everything! it also sounds like you have messed around with it so who know what the problem could be now, as the changes your trying to do are not massive changes and should be simple!
-
and what's your latest code
-
No your existing code is giving that error $query=mysql_query("Select * From user_table where pfno='$pfno'") or die (mysql_error()); $result=mysql_query($query); should be $result=mysql_query("Select * From user_table where pfno='$pfno'") or die (mysql_error());
-
The problem is the browser needs to resolve the link which means you can't encrypt it but would could encode it, adding a loader (flash, Java, etc, etc) will make it harder, Now if the contents is on your site then you could just put it in a non public area and use something like readfile($hiddenpath."\".$_SESSION['file']); if the file is on another server then you should use the same idea (pulling the path from a DB or something BUT this will use YOUR bandwidth, if you don't want to use your bandwidth look for a crackable solution ie html/JS solution
-
#1 use code tags #2 what's the problem ?
-
echo("<p> Welcome".$f1); //update (concat string) echo("Department:".$f3); //update (concat string) $i++; } //Add (end the while block)
-
I have already said its check_user($secret_key, $db) you can see both are set in the config.php file! Erm..are you sure you know what your doing ? userid is set in a session! so I'll assume its being set earlier in the code!
-
Your welcome Your get used to it and prefer them after a while just remember that $this->id = $id is only needed if you intend to use the ID later in the class without passing it again
-
check_user is in the function.php thats included in the lib.php which also included the config.php
-
okay your trying to echo $this->id but you havn't set it, $id has been passed but its not set to $this->id The reason for the missing an argument is because your not setting it.. when a function name has the same name as the class the function is called during the construction stage so $openclose = new showHide(); is calling the function and you can see your not setting a var! so a simple fix would be <?php $openclose = new showHide(40); //construction echo "<br>".$openclose->WhatsTheID(); //another function class showHide { private $id; private $returnResults; public function showHide($id){ //construction //pass the var global $contacts; // Bring in MySQL DB Link //we will use this in other places so we will set it to the private id $this->id = $id; //set private var to passed one echo $this->id; return; $query = "SELECT * FROM contacts WHERE contact_id = $this->id"; $result = mysql_query($query, $contacts) or die("ERROR: Unable to fetch field value: \n" . mysql_error()); $this->returnResults = mysql_fetch_assoc($result); echo $this->returnResults['contact_primary'] . ' - ' . $this->returnResults['contact_id']. '<br />' ; } function WhatsTheID() { return $this->id; } } ?>
-
your welcome (psst theirs a topic solved button in the bottom left)
-
Okay as i haven't used that system before this is partly guess work but i think $db = new $query = $db->execute("select * from `users` where `username`=?", array($_SESSION['userid'])); return $users; if ($users->pole < 1) should be something like require_once("lib.php"); $users = check_user($secret_key, $db); $query = $db->getone("select * from `users` where `username`=?", array($_SESSION['userid'])); if ($query['pole'] < 1)
-
Well that statement kills my ideas.. maybe magic ? <?php $form = new form; unset($form); //add this here will fire the destruct ?> </body> </html>