php

Regular Expression, match characters between { }

I'm trying to find text that contains a < or > between { }. This is within HTML and I'm having trouble getting it to be "ungreedy". So I want to find text that matches these strings: {test > 3} {testing >= 3 : comment} {example < 4} I've tried a number of regular expressions, but the all seem to continue past the closing } and includ...

Get all posts from custom taxonomy in Wordpress

Is there a way to get all the posts from a taxonomy in Wordpress ? In taxonomy.php, I have this code that gets the posts from the term related to the current term. $current_query = $wp_query->query_vars; query_posts( array( $current_query['taxonomy'] => $current_query['term'], 'showposts' => 10 ) ); I'd like to create a page with all...

get that rows, WHERE `DAYOFMONTH(<date>)` is devidable on 3?

I have a table in MYSQL DB with date field in YYYY-mm-dd format. i need to get that rows, DAYOFMONTH(<date>) is devidable on 3. Is it possible to do with mysql functions, or i have to write multiple OR conditions? :/ Thanks ...

How do I use cookies to let visitors access to the downloads page of my website.

Hi I want visitors to my website to fill out a contact form before they can access the downloads page. I am looking for online resources or examples. The only ones I can find are username and password authentication which I don't need. I am hoping to do it in PHP. At the moment my Contact form emails me their details but anyone can acce...

pagination and row numbering

I wanna print a incresing number with each post. Like every forum has this. I currently use this: $i = 0; while ($post = mysql_fetch_assoc($rs)): $i++; Lets say i print 5 post per page This is what happens: #1 First post #2 2nd post #3 3rd post #4 4th post #5 5th post Then you go to page to 2 #1 6th post #2 7th post #3 8th post #...

Permissions problems for upload through php

Through the imap_* functions of php i'm trying to store the attachments of the emails on my server. I want to store the contents ($c, string) of the file with filename($f) in a sub-directory named with a thread id ($thread). m_attpath is a defined constant pointing absolute to the base folder. if(!is_dir(m_attpath.$thread)){ ...

How to make ghost fields in Doctrine?

Hello. I have such a model Designer: tableName: designers actAs: I18n: fields: [name] columns: id: type: integer(2) unsigned: true primary: true autoincrement: true name: type: string(30) notnull: true While default I18n behavior must be used like this $d = Doctrine_Query::c...

PHP operator confusion (a beginner's question)

I'm trying to figure out someone else's code and have come across this piece of code: $html = '<div class="event">' . "\n"; if (get ( 'Event_Image' )) { $html .= '<a href="' . get ( 'Event_Image' ) . '">' . '<img src="' . pt () . '?src=' . get ( 'Event_Image' ) . '&amp;w=100" alt="' . get_th...

From the string name of a class, can I get a static variable?

Given the string name of a class in PHP, how can I access one of its static variables? What I'd like to do is this: $className = 'SomeClass'; // assume string was actually handed in as a parameter $foo = $className::$someStaticVar; ...but PHP gives me a lovely "Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM", which appa...

Zend Framework OpenID Consumer

I am using the Zend_OpenId_Consumer to provide OpenID access, the login is working fine, but when I call verify() I am recieving the error `Wrong openid.return_to 'http://[host]/user/openid' != 'http://[host]/user/openid?[OpenIdResponse] The issue as far as I can see is that the verify method is comparing the URL without the query pa...

Warning: Cannot modify header information. Can't find error

Hi! I'm using a login-script and on my developmachine it worked perfectly but when I moved it to my webhost it stopped working. The code can be viewed here: http://beta.yapaste.com/fm The error I get when I login is Warning: Cannot modify header information - headers already sent by (output started at /*/*/*/*/*/*/login.php:10) in /*...

Add a new dimension to a multidimensional array without having the full path.

Hi, Apologies if my title is confusing. I have a table of categories that looks something like this: ID, Name, Parent 1, Cat1, 0 2, Cat1_1, 1 3, Cat1_2, 1 4, Cat2, 0 5, Cat2_1, 4 6, Cat2_1_1, 5 I am trying to get this into a multidimensional array so that the category tree is available in its correct format for displ...

How to position a element (drop down menu item) exactly below the parent menu

I am trying to place a dropdown menu item below the parent menu. When u hover on the parent menu, the child dropdown menu item's visibility will turn visible. I positioned the child elements using position:absolute and using top and left. But when i change the resolution of the monitor the left and top alignment changes How to positi...

Zend Framework and Preventing Fat Controllers

Avoiding Fat Controller So I'm using Zend Framework and I have a question involving preventing fat controllers with one of my actions. Basically I am normalizing a CSV file into my database. This means that I have to get the feed and then use my model. The feed grabbing is just there to show how it works, but that is now an Action Hel...

PHP Redirection (301) hiding query string

Hi there, I'm trying to redirect a page using PHP (I think it has to be PHP as opposed to .htaccess as there are a lot of pages involved and the information required to do the redirect is held in a datbase). The page i'm trying to to a redirect from is already re-written, and looks like: www.example.com/shop/deptartment/section/produc...

html link in php mail

I have the following code to send an email to the users. $mes_body.="Click to Login. www.website.com/index.php\n\n"; $mes_body.= "<a href='www.website.com/index.php'>Click to Login.</a>\n\n"; Right now i am seeing the email as : Click to Login. www.website.com/index.php <a href='www.website.com/index.php'>Click to Login.</a> Wha...

Insert string between two points with PHP

How would I insert text between two comments like the ones below with PHP. Thanks in advance. <!-- BEGIN INSERT 1 --> <!-- END INSERT 1 --> ...

Regex Unclosed Quote

Hi all, I am trying to figure out a way to read a CSV with returns in it in PHP. The problem is when you read the file like this: if (($handle = fopen($file, "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { row data... } } If you have a retun in the CSV it does not work, it just sees the retur...

Apache LAMP Stack, what is producing the "Service temporarily unavailable." error?

I have a simple LAMP stack with a php REST API. Periodically, the server returns the following error xml: <Error> − <reason> Service temporarily unavailable. Please try again later. </reason> </Error> What is producing this error? Is it Apache? I search the Apache logs and was unable to find any errors that would indicate this type o...

Automated login and password storage

Hello, I wrote a simple PHP script to log into my mobile phone provider's website, check my balance, and send me an email if it's too low. I put the script on a distant server. It seems that I have to store my password as plaintext in the script to be able to send it to the login page. However, I am a little bit reluctant to do this......