php

I have 2 dates in PHP, how can I run a foreach loop to go through all of those days?

I'm starting with 2010-05-01 and ending with 2010-05-10... how can I iterate through all of those dates? ...

magento product popup

I'd like to create a popup window for products instead of directing to another page. I'm looking for advice on the best way to basically make a copy of the product view template to modify for my needs without having to create separate models and blocks. I'm using version 1.3.2.2. Let me know if anything needs clarification. I realize th...

How to get full text of request (not response) headers?

Hello, I have to ensure that curl is sending cookies propertly, so I should view full text of request (not response!) http headers. Is there any way to do it? Thank you ...

Is there a __get magic method equivalent for instantiating classes?

Looking to see if there is any way to implement the kind of functionality of the __get() magic method, but when trying to instantiate a new class. My goal is to have $foo = new Cat(); Ultimately result in the creation of a generic object, i.e. new Mammal('Cat'); Such that $foo would be an instance of the class Mammal, with the calle...

Sanitizing Integer Database Input

Hey guys, I have an application that takes data via a POST request. I am using this data to insert a new row into the database. I know that using mysql_real_escape_string() (plus removing % and _) is the way to go for strings, but what about integer values? Right now, I am using the PHP function intval() on them. However, I wanted to m...

How to programatically add post to Wordpress blog from outside in PHP

I would like to add a post to my Wordpress based blog (my own hosting) from outside of this blog using PHP. In short terms i would like to do something like this: http://www.mywebsite.com/addPost.php Adds example post to my blog and thats all i need. How to do this? ...

How do make magento use a different category than 'Default Category' to generate the header-nav?

I have 4 categories within the 'Default Category' category. Currently by default Magento is generating the header-nav from 'Default Category', and displaying the 4 categories at the top of my site. The "Products" category is in the "Default Cateogry". Inside the "Products" category are the sub categories that i want to have displayed o...

In-page contact form with pop-up form validation and verification

I am looking for a script to send an email. My form is coded in the page with no room for messages. I would like a script that validates the form with a popup and tells the user the email has been sent with the same pop up. Any suggestions? ...

Anybody ever used PayPal Website Payments Standard with SESSION variables?

Note: Our site is built in PHP and uses MySQL databases. I already manage another site with shopping cart in its entirety using Authorize.net so please dont respond with suggestions to use another provider. A new product/service we are releasing is classified as "High Risk" to the merchant providers and they want to charge us out the a**...

Download Email Attachments via Simulataneous Cron Jobs -- Race Condition

I need a cron job to check email accounts and download certain attachments. This cron job will be running every minute. My problem is that when the first script is downloading email attachments, a second (or third or fourth ...) script will most likley be running alongside the previously executed script. The problem is that I am not sure...

PHP script that reads external HTML source code and lists the code between the tags

Basically I want to write php code that lists all the contents that are between <h1> tags from external url. I don't want just the first but all of them. So if the source of the external website is <html> <title></title> <head></head> <h1>Test Here</h1> <h1>Test here</h1> </html> I want to make a script that generates only th...

Querying Data Type of a Field in MongoDB

In MongoDB, using $type, it is possible to filter a search based on if the field matches a BSON data type (see DOCS). For eg. > db.posts.find({date2: {$type: 9}}, {date2: 1}) { "_id" : ObjectId("4c0ec11e8fd2e65c0b010000"), "date2" : "Fri Jul 09 2010 08:25 :26 GMT" } I need a query that will tell me what the actual type of the field i...

How to "save" my wordpress blog's posts in same url format and remove wordpress?

Hello, I have a Wordpress blog running on my site and I have no time to continuously upgrade the software and I pretty much want to remove wordpress. It's broken at this point anyway, I can't really get into the admin area, but I suppose I could try to hack my way through. Anyway, I'd like to save the posts that I have and keep them un...

Getting PHP variables and their values from SQL COUNT() and GROUP BY

I'm trying to extract and make variables out of the "thinking skills" (like analyzing, evaluating, etc.) from a test and set their value to the number of test items within each. I'm stuck, so any help would be appreciated. (The SQL statement seems to work fine.) Example of what I want: $analyzing = 7, $applying = 13, etc.... Thanks! ...

Str Replace and Adding Space?

I used one solution to fix one problem, then when I went to fix another problem, it made the other problem occur again. I'm currently using this to replace spaces with dashes. $var2 = str_replace(' ', '-', $var2); Now say $var2 is an address, so 5019 Hill Street. I had it set to add a %20 to numerals so that it would say it as 5 0 ...

php (fuzzy) search matching

if anyone has ever submitted a story to digg, it checks whether or not the story is already submitted, I assume by a fuzzy search. I would like to implement something similar and want to know if they are using a php class that is open source? Soundex isnt doing it, sentences/strings can be up to 250chars in length ...

Which file structure would be most appropriate for codeigniter?

Hello there I am having some thoughts on my file structure in codeigniter.What I'm doing right now is creating a folder with the project I'm developing for and name it let's say "myProject" then I put my codeigiter folder inside that file.And then everything is done normally as by creating a class called myProject again on the controller...

Creating a OpenID Provider in PHP

I have an existing website that I want to turn into an OpenID provider. All my user accounts are stored in a mysql table. I figured since an OpenID is represented as a URL, I am going to do something like: http://login.mydomain.com/username I've setup a subdomain, and created an htaccess that redirects all URLs to /login.php?username=[...

PHP functions not available - json_decode

Based on my php_info() my PHP version is PHP Version 5.2.9 However, for some reason when i try and use json_decode, I receive an error that the function is not found (and it should be for PHP 5.2 and up). PHP.net suggests I check the configure command: './configure' '--prefix=/usr/local/php5' '--with-config-file-scan-dir=/usr/local/p...

PHP and Runtime Subclassing / Object reclassification

Hi guys, Basic setup. I have a classA instance which is a subclass of classX ... On construction (or sometime else), I want it to load another class classB which is also a subclass of classX and replace itself with classB in situ. Sort of like a factory, but one that replaces itself transparently. If need be, I can wrap classB with clas...