PHP - Moved: Document Expired?
This topic has been moved to Miscellaneous.
http://www.phpfreaks.com/forums/index.php?topic=354333.0 Similar TutorialsI could use some help comparing Dates. I need to check if a Temporary Password has expired, and am a bit shaky on "Date Math". The Temporary Password was created like this... // Build query. $q2 = "UPDATE member SET temp_password=?, temp_reset_on=NOW(), updated_on=NOW() WHERE email=? LIMIT 1"; So how do I see if temp_reset_on is more than 4-hour old and thus expired? Thanks, Debbie This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=334078.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=316747.0 Doesn't change status to expired.
<?php $bannersQuery = 'SELECT * FROM banners WHERE expire > NOW() AND status = "active" ORDER BY RAND() LIMIT 10'; $banners = $db->query($bannersQuery); while($row = $banners->fetch(PDO::FETCH_ASSOC)){ if($row['expire'] <= time()){ $status = 'expired'; }else{ $status = 'active'; } $updateQuery = 'UPDATE banners SET exposures = exposures + 1, status = :status WHERE id = :id'; $update = $db->prepare($updateQuery); $update->bindParam(':status', $status, PDO::PARAM_STR); $update->bindParam(':id', $row['id'], PDO::PARAM_INT); $update->execute(); echo ' <a href="index.php?do=bannerClick&id='.$row['id'].'" target="_BLANK"><img src="'.$row['url'].'" width="'.$row['width'].'" height="'.$row['height'].'" alt="'.$row['title'].'"></a><br>'; } echo ' <a href="index.php?do=buyBanner">Want to advertise your banner? Click here.</a>'; ?> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320005.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=358604.0 Hey all, Im currently working on a site which I save a cookie on users computer for 1 month as well a row in a table with the 1 month expiring date plus cookie id. What I would like to know is if theres a way to make the server check the table every day at say 12pm to see if any corresponding user cookies in each row have expired on that day as to remove them from the table to match the expiring cookie on the users computer? I would like not to have to rely on a user/admin accessing in to make a script run instead have something thats timed to go off automatically instead? Is there anyway of doing this? Thanks! im using dom to tidy up my html but i wondering is there a way to format my html like so
<dl> <dd> <label>Condition :</label> <select name="condition"><option value="New">New</option> </dd> </dl>insead of <dl> <dd> <label>Condition :</label> <select name="condition"><option value="New">New</option> </dd> </dl>here is the php im using $dom = new DOMDocument(); $dom->loadHTML($this->_body); $dom->formatOutput = true; echo $dom->saveHTML();thank you Ive tried <?php $file = file_get_contents('./time.php'); echo $file; ?> This just outputs the php, how can I make it just the out php output value. ty in advance. so I want to know how I could upload a document associated with an event.......with a form upload.......but where do I store it at and make it display in the view page for the event......? Hi Folks, I am trying to scrape the price data from a webpage, but how to get the variable, see here the target http://www.buergerstiftungen.de/cps/rde/xchg/SID-635E10F9-BFA1A4BF/buergerstiftungen/hs.xsl/db.htm Code: [Select] include 'simple_html_dom.php'; $html1 = file_get_html('http://www.buergerstiftungen.de/cps/rde/xchg/SID-635E10F9-BFA1A4BF/buergerstiftungen/hs.xsl/db.htm'); $info1 = $html1->find('b[class=[what to enter herer ]',0); The variable then also contains data such as <b class="info"> info </b> Is there a way to trim the unwanted data out ? I just need all the infos out of the site. I am unsure if I do it during the find, or perhaps when i echo out the variable, then do I specify what I want ? well how t o do it witout a regex but with DOM-Document!? I'm using a here document for the html in my php page. In it I call a function to get the correct value to pass to the form and eventually to the next php page. I'm getting an error:Array to string conversion in. I'm not sure why, maybe I'm escaping the double quotes wrong? or do you need to do something special when the value being submitted is an array?
This line is where the error is, the second table data in the first table row
<td><input name="choice" type="radio" value=\"getCardValues($pyramid, 0,0)\" /></td>in here $output =<<< _HTML_ <!DOCTYPE html> <html> <head> <title>Pyramid Solitaire</title> </head> <body> <div class="main"> <h1>Rock Paper Scissors Game</h1> <form action="rps.php" method="post"> <input type="text" name="name"> <input type="hidden" name="past" value="0"> <table width="20%"> <tr> <td><img src="./images/cards/getCardFile($pyramid, 0,0)" width="100" height="100" /></td> <td><input name="choice" type="radio" value=\"getCardValues($pyramid, 0,0)\" /></td> </tr> for($i = 0; $i < 2; $i++) { <tr> <td><img src="./images/cards/getCardFile($pyramid, 1,$i)" width="100" height="100" /></td> <td><input name="choice" type="radio" value="getCardValues($pyramid, 1,$i)" /></td> </tr> }and so on... This is the function being called: function getCardValues($array, $row, $col) { $valuesHolder = array($array[$row][$col].getFace(), $array[$row][$col].getSuit()); return $valuesHolder; } Edited by 0rangeFish, 11 December 2014 - 01:25 AM. Hi all, I can't get this code to work, if you can tel me what I am doing wrong I would be gratefull. This is my XML file: Code: [Select] <?xml version="1.0" encoding="UTF-8"?> <popis> <student> <prezime>Brkic</prezime> <ime>Ivica</ime> <index>D-142</index> </student> <student> <prezime>Cizek</prezime> <ime>Pero</ime> <index>D-143</index> </student> </popis> This is the form I wanna use to change nodes: <form action="zamjena.php" method="post" enctype="multipart/form-data"> <table> <tr> <td colspan="2"class="labelcell"><label for="ime">Ime:</label></td> <td colspan="2"class="fieldcell"><input type="text" id="ime" name="ime" tabindex="1"/></td> </tr> <tr> <td colspan="2"class="labelcell"><label for="prezime">Prezime:</label></td> <td colspan="2"class="fieldcell"> <input type="text" id="prezime" name="prezime" tabindex="2"/><br /> </td> </tr> <tr> <td colspan="2"class="labelcell"><label for="index">Index:</label></td> <td colspan="2"class="fieldcell"> <input type="text" id="index" name="index" tabindex="3"/> <br /> </td> </tr> <tr> <td colspan="2"class="labelcell"><label for="index">ID:</label></td> <td colspan="2"class="fieldcell"> <input type="text" id="id" name="id" tabindex="4"/> <br /> </td> </tr> <td colspan="4"><input type="submit" name="upload" class="box" value="Zamjeni" tabindex="5" /></td> </table> </form> "id" is the mark which node to change And this is code for changin nodes, I found it on: http://us.php.net/manual/en/domnode.replacechild.php : <?php // Create a new document fragment to hold the new <student> node $student = new DomDocument; $student_node = $student ->createElement('student'); // Add some children $student_node->appendChild($student->createElement('ime', '$_POST['ime']')); $student_node->appendChild($student->createElement('prezime', '$_POST['prezime']')); $student_node->appendChild($student->createElement('index', '$_POST['index']')); // Add the keywordset into the new document // The $student variable now holds the new node as a document fragment $student->appendChild($student_node); ?> Next, we need to locate the old node: <?php // Load the XML $dom = new DomDocument; $dom->loadXML($xml); // Locate the old student node $xpath = new DOMXpath($dom); $nodelist = $xpath->query('/popis/student'); $oldnode = $nodelist->item($_POST['id']); ?> We then import and replace the new node: <?php // Load the $student document fragment into the current document $newnode = $dom->importNode($student->documentElement, true); // Replace $oldnode->studentNode->replaceChild($newnode, $oldnode); // Display echo $dom->saveXML(); ?> thanks for help Hi everyone. I have been looking for a PHP upload script that handles various different document types like PDF, DOC and XLS. So far all I have found is image upload scripts. Can anyone point me in the right direction? I would be most greatful. Thank you! I would like to store weekly reports into documents. I am familiar with storing data to a regular text document, but it does not keep bold text, tables and so forth. Are there any other documents that would not be to hard to output to such as .pdf, .rtf, .doc, etc.? I've attached the current format we are using in excel. Now that I have things automated in php, I would like to output to a document with almost identical formatting. And how can I keep it on 8 1/2" x 11" pages without it splitting data or tables between two pages? Thanks, Jake Hello, I had created a form for users to upload their resumes (only word documents & 1 MB allowed as size), then email it after its been successfully uploaded. Any help? Thanks in advance I've been using php for a while now to create forms, up until now i've always transmitted the form data to a new php document that then processes them. I wanna take this to the next level and start trying to process the data within the same document. I know this has something to do with checking if the submit button is pressed and then processing the submitted data but thats about as far as my knowledge goes. Can anyone help me out on how i can achieve this type of thing. The reason is that i've found a way to execute php code within a joomla 1.6 environment without having to use the iframe option. I know the iframe option may be easier in a way of doing things but its out of the question. The final fase of the php will output code that will trigger a specific joomla plugin to do some specific action. If i pull a php document via an iframe the plugin doesnt trigger as it only gets triggered after the joomla "afterRender" (or something" has executed. If i use the iframe option then that rendering never gets used so the plugin doesnt get triggered. So in a nutshell, i wanna create forms that submit data and that data gets processed in the same document (in this case joomla article). How do i go about doing this. how do I make document upload fields like the ones that are on this website where there is a link at the bottom to make another field appear, or make it so that a new field automatically appears when the first one has info in it. Does this make sense? and also how would i make these submit with the form seeing as that they would have different field names, wouldn't they? This upload form code works successfully, where a file is chosen, renamed and stored in the 'upload' folder, Hey y'all.
I'll gladly admit that I'm not a server guy - I have the utmost respect for people comfortable enough with *nix to handle Apache setup and configuration in a production environment. I can noodle about in *nix typically without killing anything vitally important, but trust me when I say no-one wants me to be a server administrator. That having been said, I do have a development server behind my home network firewall running Ubuntu that I use to test and develop the sites that I create on my separate Windows box. So I try to keep up with the way a shared server would be set up in a real-world situation, to a degree. For instance, I haven't bothered setting up the mail server or FTP, but I do create virtual host files for each of my projects.
So, I've got a virtual host set up on the directory /var/www/myAwesomeSite.com/ with the .conf file containing the following configuration:
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName myAwesomeSite.com DocumentRoot /var/www/myAwesomeSite.com/www <Directory /var/www/myAwesomeSite.com/www> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>Now, in my php scripts echoing out $_SERVER['DOCUMENT_ROOT'] gives me 'myAwesomeSite/www' as I would expect. And using $_SERVER['DOCUMENT_ROOT'] in any require() statements actually does include the requested file, so that part seems to be working fine. My question is this: when I use a leading slash ('/'), shouldn't that equate to the document root? I use it at work all the time and it works flawlessly, but on the dev server I have set up here, it's a no-go. Is there another config command that I need to issue to make it work, or am I crazy? Basically, am I missing a setting somewhere that will make this: require_once('/path/to/my/include.php');work like this? require_once($_SERVER['DOCUMENT_ROOT'].'/to/my/include.php');*edit* I just realized that I used the wrong slash in the title of this post, but I don't see a way to change the topic title. crap. Edited by maxxd, 23 November 2014 - 11:20 AM. |