php

How widespread is CGI usage today?

In a book I'm reading, the author says "Most dynamic Web pages on the Internet are created with CGI and scripting languages". This isn't true anymore, is it? Aren't other technologies like PHP or ASP more widely used than CGI nowadays? I'm not sure how to find out stats for something like this. Thanks... ...

Is there a way to maintain a 200MB immutable data structure in memory and access it from a script?

I have a list of 9 million IPs and, with a set of hash tables, I can make a constant-time function that returns if a particular IP is in that list. Can I do it in PHP? If so, how? ...

create a drop down on a php webpage

I wanted to create static and a dynamic drop down for an online application form on my web page The static drop down would a list of clearance levels where the dynamic one would be based on a list of job openings (which is in turn taken from a folder that has 1 pdf file for each job opening) the end goal is that an email would be sent ...

Add content between Wordpress queried posts

I am wondering how I can add something between posts being queried in Wordpress through this method: <?php $the_query = new WP_Query('category_name=name&showposts=2'); while ($the_query->have_posts()) : $the_query->the_post();?> Is there a way I could add something simple, like say a <hr> between the two posts being pulled? ...

How to properly build a navigation menu that highlights the current page

I've setup a menu for a fairly simple site based on icant.co.uk. It's fairly simple with maybe 5 pages. The small site is mainly a mysql browser for a few tables using MATE. Theres a common.php file that contains the header & footer HTML so thats where I put the code below. The code below highlights the current page on the menu. Its...

How To Store Hmong Characters In MySQL Database

I've read a number of articles on storing multi-language strings in MySQL, but I can't seem to find anything specific (or credible) on Hmong. I have no trouble with latin (European) languages, but if someone could enlighten me on Hmong, that would be terrific. Thanks! P.S. Using PHP for the scripting, if anyone cares. ...

How can I change Zend Framework's routing schema to not use key/value pairs?

Rather than using controller/action/key1/value1/key2/value2 as my URL, I'd like to use controller/action/value1/value2. I think I could do this by defining a custom route in my Bootstrap class, but I want my entire application to behave this way, so adding a custom route for each action is out of the question. Is this possible? If so, ...

Trouble logging out of a Facebook connect site and destroying sessions

I can't seem to get a facebook connect app that I am building to log the user out (sorry no url as it's still in dev). Each time the user clicks a link with the class "logout" the following JS runs which seems to work and even shows the FB modal stating the user has been logged out. $(document).ready(function(){ $('.logout').click(f...

PHP Zip code matching

How can I have it if a zip is entered that I have a page for go to the page for the zip and if not then go to another page? I'm new to PHP and don't know how to start. ...

What's the most efficient driver to use with ADODB to access a MySQL5 Database ?

I've been using ADODB for PHP on several projects for quite some time, and I like it for the ease of use and the efficiency. I've never been too curious about the way that lib accesses data because you know...it just worked :) But today I realized I'm still relying on the legacy MySQL4 ADODB drivers. I'm using MySQL 5.x, and it would pr...

If a URL contains a quote how do you specify the rel=canonical value?

Say the path of your URL is: /thisisa"quote/helloworld/ Then how do you create the rel=canonical URL? Is this kosher? <link rel="canonical" href="/thisisa&amp;quot;/helloworld/" /> UPDATE To clarify, I'm getting a form submission, I need to convert part of the query string into the URL. So the steps are: .htaccess does the redi...

AJAX change page content

I have used AJAX to successfully change the content of a web page. I can include another web page from my domain but the problem I have is making the hyperlinks to work. If the hyperlinks use relative addressing then that will not work relative to the page I am including it in so I was investigating php to parse the html tag as I read i...

PHP - I can't trim off the last character which is a space

My HTML form: <form action="http://localhost/wordpress" id="search" method="get"> <input type="text" size="30" id="s" name="s" value="Type and hit enter" onfocus="javascript:this.value='';" onblur="javascript:this.value='Type and hit enter';"/> <br/> <input type="submit" value="Search"/> </form> My PHP script: <div class="message"> Y...

kohana transaction with orm

is it possible (how) to use mysql transactions and rollbacks using kohana ORM ? ...

PHP choose the side a die has?

The php section of my code is not doing the correct operations when the user submits his/her number, for example, if the user submits 5, I want the rand function to randomly output 5 as the number selected; however, my code sometimes works and at other times does not work. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "...

php: get_headers Function Results Are Different

i using get_headers Function in PHP to request headers from website in local server return arrays put when use in my website Does not return arrays examples for returns in local server Array ( [0] => HTTP/1.1 301 Moved [Server] => Array ( [0] => nginx/0.7.42 [1] => Apache/2.2.11 (Unix) mod_ssl...

Server testing a PHP app

I have a PHP application that will be accepting image uploads and I'm expecting ~20,000 in about 2 days. I have no concept of how much traffic my server can handle... How would I go about simulating this beforehand to make sure it works ok? I know Rails has systems that make testing easy, but what tools might I use to simulate uploads an...

mySQL/PHP to update if the row exists or else insert when column to check is not unique

I have read about REPLACE and INSERT ON DUPLICATE key queries, and while I can see how useful they are, they don't appear to work for my purposes. Perhaps my database design is off from how it should be, but either way I hope I can get this working. I am trying to mock up an online store to teach myself mysql and php, and I am recording...

Entering Dates into mysql database using sql INSERT

A better suggestion on how to approach this then what I have done so far would be appreciated. Right now the dates have to be entered in the correct format year-month-day. Is there a way to automate this task more, with drop downs, just not sure how you would combine the information from the drop downs to submit to one field with my sql ...

Trouble with scraping

I'm trying to scrape some pages, from a list on a text file, from a domain and save them onto my server. I have the following code (with the domain obscured), culling from a text file list of the file directories, and then copying the file names, but with .html appended. For some reason, its creating the files without actually success...