Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by TweezerMan

  1. From what I can tell, MySQL's FROM_UNIXTIME() function does not support negative epoch timestamps (just as the inverse function UNIX_TIMESTAMP() does not either). If your query is being constructed in PHP, you can use PHP to convert the timestamp, then place that result in your MySQL query: >$mydate = gmdate('Y-m-d H:i:s', -13391999); In the above example, $mydate will contain '1969-07-30 00:00:01'.
  2. Based on my testing, using htmlspecialchars() with any of the quote style constants (or none of them) works as described in the PHP documentation. I wrote the following script and tested it on my server: ><?php header('Content-Type: text/plain'); echo 'ENT_COMPAT = ' . ENT_COMPAT . "\n"; echo 'ENT_QUOTES = ' . ENT_QUOTES . "\n"; echo 'ENT_NOQUOTES = ' . ENT_NOQUOTES . "\n"; echo "\n"; $text = 'one \' two " three &'; echo "Encoding special characters in string [$text]:\n"; echo 'DEFAULT: ' . htmlspecialchars($text) . "\n"; echo 'ENT_COMPAT: ' . htmlspecialchars($text, ENT_COMPAT) . "\n"; echo 'ENT_QUOTES: ' . htmlspecialchars($text, ENT_QUOTES) . "\n"; echo 'ENT_NOQUOTES: ' . htmlspecialchars($text, ENT_NOQUOTES) . "\n"; ?> The script displays the following results: >ENT_COMPAT = 2 ENT_QUOTES = 3 ENT_NOQUOTES = 0 Encoding special characters in string [one ' two " three &]: DEFAULT: one ' two " three & ENT_COMPAT: one ' two " three & ENT_QUOTES: one &#039; two " three & ENT_NOQUOTES: one ' two " three & Each of the quote style constants is being properly evaluated by PHP, and when used in htmlspecialchars(), each quote style constant is encoding the correct characters. It's hard to say what's going on without seeing the code and/or a concrete example, but it doesn't look like it's due to htmlspecialchars() not handling ENT_COMPAT correctly.
  3. Later on in your series of posts, you mentioned that you "removed everything to do with ROXIO". There is a Roxio Knowledgebase article on "CD/DVD drives missing after installation", with separate utilities available to fix your registry depending on whether a Roxio product is currently installed or uninstalled.
  4. You don't say which registry key you're removing, but I suspect you probably haven't found the one that is the problem. From the text of the error message you posted, it appears that windows is returning a "Code 19" error for the cd-rom and dvd drivers: Microsoft has a couple of articles in its Knowledge Base that may be directly on point with your issue: CD-ROM access is missing and messages cite error code 31, code 32, code 19, code 39, or code 41 after you remove Easy CD Creator in Windows XP CD-ROM drive or DVD-ROM drive appears to be missing after you install Windows XP The first article includes a "Guided Help" utility that can perform the registry edit for you. If you decide to manually delete the registry keys mentioned, the steps described in the second article are more thorough, as they include exporting a copy of the registry keys before deleting them. (But the registry keys are the same ones mentioned in the first article.) Also, the second article contains instructions on how to uninstall the corrupted device drivers (not just remove them), which is not covered in the first article. Hope this helps...
  5. On many PC's, you can hit the 'Pause / Break' key to freeze the BIOS output while booting. If I need to remember something or report something back, I write it down on a piece of paper. When done, I press the space bar (aka the 'any key' ) to resume booting.
  6. You can get the last AUTO_INCREMENT generated by using the mysql_insert_id() function right after performing the INSERT query.
  7. MT 3.3 has been released today! This is the long-awaited upgrade to MT 3.2. * MT 3.3 features * New licensing & pricing (free personal license with unlimited users / unlimited blogs / no support is back!) * New documentation, including downloadable User Manual and Installation Guide I participated in the beta testing of MT 3.3, and like MT 3.2, this another upgrade well worth getting! My single favorite new feature in MT 3.3: Activity Feeds. I can get notifications of new comments / trackbacks (and anything else recorded in MT's Activity Log) in my newsreader. Plus, checking an Activity Feed triggers MT's new Scheduled Tasks framework, eliminating the need for cron jobs to perform scheduled posting of entries or deleting junk comments / trackbacks. (Side note: When you download and install MT 3.3, the version will actually indicate 3.31. That is the correct version.)
  8. To block access from IP addresses in the range of -, you'd need 4 directives in your .htaccess file: ># Block IPs in the range of - deny from deny from deny from deny from blocks - [2048 IPs] blocks - [4096 IPs] blocks - [16384 IPs] blocks - [32768 IPs] ...for a total of 55,296 IP addresses blocked. Blocking "85.102.40" will just block the range of - [256 IPs], a much smaller range than what is desired.
  9. Welcome to the forums, 5FM! This doesn't make much sense. GoDaddy shouldn't care too much about what outgoing ports are used, and the port to connect to on the remote server (the MySQL database server) must be 3306. Also, connections to a MySQL database server are not http or https connections (a MySQL server is not a web server). Assuming that there isn't another php script being imported, this script isn't using the variables that hold the connection information to actually connect to the MySQL server. In the last line of code, $hostname_conAdmin, $username_conAdmin, and $password_conAdmin should be $hostname_conIDX, $username_conIDX, and $password_conIDX. That's about all I can tell you, based just on what you've posted.
  10. I think you mistyped this part of your code, as it is invalid and doesn't work on my test page: ><a href="popWin('./index.php?action=open&id=579')"> ('href' should be 'onclick'...and I don't know what you have for 'href') This tells me that you're losing the value of the morewin variable after the popup window has been opened. I don't know what you have for the href attribute in the link that opens the popup window, but if it links to the same page the script is on, or to another page with a copy of this script code on it, the closepopWin() code won't work. Javascript variables and their values do not carry over from one page to another (including a reload of the same page). If the link that runs popLink() also loads a page in the main window, the value of morewin will be lost. I'd suggest using basically a null href with the onclick code to call popLink(): ><a href="#" onclick="popWin('./index.php?action=open&id=579')"> If you'd like the link to work in browsers that don't have javascript, or don't have it enabled, you could have the same link in both the href and onlick attributes, but the onclick code must have a 'return false;' at the end to disable the normal link function if the javascript code runs: ><a href="./index.php?action=open&id=579" onclick="popWin('./index.php?action=open&id=579'); return false;">
  11. I created a test page with the code you listed at the beginning of your post, and a couple of links with an onclick event to open and close the popup browser window. Your code appears to be fine. However, I initially had the same issue you did - the open window code worked, but the close window code did not. As it turned out, I had misspelled 'onclick' in the close window link ('onlick'), which prevented the close window code from being run. Once I corrected that, the close window code worked correctly. I'd suggest looking at how you're calling the javascript closepopWin() function in the body of your page, and make sure there aren't any errors / typos in it.
  12. Welcome to the forums, stb76! I believe you're getting this error because ODBC libraries that support the type of database you want your script to talk to have to be compiled into PHP. TCH servers do not have PHP compiled with any ODBC driver support, so the various odbc_* functions would be unavailable.
  13. I don't know what you're doing now (I guess not display an image at all...?), but what I would do is have a 'default' image available for reviews that do not have their own image. In your PHP code, check to see if there was an image name in the query results. If so, set $image to the name returned in the query; otherwise, set $image to your default image name. Then in the code you've shown here, $image will always be set, and there would be no need for an if block at that point. Here, I was talking about someone entering an invalid movie id. You'd query the database, but the database would return no results in that case. After running the query, but before generating anything for the web page, you'd want to check and see if the initial query returned anything (whether the movie id was valid or not). >$result = mysql_query("SELECT * FROM movie where movieid='$id'", $link); if (!mysql_num_rows($result)) { ...Bad movie id - display 404 page here... } ...continue with code to display requested page...
  14. Part 3 of my 3 part reply... Rather than create and use an actual column in your table, you may be able to use a calculated column instead. To get a reliable list of "S" titles without combing through the entire database in PHP, your MySQL query is going to need to identify those titles itself. I'm sure what IMDB uses is more complex, but here's a query that will pull movie titles beginning with "S", taking into account titles starting with "A", "An", or "The": >SELECT title, CASE WHEN SUBSTRING(title, 1,2) = "a " THEN CONCAT(SUBSTRING(title, 3), ', ', SUBSTRING(title, 1, 1)) WHEN SUBSTRING(title, 1, 3) = "an " THEN CONCAT(SUBSTRING(title, 4), ', ', SUBSTRING(title, 1, 2)) WHEN SUBSTRING(title, 1, 4) = "the " THEN CONCAT(SUBSTRING(title, 5), ', ', SUBSTRING(title, 1, 3)) ELSE title END AS list_title FROM movies WHERE title REGEXP '^((a|an|the) )?s.*' ORDER BY list_title ASC This query select the movie title, and calculates a list_title for each title as follows: 1) If title starts with "a " (case insensitive), strip that from beginning of title, add ", " to end of title, followed by just the "a". 2) If title starts with "an " (case-insensitive), strip that from beginning of title, add ", " to end of title, followed by just the "an". 3) If title starts with "the " (case-insensitive), strip that from beginning of title, add ", " to end of title, followed by just the "the". 4) Otherwise, use the actual title. The WHERE clause filters the records by only returning records that start with "s" (case-insensitive), optionally preceded by "a", "an" or "the" and a space. Since list_title is an actual column returned in the query, it can be sorted on, and the above query sorts the results alphabetically by the new calculated list_title column.
  15. Part 2 of my 3 part reply... You can redirect to any URL as long you haven't outputted anything (used any echo() statements or output any plain HTML) yet to the visitor's browser: ><?php if ($bad_id) { header("Location: http://www.my-TCH-domain.com/"); /* Redirect browser */ /* Make sure that any subsequent code in script does not get executed when we redirect. */ exit; } ?> (...where $bad_id represents some condition you've tested, indicating an invalid id.) If you have a custom 404 error page, you could just output a 404 header and include the file, rather than do an actual redirect. If you don't have a custom 404 error page (you're just relying on the Apache default 404 page), you can replicate it with the following code: ><?php header("HTTP/1.1 404 Not Found"); echo <<<EOT <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL {$_SERVER['REQUEST_URI']} was not found on this server.</p> <hr> {$_SERVER['SERVER_SIGNATURE']} </body></html> EOT; ?>
  16. I'm going to try to tackle each of your questions with separate posts, as answering all of them in one post would be a pretty long post. With the echo() statement in the loop, you're sending each category (with it's trailing slash) to the browser immediately. If you send one too many (like the one that appears after the last category), there's no way to go back and remove it - it's already left the server and viewable in the visitor's browser, where you can no longer change it. I'd suggest restructuring the while loop a little differently: >$cat_array = array(); while ($ginfo = mysql_fetch_array($genreinfo)) { array_push($cat_array, $ginfo['category']); } $cat_string = implode(" / ", $cat_array); echo $cat_string; This code sets up an empty array, then adds each category to the array as you loop through the query results. After all of the categories have been added to the array, the implode() function takes each element of the array and combines them into a single string, separating them with " / ". The nice thing about implode() is that it automatically will not output a separator after the last element in the array, and there won't be any separator at all if there's only one category. After the category string has been built, *then* it can be sent to the visitor's browser (echo()).
  17. That would be a problem if you own the directory, which it appears that you do. Users can only do a chmod on directories and files that they own. Since your PHP script runs as 'nobody', it cannot change the permissions on a directory that is not owned by 'nobody'. You could set up your PHP script to run as a CGI script. As a CGI script, the script will run as "you" and avoid the permission problems you're currently having. In the directory where your script is, create an .htaccess file if there isn't one, or edit the existing one and add the following: ><Files myscriptname.php> AddHandler cgi-script .php </Files> Replace 'myscriptname.php' with the actual file name of your PHP script. Then, edit your script and insert the following as the very first line in your script: >#!/usr/bin/php Finally, set the permissions on your PHP script to 0755 so it is executable. That should set you up. Leave the directory your script writes to with 0775 permissions and run the script - hopefully, the script will be able to create the file as you intend.
  18. They will see a standard 403 "Forbidden" error page generated by the server. You can serve a custom error page by using an ErrorDocument directive in your /public_html directory's .htaccess file: >ErrorDocument 403 /my403error.php You should create the page and put it in the directory before adding the ErrorDocument directive. The page itself can be any type of page (HTML, PHP, perl, etc.), and can have whatever name you want. Yes, AWStats will continue to log access attempts even after you've banned the IP address on the server. These are reported at the very bottom of the page under "HTTP Error Codes". You'd be interested in the stats for "403 Forbidden". These are also in your server log detail (if you look at your logs). You can identify those records either by the IP address (the one you've banned), or by the status code (403).
  19. Yes, but it is the only way you'll be able to accomplish what you're wanting to do. To minimize the risk, you'd want to make sure your scripts are secure, that no one can upload just any file into that directory, and make regular backups of your site, as this directory would be vulnerable if any account on your server is compromised.
  20. I suspect the "Permission denied" message is not related to using the 'unlink' command, but rather, your script does not have appropriate directory permissions to delete the file. To delete a file, the script, running as the user 'nobody', must have write permissions for the directory that contains the file. If you own the directory (you created it), that directory would need to have 0777 permissions. If 'nobody' owns the directory (a PHP script created it), the directory should have at least 0755 permissions.
  21. The Perl module you're interested in is "GD", and that should be installed by default on all TCH servers. As far as the CAPTCHA image not displaying, I would guess that something is not configured correctly with regards to the plugin, or the link to the CAPTCHA image on your comments page is not pointing at the correct directory or file.
  22. I looked at the HP PhotoSmart 3310 at HP's web site. It's a combination printer / scanner / copier / fax machine. I have a different model of an HP all-in-one printer here at home, and the only function that can be shared across a network is the printer. Based on what I saw at the HP site, the 3310 doesn't look any different.
  23. Windows XP does not support sharing a scanner over a network. You'll only be able to use the scanner with the computer that the scanner is physically connected to.
  24. When I need one, I use MySQL Query Browser. But the phpMyAdmin already installed on TCH's servers generally meets my needs most of the time.
  25. I'd suggest using a separate table to keep track of the friends. I don't know what information you want to keep track of for each "friendship", but the table could have just a minimum of three fields: 1) id - unique record number for this "friends" table 2) user_id - id number from "users" table of user declaring / adding friend 3) friend_user_id - id number from "users" table of friend being added I'd probably index all columns of this table to make searching / locating records faster. To list a user record with their friends, the MySQL query would do a join on the user table and this new "friends" table, joining the "id" field from the user table with the "user_id" field in the "friends" table. Removing a "friend" would just entail deleting the appropriate record from the "friends" table. That's my 2 cents.
  • Create New...