Jump to content

nfr

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by nfr

  1. nfr

    PHP Hanging?

    Any ideas? Regards, Neil.
  2. nfr

    WYSIWYG

    I use htmlarea. http://www.htmlarea.com/ Good and easy to integrate.
  3. Well, at the end of the shell script (korn, sh, etc.) just issue the command again. So he would run the script once and before completion the script would set the next job up. E.g. /scripts/myscript.ksh !#/bin/ksh do something at time /scripts/myscript.ksh exit 1 This would basically create an infinite loop until the script were killed and the jobs were deleted from the atq. Regards, Neil.
  4. Something like this: $record_id = $_REQUEST['record_id']; mysql_select_db($database_db, $db); $query = "SELECT audio FROM audio where id=$record_id"; $RS_record = mysql_query($query, $db) or die(mysql_error()); $row_RS_record = mysql_fetch_assoc($RS_record); $audio = $row_RS_news_headline['audio']; <?php echo $audio; ?> You'll have to tidy it up for your application but the above should give you a headstart... Regards, Neil.
  5. nfr

    SQL Problem

    SELECT * FROM stories WHERE (((category = '$news') and ((status != "pending") or (status != "rejected"))) order by article_id desc limit 2; Something like that, you mean? Regards, Neil.
  6. nfr

    PHP Hanging?

    Hi - The code above is the included file ("counter.php"). At I said, it works fine as a direct call through the browser. It causes the page to hang, however, when called as an include in another php file... Regards, Neil.
  7. If you can't use the "cron", why don't you just use the "at" command on the *nix command line? This is basically the "cron" without actually being the "cron" (if that makes any sense!) man at man atq man atrm man batch Regards, Neil.
  8. nfr

    PHP Hanging?

    Hi - I narrowed it down to the following call: <?php include("http://www.website.com/includes/counter/counter.php"); ?> This file contains the following code: <?php session_start(); header("Cache-control: private"); require('../../Connections/leaderdb.php'); $remote_addr = $_SERVER['REMOTE_ADDR']; $http_referer = $_SERVER['HTTP_REFERER']; $http_user_agent = $_SERVER['HTTP_USER_AGENT']; //echo "REMOTE_ADDR: $remote_addr"; //echo "HTTP_REFERER: $http_referer"; //echo "HTTP_USER_AGENT: $http_user_agent"; if(!session_is_registered('online')){ mysql_select_db($database_leaderdb, $leaderdb); $sql_query1 = "INSERT INTO t_people_online (people_online_session_id, people_online_activity, people_online_ip_address, people_online_refurl, people_online_user_agent) VALUES ('".session_id()."', now(), '{$_SERVER['REMOTE_ADDR']}', '{$_SERVER['HTTP_REFERER']}', '{$_SERVER['HTTP_USER_ AGENT']}')"; $result1 = mysql_query($sql_query1, $leaderdb); session_register('online'); } else { if(session_is_registered('user_id')){ mysql_select_db($database_leaderdb, $leaderdb); $sql_query2 = "UPDATE t_people_online SET people_online_activity=now(), people_online_member='y' WHERE people_online_session_id='".session_id( )."'"; $result2 = mysql_query($sql_query2, $leaderdb);     } } if(session_is_registered('online')){        mysql_select_db($database_leaderdb, $leaderdb); $sql_query3 = "UPDATE t_people_online SET people_online_activity=now() WHERE people_online_session_id='".session_id()."'"; $result3 = mysql_query($sql_query3, $leaderdb); } $limit_time = time() - 900; // 15 Minute time out. 60 * 15 = 900 mysql_select_db($database_leaderdb, $leaderdb); $sql_guests = mysql_query("SELECT * FROM t_people_online WHERE UNIX_TIMESTAMP(people_online_activity) >= $limit_time AND people_online_member= 'n' GROUP BY people_online_ip_address") or die (mysql_error()); $sql_guests = mysql_query("SELECT * FROM t_people_online WHERE UNIX_TIMESTAMP(people_online_activity) >= $limit_time AND people_online_member= 'n'") or die (mysql_error()); $sql_guests = mysql_query("SELECT * FROM t_people_online WHERE UNIX_TIMESTAMP(people_online_activity) >= $limit_time AND people_online_member= 'n'") or die (mysql_error()); mysql_select_db($database_leaderdb, $leaderdb); $sql_members = mysql_query("SELECT * FROM t_people_online WHERE UNIX_TIMESTAMP(people_online_activity) >= $limit_time AND people_online_member ='y' GROUP BY people_online_ip_address") or die (mysql_error()); $sql_members = mysql_query("SELECT * FROM t_people_online WHERE UNIX_TIMESTAMP(people_online_activity) >= $limit_time AND people_online_member ='y'") or die (mysql_error()); mysql_select_db($database_leaderdb, $leaderdb); $sql_hits = mysql_query("select * from t_site_statistics_details where site_statistics_id = 1 group by site_statistics_name") or die (mysql_er ror()); $guests = mysql_num_rows($sql_guests); $members = mysql_num_rows($sql_members); if ($myrow = mysql_fetch_array($sql_hits)) { do { $hits = $myrow["site_statistics_value"]; } while ($myrow = mysql_fetch_array($sql_hits)); } echo "<p><span class=\"SiteStatisticsBoldRed\">Website Statistics</span><br />"; echo "<span class=\"SiteStatisticsRed\">Visitors Online: $guests</span><br />"; //echo "Members Online: $members<br />"; echo "<span class=\"SiteStatisticsRed\">Pages Served: $hits</span>"; mysql_select_db($database_leaderdb, $leaderdb); $sql_query4 = "UPDATE t_site_statistics_details SET site_statistics_value=(site_statistics_value + 1) WHERE site_statistics_id=1"; $result4 = mysql_query("$sql_query4", $leaderdb); ?> If I remove the call to the included file, the page loads instantly. There must be something wrong but I cna't see what. If I call the include file directly on the server it also loads instantly. So I don't know why it won't work inside the page... Any ideas? Regards, Neil.
  9. nfr

    PHP Hanging?

    Hi - Just tried now and yes it is. This never used to be a problem before and I have not made ANY changes to the php code. I did, however, have a server failure and am running on another machine. However, this machine is the same spec. Is there a php.ini parameter which may need to be set? Regards, Neil.
  10. Hello - I have an "index.php" file which used to parse fairly quickly. Now all of a sudden it seems to hang for about 30 seconds before completing to load. I have run "php index.php" on the command line and it seems to hang whilst just outputting HTML (actually within a simple table). Why would this happen? (There is no mysql db access at this point and I can't see anything unusual about the php or html.) Any ideas? Regards, Neil.
  11. Hi - I can't figure this out. If I run php from the command line, the version is 4.2.2: admin@machine:/home/d/d/ddp/public_html$ php -v PHP 4.4.2-1build1 (cli) (built: Apr  6 2006 09:44:32) Copyright (c) 1997-2006 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies admin@machine:/home/d/d/ddp/public_html$ However, if I call php through the browser (using phpinfo()), it outputs: PHP Version 5.1.2 Why is this? Regards, Neil.
  12. Direct selects from the database: mysql> select article_creation_date from t_article_details where article_id = 5000; +-----------------------+ | article_creation_date | +-----------------------+ | 20050725133459 | +-----------------------+ 1 row in set (0.05 sec) mysql> select DATE_FORMAT(article_creation_date, '%d/%m/%Y') from t_article_details where article_id = 5000; +------------------------------------------------+ | DATE_FORMAT(article_creation_date, '%d/%m/%Y') | +------------------------------------------------+ | 25/07/2005 | +------------------------------------------------+ 1 row in set (0.01 sec) Here, I asign it to a variable: mysql_select_db($database_db, $db); $query_RS_article_details = "SELECT article.article_edition_number, article.article_id, article.article_title, article.article_author_id, author.article_author_name, author.article_author_email, article_text, DATE_FORMAT(article.article_publication_date, '%d/%m/%Y') as article_publication_date, DATE_FORMAT(article.article_creation_date, '%d/%m/%Y') as article_creation_date, article.article_summary FROM t_article_details as article, t_article_author_details as author WHERE ((article_id = '$article_id') and (article.article_author_id = author.article_author_id))"; $RS_article_details = mysql_query($query_RS_article_details, $leaderdb) or die(mysql_error()); $row_RS_article_details = mysql_fetch_assoc($RS_article_details); $totalRows_RS_article_details = mysql_num_rows($RS_article_details); $article_creation_date = $row_RS_article_details['article_creation_date']; $article_publication_date = $row_RS_article_details['article_publication_date']; $article_modification_date = $row_RS_article_details['article_modification_date']; echo "article_creation_date: $article_creation_date"; echo "article_publication_date: $article_publication_date"; echo "article_modification_date: $article_modification_date"; The output: article_creation_date: 07/06/2006article_publication_date: 11/04/2020article_modification_date: Any ideas? Regards, Neil.
  13. That would make sense... But the field has a value... So if I have the following statement: SELECT article.article_edition_number, article.article_id, article.article_title, article.article_author_id, author.article_author_name, author.article_author_email, article_text, DATE_FORMAT(article.article_publication_date, '%d/%m/%Y') as article_publication_date, DATE_FORMAT(article.article_creation_date, '%d/%m/%Y') as article_creation_date, article.article_summary FROM t_article_details as article, t_article_author_details as author WHERE ((article_id = '$article_id') and (article.article_author_id = author.article_author_id)); ... how do I assign "DATE_FORMAT(article.article_creation_date, '%d/%m/%Y') as article_creation_date" to a variable? I thought that I had done this with: $article_creation_date = $row_RS_article_details['article_creation_date']; echo "article_creation_date: $article_creation_date"; Regards, Neil.
  14. Hello - I have 2 select statements: 1.) select DATE_FORMAT(article_creation_date, '%d/%m/%Y') from t_article_details where article_id = 5000; 2.) SELECT article.article_edition_number, article.article_id, article.article_title, article.article_author_id, author.article_author_name, author.article_author_email, article_text, DATE_FORMAT(article.article_publication_date, '%d/%m/%Y') as article_publication_date, DATE_FORMAT(article.article_creation_date, '%d/%m/%Y') as article_creation_date, article.article_summary FROM t_article_details as article, t_article_author_details as author WHERE ((article_id = '$article_id') and (article.article_author_id = author.article_author_id)); The first gives the desired result: 27/05/2005 +------------------------------------------------+ | DATE_FORMAT(article_creation_date, '%d/%m/%Y') | +------------------------------------------------+ | 25/07/2005 | +------------------------------------------------+ 1 row in set (0.00 sec) The second gives an incorrect result: 06/06/2006 $article_creation_date = $row_RS_article_details['article_creation_date']; echo "article_creation_date: $article_creation_date"; Can someone please explain why?!? It should be the same result in both cases, surely... Regards, Neil.
  15. Hello - I would like to collect details about an individual (Name, Company Name, Telephone Number, Email Address, Web Address, etc.) in a mySQL table and when then form is submitted, automatically download a file (or email) a PDF file containing the information they have requested. What would be the best way of going about this? Regards, Neil.
  16. Hi - I've tried different permutations of your suggestion with the following code: <?php $remote_addr = $_SERVER['REMOTE_ADDR']; $http_referer = $_SERVER['HTTP_REFERER']; $http_user_agent = $_SERVER['HTTP_USER_AGENT']; echo "REMOTE_ADDR: $remote_addr"; echo "HTTP_REFERER: $http_referer"; echo "HTTP_USER_AGENT: $http_user_agent"; print_r($GLOBALS); echo "<br><br><br><br><br>"; echo "HTTP_SERVER_VARS"; echo "$HTTP_SERVER_VARS"; echo "<br><br><br><br><br>"; ?> 1.) <?php include("http://www.mysite.com/myinclude.php"); ?> and 2.) <?php include("myinclude.php"); ?> and 3.) <?php include("/path/from/root/to/myinclude.php"); ?> The first instance of HTTP_REFERER is OK. In the include only the 1.) (full URL) echoes out anything at all. 2.) and 3.) provide no output. However, 1.) does not list the REMOTE_ADDR correctly and does not output anything for the HTTP_REFERER. Instead of it being the correc referrer IP address, it is the IP address of the machine serving www.mysite.com. Any ideas? Regards, Neil.
  17. It is included as follows: <?php include("http://www.servername.com/includes/myinclude.php"); ?> This output what it should have done. I also tried: <?php include("/includes/myinclude.php"); ?> This returned nothing. But what is also wierd is that I used to get a value for $_SERVER['HTTP_REFERER'] but I do not any longer. Any clues? Cheers, Neil.
  18. Hello - If I run the following PHP the output is OK: <?php $remote_addr = $_SERVER['REMOTE_ADDR']; $http_user_agent = $_SERVER['HTTP_USER_AGENT']; echo "REMOTE_ADDR: $remote_addr"; echo "HTTP_USER_AGENT: $http_user_agent"; print_r($GLOBALS); ?> However, if I run this as an "include", only the IP address of the UNIX server hosting Apache is output. Also, I seem to have lost the following: $_SERVER['HTTP_REFERER']; This was outputting correctly but now outputs nothing. Why is this? Regards, Neil.
  19. How can I search on a line start and a line end? I've got the following to replace the "<BR>" tags with "<BR />" but how can I remove a line such as: line start<P>&nbsp;</P>line end Regards, Neil.
  20. I also need to perform the following on the text: 1.) replace all instances of "&nbsp " with " " 2.) remove all instances of "line start<P></P>line end" 3.) remove all instances of "line start<P>&nbsp;</P>line end" 4.) replace all instances of "line start<P></P><article>line end" with "<article>" This is to clean up data. How can I do all of this in once hit? Regards, Neil.
  21. Hello - How can I replace all instances of "<br>" with "<br />" in a block of text? The "<br>" seems to be crashing my XML feed because there is no "</br>". Thanks and regards, Neil.
  22. Hello - I want a user to be able to enter an email address into a form field and when the "submit" button is pressed, a PDF file should be sent to that address. How can this be done? Regards, Neil.
  23. I thought that it was completely resolved but now I've hit another problem. I have the XML below. The problem is that it stumbles on the character entities (&rsquo; and &lsquo;). How can I map these two to the correct entities? Regards, Neil. <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <rss version="2.0"> <channel> <title>The Costa Blanca and Costa Calida Leader Newspaper | Local News for the Spanish Coastal Regions</title> <link>http://news.costablancaleader.com/</link> <description>Local News for the Costa Blanca and Costa Calida from The Leader Newspaper</description> <language>en-uk</language> <copyright>Copywrite © 2004-2005 The Leader Media Group, S.L.</copyright> <webMaster>webmaster@theleader.info</webMaster> <pubDate></pubDate> <lastBuildDate></lastBuildDate> <ttl>60</ttl> <image> <title>The Costa Blanca and Costa Calida Leader Newspaper | Local News for the Spanish Coastal Regions</title> <width>124</width> <height>18</height> <link>http://news.costalancaleader.com/</link> <url>http://www.costablancaleader.com/images/leader_rss.gif</url> </image> <item> <title>Tinnitus</title> <link>http://www.costablancaleader.com/news/article.php?article_id=7599&amp;article_section_id=1</link> <guid isPermaLink="true">http://www.costablancaleader.com/news/article.php?article_id=7599&amp;article_section_id=1</guid> <pubDate>08/05/2006</pubDate> <description>Tinnitus is one of the most common of the ear conditions and is commonly known as &lsquo;ringing in the ears.&rsquo; It has been estimated that one in ten adults (in the UK) suffer from this condition in varying degrees. It is more common in people over 40 and in those who suffer from loss of hearing. Tinnitus originates from the Latin word &lsquo;Tinnere&rsquo; meaning &lsquo;to ring.&rsquo; Tinnitus has two major categories &ndash; objective and subjective. Subjective is more common. </description> </item> </channel> </rss>
  24. Not sure what platform you are using but generally a cron job can be set up on a *nix server by using the "crontab" command. Generally "-l" will list all cron jobs and "-e" will allow you to ammend the crontab. An entry would look something like the following: 15 2 * * 2 /usr/bin/php -q /home/webmaster/scripts/newsletter.php minute, hour, month, day of month, day of week, script More information on the cron can be found at [a href=\"http://www.adminschoice.com/docs/crontab.htm\" target=\"_blank\"]http://www.adminschoice.com/docs/crontab.htm[/a] or "man crontab".
×
×
  • 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.