Jump to content

Debbie-Leigh

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Debbie-Leigh

  1. Hi, I'm trying to extract start and end dates as the delimiters of different periods. I would like them to be on the same row, but I can't figure out how to do it. The query I'm using is: -- This select gets the start and end dates, but on different rows SELECT date AS start_date , date_sub(date, interval 1 second) AS end_date FROM log WHERE date(date) >= '2013-06-10 00:00:00' AND date(date) < '2013-06-16 23:59:59' AND type in (1,2,3) GROUP BY date(date), type UNION -- This next one gets the end date for the last date in the period SELECT date_sub(date, interval 1 second) AS end_date , date from ( SELECT date FROM log WHERE date(date) > '2013-06-16 23:59:59' AND type IN (1,2,3) GROUP BY date(date), type LIMIT 1 ) AS next_one ORDER BY start_date An example of the data I'm working with is: date type 2013-06-06 13:05:44 1 2013-06-13 15:34:45 2 2013-06-13 15:31:08 1 2013-06-20 13:10:32 1 2013-06-27 14:05:16 1 2013-07-04 13:58:14 1 The result I'm currently getting is: start_date end_date 2013-06-13 15:31:08 2013-06-13 15:31:07 2013-06-13 15:34:45 2013-06-13 15:34:44 2013-06-20 13:10:31 2013-06-20 13:10:32 So now the end date for row 1 is in row 2 and the one for row 2 is in row 3 etc. Does anyone know of a technique to get the end date in row 2 to appear in row 1 i.e. against the one it relates to? Debbie
  2. Hi, Has anyone else run foul of the IP loopback restriction rule that shared server hosting companies seem to have been implementing? I've been told by my hosting company that it's to stop programming loops from occurring, but IMHO, there are far more common ways to create coding loops etc. that could slow a server down than calling a program on another website on the same server, which then calls back to the same program on the originating website. It seems to me that this one rule can end up preventing a lot of quite legitimate web programming from happening, unnecessarily. For example, you may want to park a domain on a sub-domain, which could then call a module on the main domain to retrieve some database info for display, which you would quite legitimately need to use the main domain's full url for, instead of either a relative url or a full path url - not with this rule. Or you might provide a service that other websites (which could be owned by you or other people) could call from code to retrieve information to display on their pages. With the loopback rule in place, if any of the calling websites reside on the same web server as the called website, which is entirely possible with the larger hosting companies, then this won't be allowed either. Of course, with enough thought, work arounds can always be found, but it just seems to me that this is an unnecessary rule too far. Does anyone know how this rule came into being (e.g. was it a theoretical problem dreamt up by an academician or a real problem experienced by a hosting company) and why the hosting companies seem to be so fixated on it, when, IMHO, it is a rule that can cause far more problems than it solves? Debbie
  3. Hi, At long last, I've managed to figure out how to emulate the HTML cellspacing attribute in CSS. So I thought that I'd post it here so everyone can use it. Here's the code: .cellspacing td { border-right : 3px solid #FFF; } .cellspacing td:last-child { border-right : 0px; } .cellspacing th { border-right : 3px solid #FFF; } .cellspacing th:last-child { border-right : 0px; } Just add the cellspacing class to a table tag and it creates a white 3px border between each column throughout the table. It's a shame the CSS designers haven't made this easier by having a proper built-in cellspacing attribute, but until they do, this is the next best thing, I guess. Enjoy. Debbie
  4. Yes, agreed. It does work. Hmmm, I guess I have a bunch more debugging ahead of me. Trouble is, I've run out of ideas. Oh well, onwards and upwards. Thanks for the help, anyway.
  5. Hi, I'm trying to get top both corners of my table header row to have a rounded corner each, but only one is appearing. The HTML is: <tr> <td width="12%" class="tbl-col cnr-tl">Col 1</td> <td width="20%" class="tbl-col">Col 2</td> <td width="20%" class="tbl-col">Col 3</td> <td width="30%" class="tbl-col">Col 4</td> <td width="12%" class="tbl-col cnr-tr">Col 5</td> </tr> and the css is: .tbl-col { background-color : #FFDA99; color : #C00000; font-size : 15px; font-style : italic; font-weight : bold; height : 25px; text-align : center; } .cnr-tl { border-top-left-radius : 10px; -moz-border-radius-topleft : 10px; -webkit-border-top-left-radius : 10px; } .cnr-tr { border-top-right-radius : 10px; -moz-border-radius-topright : 10px; -webkit-border-top-right-radius : 10px; } When the styles are in this order, the right hand column has a rounded corner, but if you swap the order of .cnr-tl and .cnr-tr, the left hand column has a rounded corner, but I can't get both end columns to have rounded corners at the same time. Putting both corner styles on one column does work, though, but I'd like to have both end columns to have rounded corners and the middle columns to have straight corners. Does anyone know how to do this? Debbie
  6. Hi, I'm trying to include some text within a div, but the last line always seems to fall outside the bottom border. An image of what it looks like is attached. Here's the html I'm using: <div class="tbl-row <?php echo ($intRow % 2 == 0) ? ("tbl-row-odd") : ("tbl-row-even"); ?>"> <div class="title-lbl">Site: </div> <div class="title-text"><?php echo $aCols["site_name"]; ?></div> <img src="{ImgSpacer}" alt="" width="1" height="20" /><br /> <div class="contents-text"><?php echo nl2br($aCols["contents"]); ?></div> <div> <span class="subon-text"><?php echo $aCols["local_time"]; ?></span> <span class="subon-lbl"> at: </span> <span class="subon-text"><?php echo $aCols["local_date"]; ?></span> <span class="subon-lbl"> on: </span> <span class="subby-text"><?php echo $aCols["full_name"]; ?></span> <span class="subby-lbl">Submitted by: </span> </div> </div> and here's the css: .contents-text { color : #F98537; font-size : 15px; text-align : left; } .tbl-row { border-radius : 15px; -moz-border-radius : 15px; -webkit-border-radius : 15px; margin-left : auto; margin-right : auto; padding : 8px; vertical-align : top; width : 96%; } .tbl-row-even { background-color : #FFEBCB; } .tbl-row-odd { background-color : transparent; } .subby-lbl { color : #F98537; display : inline; float : right; font-size : 15px; vertical-align : top; } .subby-text { color : #F0F; display : inline; float : right; font-size : 15px; vertical-align : top; } .subon-lbl { color : #F98537; display : inline; float : right; font-size : 15px; vertical-align : top; } .subon-text { color : #F0F; display : inline; float : right; font-size : 14px; vertical-align : top; } After much testing, I've found that it's the floats that seem to be causing the problem. When I take them out, the row is included within the outside div, but when I put them back in, the row falls outside. I need to keep the floats, because I would like to have the "Submitted" row aligned to the right, unless there's another way to achieve the same effect. So, does anyone know how I can have the last row right-aligned and included within the surrounding div? Debbie [attachment deleted by admin]
  7. Hi, I have an ajax script that I would like to use to retrieve a password hint from a database. Both the ajax script and the php retrieval script are stored on the same domain (we'll call it domain1.com), but the ajax script runs on another domain (domain2.com). All the scripts are working fine, individually, but when I try to integrate them, I'm getting a ready state of 4, but an HTTP status of 0. I've traced the code flow and the retrieval script is being called by the ajax script OK and it's echoing all the right stuff, but it's just not getting back to calling ajax routine. I've read that an ajax routine can only call a script that resides on the same domain that it runs on. Is this correct and, if so, does anyone know of a work around, because I really need to be able to store the ajax script on domain1 and run it on domain2? If not, then can anyone suggest why I'm getting an HTTP status of 0, when all the individual components are working fine? Debbie
  8. Hi, OK, problems solved. After an awful lot of trial and error testing, I found that it was the php_snmp.dll module that was causing the error. It was being included in the extensions section at the bottom of the php.ini file, so I deleted the line and the MIBS messages stopped appearing. The 'Error in my_thread_global_end()' message was being caused by the php_netools.dll module, so I deleted that one from the extension list too. Now for the websites not being recognised. Because of the length of time it was taking to track down, I knew it would turn out to be one of those problems that would end up with a very simple solution. And I wasn't disappointed; it was that I had forgetten to restore my hosts file into system32/drivers/etc. How utterly embarrassing, but thank you everyone who helped me eventually get there. Debbie
  9. Hi, I'm having a problem getting Apache to recognise my development websites after I did a Windows reinstall last week. I hadn't changed anything in the Apache folder since before the reinstall, when everything was working fine. The only thing I did was to install Apache as a service and start it - the conf files were exactly as they were before. When I found there was a problem, I did a few trial and error experiments, but got nowhere, so I downloaded the latest Apache build from Apache Lounge (because I need ssl built in too) and replaced the old files with the new ones and transferred my old settings to the new conf files. I still had the same problem. I have found there are some strange error messages appearing in the error.log file: [Mon Sep 22 04:31:06 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] [Mon Sep 22 04:31:07 2008] [notice] Apache/2.2.9 (Win32) mod_ssl/2.2.9 OpenSSL/0.9.8i PHP/5.2.5 mod_perl/2.0.4-dev Perl/v5.10.0 configured -- resuming normal operations [Mon Sep 22 04:31:07 2008] [notice] Server built: Sep 21 2008 10:26:19 [Mon Sep 22 04:31:07 2008] [notice] Parent: Created child process 552 [Mon Sep 22 04:31:08 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] [Mon Sep 22 04:31:09 2008] [notice] Child 552: Child process is running [Mon Sep 22 04:31:09 2008] [notice] Child 552: Acquired the start mutex. [Mon Sep 22 04:31:09 2008] [notice] Child 552: Starting 64 worker threads. [Mon Sep 22 04:31:09 2008] [notice] Child 552: Starting thread to listen on port 80. [Mon Sep 22 04:31:09 2008] [notice] Child 552: Starting thread to listen on port 80. [Mon Sep 22 04:31:21 2008] [notice] Parent: Received shutdown signal -- Shutting down the server. [Mon Sep 22 04:31:21 2008] [notice] Child 552: Exit event signaled. Child process is ending. [Mon Sep 22 04:31:22 2008] [notice] Child 552: Released the start mutex [Mon Sep 22 04:31:23 2008] [notice] Child 552: All worker threads have exited. Error in my_thread_global_end(): 1 threads didn't exit [Mon Sep 22 04:31:28 2008] [notice] Child 552: Child process is exiting Cannot find module (IP-MIB): At line 0 in (none) Cannot find module (IF-MIB): At line 0 in (none) Cannot find module (TCP-MIB): At line 0 in (none) Cannot find module (UDP-MIB): At line 0 in (none) Cannot find module (SNMPv2-MIB): At line 0 in (none) Cannot find module (SNMPv2-SMI): At line 0 in (none) Cannot find module (UCD-SNMP-MIB): At line 0 in (none) Cannot find module (UCD-DEMO-MIB): At line 0 in (none) Cannot find module (SNMP-TARGET-MIB): At line 0 in (none) Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none) Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none) Cannot find module (UCD-DLMOD-MIB): At line 0 in (none) Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none) Cannot find module (SNMP-MPD-MIB): At line 0 in (none) Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none) Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none) Cannot find module (SNMPv2-TM): At line 0 in (none) [Mon Sep 22 04:31:28 2008] [notice] Parent: Child process exited successfully. Error in my_thread_global_end(): 1 threads didn't exit So, I have two questions: 1. Does anyone know whether the 'Error in my_thread_global_end()' or the 'Cannot find module' messages would be the cause of my websites not being found? 2. Can anyone let me know what the 'Cannot find module' messages mean and how to fix them? Debbie
  10. Hi, I have a problem with an ajax triggered field in Firefox. The ajax it is working fine, but there seems to be a very curious thing happening in Firefox that doesn't happen in the other browsers. When I change the field value in the browser (not from within code) from nothing to something, the field doesn't trigger. However, any other combination (i.e. from a value to another value or from a value to spaces), does trigger the field. Has anyone come across this behaviour with Firefox and found a solution to it? Debbie
  11. Hi thorpe, Thank you for the code. I guess I'll have to continue looking for something I can use on both platforms. Mencoder has been mentioned on another forum. Would this be something that might do what I need? Debbie
  12. Hi thorpe, Could you show me the command you used to combine the two mpegs? The other thing that it seems I have to do, is that I would have to compile ffmpeg myself, both on my development machine (windows) and on my hoster's machine (linux). Two problems here: 1. I've tried compiling source like this before on my windows machine and completely failed, so I have no real idea how to achieve this. 2. I won't be able to compile anything on my hoster's machine, because they don't allow this kind of activity. I would preferably like to download a pre-compiled version of ffmpeg that I can just upload directly to my hosting account, so it is ready to use. Do you know if I could find a pre-compiled version anywhere? Debbie
  13. Hi thorpe, Is this a linux command that can be executed from php? Also, from what I've read so far, it may not be as simple as just concatenating files, because video files have headers that need to be deleted for subsequent files and reworked for the first file in the sequence. I don't know how accurate this is or whether it is true for all video/audio files. Is this true or can files just be concatenated, because I would really love it, if it really is that simple. Debbie
  14. Hi thorpe, I've looked at the documentation of ffmpeg, but I couldn't see any option that allowed more than one input file to be combined into one output file. Could you tell me if you know whether ffmpeg allows more than one input file or is only for doing audio/video file type conversions? Debbie
  15. Hi, I would like to add a feature to my site that combines two video files together and makes the result available for download. So I've been trying to find somewhere that describes how to do this with code (I use php), but so far haven't been able to find anything. Can anyone tell me how I can do this (either with code or by installing a program on my server that I can call from code to do the combining of the videos) or point me in the right direction to learn how to do it myself? Debbie
  16. Hi, I would like to add a feature to my site that combines two video files together and makes the result available for download. So I've been trying to find somewhere that describes how to do this with code (I use php), but so far haven't been able to find anything. Can anyone tell me how I can do this (either with code or by installing a program on my server that I can call from code to do the combining of the videos) or point me in the right direction to learn how to do it myself? Debbie
  17. Hi, I've now found the solution, which is in this bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=236858, so I thought I'd share what I did with everyone. According to the bug report, the absence of a "content-type text/html; charset=iso-8859-1" header or <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> meta tag in the page causes the browser to use it's default charset, which it may decide is wrong once it gets to process the actual data on the page. This is what causes the browser to re-request the page to be able to process it using the correct charset, hence submitting the form twice. Not the most desirable result, I grant you, but that how it's been designed to work, currently. So, I tried the suggested fix and found that putting both or just the meta tag did solve the problem, but not consistently enough, because it still happened every so often. So, I put in a bit of code to not use the javascript when the browser is Firefox, as that is the only browser in which the problem occurs. <?php if (USER_BROWSER_AGENT <> "FIREFOX"): ?> <script language="JavaScript1.2" type="text/javascript"><!-- <?php require(JS_STOP_THIEF); ?> --></script> <?php endif; ?> USER_BROWSER_AGENT is determined by this code, which I thought might be useful for anyone who doesn't already have something similar: if (!empty($_SERVER["HTTP_USER_AGENT"])): define("USER_AGENT", $_SERVER["HTTP_USER_AGENT"]); elseif (!empty($HTTP_SERVER_VARS["HTTP_USER_AGENT"])): define("USER_AGENT", $HTTP_SERVER_VARS["HTTP_USER_AGENT"]); else: define("USER_AGENT", ""); endif; if (strstr(USER_AGENT, "Win")): define("USER_OS", "Win"); elseif (strstr(USER_AGENT, "Mac")): define("USER_OS", "Mac"); elseif (strstr(USER_AGENT, "Linux")): define("USER_OS", "Linux"); elseif (strstr(USER_AGENT, "Unix")): define("USER_OS", "Unix"); elseif (strstr(USER_AGENT, "OS/2")): define("USER_OS", "OS/2"); else: define("USER_OS", "Other"); endif; if (ereg("Opera(/| )([0-9].[0-9]{1,2})", USER_AGENT, $aMatches)): define("USER_BROWSER_VER", $aMatches[2]); define("USER_BROWSER_AGENT", "OPERA"); elseif (ereg("MSIE ([0-9].[0-9]{1,2})", USER_AGENT, $aMatches)): define("USER_BROWSER_VER", $aMatches[1]); define("USER_BROWSER_AGENT", "IE"); elseif (ereg("OmniWeb/([0-9].[0-9]{1,2})", USER_AGENT, $aMatches)): define("USER_BROWSER_VER", $aMatches[1]); define("USER_BROWSER_AGENT", "OMNIWEB"); elseif (ereg("(Konqueror/)(.*)(", USER_AGENT, $aMatches)): define("USER_BROWSER_VER", $aMatches[2]); define("USER_BROWSER_AGENT", "KONQUEROR"); elseif (ereg("Mozilla/([0-9].[0-9]{1,2})", USER_AGENT, $aMatches) && ereg("Firefox/([0-9]*)", USER_AGENT, $aMatches2) ): define("USER_BROWSER_VER", $aMatches[1] . "." . $aMatches2[1]); define("USER_BROWSER_AGENT", "FIREFOX"); elseif (ereg("Mozilla/([0-9].[0-9]{1,2})", USER_AGENT, $aMatches) && ereg("Safari/([0-9]*)", USER_AGENT, $aMatches2) ): define("USER_BROWSER_VER", $aMatches[1] . "." . $aMatches2[1]); define("USER_BROWSER_AGENT", "SAFARI"); elseif (ereg("Mozilla/([0-9].[0-9]{1,2})", USER_AGENT, $aMatches)): define("USER_BROWSER_VER", $aMatches[1]); define("USER_BROWSER_AGENT", "MOZILLA"); else: define("USER_BROWSER_VER", 0); define("USER_BROWSER_AGENT", "OTHER"); endif; Hope that helps. Debbie
  18. Hi phpQuestioner, But why? This just submits the frmPay form, which goes to the processor's page, rather than mine. That's the bit that has me foxed. Debbie
  19. Hi, I've written some javascript to stop right-clicking on the page that is displayed by my software as it is re-directing to a browser to a payment processor. However it seems to be having a weird side-effect. It took me days to narrow it down to this script, but it seems to be causing my order page form to be submitted twice when the Submit button is clicked. I have been scratching my head over this for a very long while, but I still can't see how this code could possibly cause a form submission, but through a lot of trial and error testing, I've found that when this code is present, the form is submitted a second time, but when it's absent, the form is submitted only once. The process that happens is that my order page is submitted to a PHP script, which adds the order to my database and sends the dopay.php page back to the browser. This page then forwards the browser to the payment processor's page. Sometimes, it may take a few seconds to get the processor's page, so I added the js script to stop opportunists from looking at the sensitive information in the form that is submitted on the page. Obviously, the determined can always use the others ways, but as the page is only displayed for a few seconds, if that, it's very rarely there long enough to be able to use the other methods. However, when this script is present, I get two orders being added to my database and my test display messages show that it's because my order page php script has been triggered twice. These are the pages involved: The dopay.php page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <SCRIPT><!-- //*************************************************************************** //* This work is the copyright and intellectual property of Deborah Figg. * //* Reproduction by any means is strictly prohibited unless prior written * //* permission is obtained from the copyright holder. * //*************************************************************************** function funGetEvent(evt) { // Return the appropriate event object if (evt == null) { return event; } else { return evt; } } function funKeyPress(evt) { var objEvt = funGetEvent(evt); if (objEvt.which) { var keyChar = String.fromCharCode(objEvt.which); } else { var keyChar = String.fromCharCode(objEvt.keyCode); } if (keyChar == 'U' || keyChar == 'u' || keyChar == 'R' || keyChar == 'r') { alert('Page not available'); return false; } } function funMouseDown(evt) { if (navigator.userAgent.indexOf('Firefox') == -1) { var objEvt = funGetEvent(evt); if (objEvt.which) { var button = objEvt.which; } else { var button = objEvt.button; } if (button > 1) { alert('Page not available'); return false; } } } function funMouseClick(evt) { var objEvt = funGetEvent(evt); if (objEvt.which) { var button = objEvt.which; } else { var button = objEvt.button; } if (button > 1) { alert('Page not available'); return false; } } if (document.captureEvents) { if (Event.KEYPRESS) { document.captureEvents(Event.KEYPRESS|Event.MOUSEDOWN|Event.CLICK); } else { document.captureEvents(1024|1|64); } } document.onkeypress = funKeyPress; document.onmousedown = funMouseDown; document.onclick = funMouseClick; --></SCRIPT> </head> <body onLoad="javascript:document.frmPay.submit()"> <form action="https://www.alertpay.com/payprocess.aspx" method="post" name="frmPay" id="frmPay"> <input name="ap_merchant" type="hidden" value="myid" /> <input name="ap_returnurl" type="hidden" value="myreturnpage" /> <input name="ap_cancelurl" type="hidden" value="mycancelpage" /> <input name="ap_description" type="hidden" value="My description." /> <input name="apc_1" type="hidden" value="myorderid" /> <input name="ap_currency" type="hidden" value="mycurrency" /> <input name="ap_purchasetype" type="hidden" value="item" /> <input name="ap_quantity" type="hidden" value="1" /> <input name="ap_itemname" type="hidden" value="My Product" /> <input name="ap_amount" type="hidden" value="37.00" /> <input name="ap_totalamount" type="hidden" value="37.00" /> </form> </body> </html> As you can see, the form on this page goes to Alertpay, so how on earth can my own order page be submitted twice? The order page form: <form action="order.php" method="post" name="frmOrder" id="frmOrder"> <table width="80%" align="center" cellspacing="0" cellpadding="0"> <tr><td> <fieldset class="ordfrm-fieldset"><legend class="ordfrm-legend">Enter Your Details</legend> <table width="97%" align="center" cellspacing="3" cellpadding="3" class="ordfrm-text-norm"> <tr class="ordfrm-tbl-row ordfrm-tbl-row-even"> <td width="40%" class="ordfrm-tbl-row-hdg"><span class="ordfrm-frm-rqd">* </span>First Name:</td> <td width="60%"> <input name="FirstName" id="FirstName" type="text" size="30" maxlength="50" title="Max length: 50" value="" tabindex="1" class="ordfrm-input" /> </td> </tr> <tr class="ordfrm-tbl-row ordfrm-tbl-row-odd"> <td class="ordfrm-tbl-row-hdg"><span class="ordfrm-frm-rqd">* </span>Last Name:</td> <td> <input name="LastName" id="LastName" type="text" size="30" maxlength="50" title="Max length: 50" value="" tabindex="1" class="ordfrm-input" /> </td> </tr> <tr class="ordfrm-tbl-row ordfrm-tbl-row-even"> <td class="ordfrm-tbl-row-hdg"><span class="ordfrm-frm-rqd">* </span>Email Address:</td> <td> <input name="EmailAddress" id="EmailAddress" type="text" size="30" maxlength="100" title="Max length: 100" value="" tabindex="1" class="ordfrm-input" /> </td> </tr> </table> <table width="97%" align="center" cellspacing="3" cellpadding="3" class="ordfrm-text-norm"> <tr><td><img src="images/spacer.gif" width="1" height="1" /></td></tr> <tr class="ordfrm-tbl-row ordfrm-tbl-row-odd"> <td align="center"> <input name="Submit" id="Submit" type="image" src="images/alertpay-sm-1.gif" title="Click here to order securely using **AlertPay**. It may take several moments, so please be patient." tabindex="1" valign="absmiddle" class="image-button" onclick="return funDisable(this, '', true, document.frmOrder)" /> </td> </tr> <tr><td align="center" class="ordfrm-text-small ordfrm-tbl-row-odd"> <img src="images/spacer.gif" width="1" height="5" /><br /> (It may take several moments to take you to our secure payment page, so please be patient. We always protect your privacy and never share your email address with anybody. Also, to ensure you receive our emails, we don't allow free email addresses e.g. yahoo, hotmail, msn.) </td></tr></table> </fieldset> </td></tr></table> </form> funDisable disables the image button and submits the form. I've thoroughly tested this script with Firebug and it only ever does one submit. The order page php script is far too big and complex to include here, but all it does with the dopay.php page is to echo it back to the browser. But anyway, I've eliminated it from the equation, as my testing has all pointed to the presence of the js script on the dopay.php page. It's an obscure one, but does anyone have any suggestions as to how the js script could be causing the order page form to be submitted a second time? Or does anyone know of a better script to disable code viewing that I could possibly use? Debbie
  20. Hi, FYI, for anyone with a similar problem. Rather than spending any more time trying to pinpoint what was looking to be one of those really obscure problems, I solved this problem by creating another link to the database within the session function, so it doesn't need to rely on the previously declared database object being available. So my function now looks like: function funSessRead($strKey) { // Read a session from the database @require(INC_CONFIG_DB_SITE); $qsSession = $dbSite->runQuery("SELECT value FROM " . TBLSITE_SESSION . " WHERE session_id = '" . $strKey . "' AND expiry > '" . time() . "'"); if ($qsSession): $rsSession = $dbSite->fetchArray(); return $rsSession["value"]; else: return ""; endif; } The require calls in the script that sets up a database connection and assigns it to $dbSite which will be isolated within this function, so it won't affect anything outside that uses the other $dbSite object. Debbie
  21. Hi, FYI, for anyone with a similar problem. I solved this problem by asking my hoster to switch allow_url_include on and everything is working again. Debbie
  22. Hi, I do understand your theory, but there are occasions (this one in particular) where you can't pass the required variable(s) to the function. The problem is that using global doesn't seem to work anymore in my example, without globalising it in the function that calls exit(). The database object seems to have been lost by the time the session tidy up happens, but in PHP4, the object still existed, so the session function could still use the existing database connection. Which makes me think that PHP5 has had it's object clean up routine moved to happen earlier, perhaps before the session clean up happens. Can you or anyone confirm whether this is the case? Debbie
  23. Hi thorpe, It's defined earlier in the processing. So why would you say globals are bad? Debbie
  24. Hi, My websites have just been moved to a new server with PHP 5 on it and it seems the the global statement has changed it's behaviour slightly. I have a set of functions which control the session reading and writing. They've been working fine on php 4 for several years now, but in PHP 5 they seem to be having a problem globalising the database object at the end of processing. After much testing, I discovered that if I globalise the object in the last function to be executed (i.e. the one with the exit statement), then there is no problem. This seems rather odd to me, as I thought that the whole point of the global statement is that you can globalise variables from anywhere. I wouldn't have thought that you should have to globalise them all the way back up the call tree, just to be able to use them in the function at the bottom of the tree. So, I'm a little confused and would like some advice. My functions are: funEnd { do some stuff; exit(); } the session function: function funSessRead($strKey) { // Read a session from the database global $dbSite; $qsSession = $dbSite->runQuery("SELECT value FROM " . TBLSITE_SESSION . " WHERE session_id = '" . $strKey . "' AND expiry > '" . time() . "'"); if ($qsSession): $rsSession = $dbSite->fetchArray(); return $rsSession["value"]; else: return ""; endif; } In this setup, $dbSite->runQuery produces the error: "Fatal error: Call to a member function runQuery() on a non-object". The only way I've found to make it work is to globalise $dbSite in funEnd as well, like this: funEnd { global $dbSite; do some stuff; exit(); } Does anyone know whether this is just a bug in PHP5 and whether there is a way to stop the new behaviour? Debbie
  25. Hi, My websites have just been moved to a PHP 5/MySql 5 server, which has caused some of my code to stop working. With file and file_get_contents, I get a message saying that the file couldn't be found, using this code: $aRet = file("http://myothersubdomain/path/to/file/file.php") The file definitely exists and can be called from my browser, but file doesn't seem to be able to find it under php5. With include, I have a file that I include into a script and the file also has an include within it. The file itself is included, but the include within the file is not. It seems to be executed, but nothing replaces it. The first file is: <html> <head> <title>Download Login</title> <meta name="Keywords" content="download,login" /> <meta name="Description" content="Download Login" /> <meta http-equiv="robots" content="noindex, nofollow" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> <link href="http://myothersubdomain/path/to/file/css.php" rel="stylesheet" type="text/css" /> <script language="JavaScript1.2" type="text/javascript" src="js/constants.js.php"></script> </head> <body background="http://myothersubdomain/images/bg.jpg"> <table width="750" align="center" valign="top" cellpadding="0" cellspacing="0" class="page-border"> <tr><td align="center"> <img name="imghdr" src="http://myothersubdomain/images/hdr.gif" width="750" height="100" border="0" /> <table width="100%" align="center" valign="top" border="0" cellpadding="10" cellspacing="0" class="bg-page"> <tr><td valign=top> <h1>Download Login</h1> <?php $booShowFieldset = TRUE; ?><?php include("http://myotherdomain/path/to/file/myfile.htm"); ?> </td></tr></table> <?php include("http://myothersubdomain/path/to/file/myfile2.htm"); ?> </td></tr></table> </body> </html> The code that executes it is: $strEvalFilename = "/home/path/to/file/myincludefile.php"; ob_start(); include($strEvalFilename); $strEvalText = ob_get_clean(); The result is: <html> <head> <title>Download Login</title> <meta name="Keywords" content="download,login" /> <meta name="Description" content="Download Login" /> <meta http-equiv="robots" content="noindex, nofollow" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> <link href="http://myothersubdomain/path/to/file/css.php" rel="stylesheet" type="text/css" /> <script language="JavaScript1.2" type="text/javascript" src="js/constants.js.php"></script> </head> <body background="http://myothersubdomain/images/dpp-bg.jpg"> <table width="750" align="center" valign="top" cellpadding="0" cellspacing="0" class="page-border"> <tr><td align="center"> <img name="imghdr" src="http://myothersubdomain/images/hdr.gif" width="750" height="100" border="0" /> <table width="100%" align="center" valign="top" border="0" cellpadding="10" cellspacing="0" class="bg-page"> <tr><td valign=top> <h1>Download Login</h1> </td></tr></table> </td></tr></table> </body> </html> Could anyone tell me whether these statements have changed in the way they operate in php5 that would cause this behaviour and what I can do to fix it? All 3 statements have worked fine in php4 and nothing changed code-wise before or after the migration to php5. Debbie
×
×
  • 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.