php

PHP query output of SQP

I have no actual php errors, but When I make my query this I get output : $sql_result = "SELECT AuthorFirst, AuthorLast, OnHand, Title FROM Inventory i, Wrote w, Author a, Book b WHERE i.BookCode = b.BookCode AND i.BookCode = w.BookCode AND a.AuthorNum = w.AuthorNum AND 2 = i.BranchNum"; When ...

php, urldecode() and the umlaut - ö

Hi All, Using PHP 5.3.2, I'm having trouble with handling a request for a page whose name has an umlaut in it: ö Making the request using Firefox + Live HTTP Headers for the test_ö_test.htm page, I can see firefox automatically converts/encodes the umlaut when it makes a request: GET /test_%C3%B6_test.htm HTTP/1.1 Now, using http://...

Removing google adsense breaks website - Wordpress custom_functions.php

I added following code in wordpress custom_function.php file a while ago to display google adsense. Now I want to remove the code but my website breaks when I comment out the following code. I don't understand why. Please provide your input on this. function sidebar_ads() { ?> <script type="text/javascript"><!-- google_ad_client = "pub-...

DOM parser that allows HTML5-style </ in <script> tag

Update: html5lib (bottom of question) seems to get close, I just need to improve my understanding of how it's used. I am attempting to find an HTML5-compatible DOM parser for PHP 5.3. In particular, I need to access the following HTML-like CDATA within a script tag: <script type="text/x-jquery-tmpl" id="foo"> <table><tr><td>${name}...

Email Piping to osTicket (CURLE_COULDNT_CONNECT)

Hey, So I have my email on a site w/ cpanel and my support site currently running locally. I've set up a forwarder to automail.php which triggers correctly. Here is the code: #!/usr/bin/php -q <?php try { #pre-checks function_exists('file_get_contents') or die('upgrade php >=4.3'); set_time_limit(30); #Configuration: Enter the url ...

Can I have a default controller called if the called controller doesn't exist?

I'm trying to learn more about the codeigniter framework by porting an existing website to it -- something that's not too complex, or so I thought. Currently the site is replicated for its users and presents personalized data based on the url, for example, Joe might have his site at: www.example.com/joe www.example.com/joe/random-page....

PHP Optional Parameters - specify parameter value by name?

Hey, I was just wondering... I know it is possible to use optional arguments as follows: function doSomething($do, $something = "something") { } doSomething("do"); doSomething("do", "nothing"); But suppose you have the following situation: function doSomething($do, $something = "something", $or = "or", $nothing = "nothing") { } ...

Reading HTTP request headers to decide whether to proceed or not

I'm not awfully knowledgeable about HTTP, but my understanding is that an HTTP request consists of a bunch of headers and then the body. Is it possible for PHP to receive the request headers, make a decision based on what's been received, and then either abort the request or continue to accept the body? This would be useful when receiv...

Use CURL to read mail? - PHP

Hello Is it possible to manipulate a dovcot server or any like server with CURL to return email for an email address? I've been unsuccessful with imap_open and am in need of a new alternative. I've been able to login using CURL but after that I do not know where to go. This is what is outputted after login: +OK Dovecot ready. -ERR Un...

PHP & MySQL Tickers..Is this standard practice?

I currently have about 4 different database tables which output to html tables. Each of these tables uses a count query to calculate data from a 5th table. That's no problem, but what about when I want to sort and order the data, and paginate etc (like with zend). If it were a one page table, I could probably sort an array. My thought ...

Codeigniter : variables scope when calling a view from within a view. Odd...

I am confused about variables scope when calling a view from within a view. I tested a bit and found: If the variables are originally passed from a controller, there is no need to do something to pass the variables from a view to a view. If the variables are declared in a view, I have to explicitly pass the variables from a view to a...

Difference in sending HTTP status codes from php

what is the difference from setting the responce status in php header("HTTP/1.0 404 Not Found"); and header("Status: 404 Not Found"); What is the difference from the client point of view (aka browser or a client implementation for RESTful WS). I understood that the second one has to do something with CGI. ...

how can I use javascript or php to determine when images are loaded if image tags are dynamically created from database?

I have a page that's very image-intensive. This is by client request - it's a list of merchants with a logo for each one. The list is quite long (over 500), and yes - the client insists on displaying all of them. We do have an ajax typeahead search to help users find what they're looking for without scrolling, so it's not a total disaste...

Prevent AJAX chat from showing duplicate messages (Javascript, PHP, MySQL)

I have made an AJAX chat using Javascript, PHP, and MySQL. I send the chat data with JSON from a PHP page that gets the data from a MySQL database. Each chat message is inserted into an array and pulled with an AJAX call every few seconds. Each row in the database has the timestamp of when the message was posted (the timestamp has the...

Auto validating a page on load (using W3C validator)

I am developing a web site whose HTML can vary quite a lot depending on user inputs (user input on page 1 decides which sections of page 2 are shown, etc). Naturally, I would like to ensure that the HTML is valid, but there are a lot of permutations. I was wondering if anyone has a code snippet which I could include (in debug mode) i...

Using php and MPI

I currently have a php file which allows the user to upload a file. Once they upload the file, it runs a program with the file using MPI. The problem is that the script says it cannot find the file .mpd.conf (config file that must be present in users home directory). I'm guessing that this is because it is running as a different user...

Any framework for PHP, as effective as Django for Python?

I am using python with django. There I can simply make form from models and also it had builtin Admin. I am eager to know corresponding framework for PHP with all this facilities. I have encountered lot some similar questions like this, but they had not compared the frameworks with django. Experts Please Suggest. ...

Auto minify Javascript/CSS files after update?

I know of ways to minify JS and CSS files but is there a way to auto-minify these files in the production system? For instance, I modify something inside the original JS files and update the production environment. However, while using the JS files, it should use an auto-minified version of the JS file (preferably update the current mini...

SQL Query to show number of stories created in last 24 hours?

I'm trying to create a custom query that will show the number of stories that have been posted in the last 24 hours on a Drupal 6 site. Stories are stored in the "node" table. each record has a "created" row that records the UNIX timestamp when the story was posted. Here's the query I'm trying so far: $sq = 'SELECT COUNT(*) cnt ' ...

How do I find the number of ACTIVE MEMBERS on a forum?

I am putting together a Forum Stats website and I need to find the number of Active Members on several forums. Many have "Total members" listed but that doesn't help me. I'm considering "Active" as someone that has posted at least 5 times within 6 the last months. I'm really perplexed as to how this might be done. Any suggestions? ...