php

automated find/replace soltion for scripts (php)

I need a function/class/or some kind of sophisticated find/ replace solution for this problem Have a huge form with lot of: 1: input tags like this one <input id="Id" name="Id" class="element text large" value="" type="text" /> which needs to be "changed/replaced" to this one <div class="element text large" id="username"><?php ec...

PHP fopen using file mask

Is it possible/how can I open a text file in PHP using a file mask? The files are going to be named for example: abcdef_072810_999222.txt abcdef_072910_123456.txt abcdef_073010_888884.txt So I want to fopen or rename the file like this (notice the * mask) : "abcdef_".date("mdy")."_*.txt" I would like to avoid a read directory conte...

DOMPDF 0.5.1 - new server environment breaks PDF output formatting

I'm using DOMPDF to generate PDFs inside of a symfony application. On my current production server, it works great. I was tasked with moving it to a new server. I checked out the code on the new server, and while it does generate a PDF still, most of the formatting is broken. Here's an example of what happens: http://geoffreymaddock....

if xml element exists, exit or skip

how do i check in xml [with php dom] that if a particular element exists, it should not repeat it. for example, if i have an element 'activity', it should check against the xml file if this element exists, and if it does, it will not create it again. in other words, i would like to create the element 'activity' only once in the beginnin...

Using preg_replace without destroying id information

I'm trying to hack about some sidebar code in a Wordpress template I'm developing. Basically I've captured what I need in an output buffer and I'm running regex over it to replace bits with the code I need. Problem is my regex knowledge is just a bit short on what I need to achieve. The problem I'm having is as such: $output = preg_rep...

Pear Authentication

Has anyone ever tried to use SHA-256 or SHA-512 with PEAR AUTH? MD5 works perfectly however, nothing happens when you set the cryptType to 'cryptType' => 'sha256' The page will just reload. I'm using MDB2 With this. Code is here: http://pastie.org/1065896 ...

php openssl encrypt data with aes256 and use a sha256 hashed pass help!

openssl only accepting half of a sha256 hashed password $encryptedkey = openssl_encrypt ($data, 'AES256', "$sha256", $raw_output = false); hash looks like this:a0461cea77b9942addee32b2265b32ebcf150426e2490810938ab47206fd320b its only accepting 32 characters of it:a0461cea77b9942addee32b2265b32eb how can i fix this? thank you! edit: exa...

Handle mail bounce with PHP

I'm tring to handle errors from bounced email. This is my scenario: Send emails out with Pear Mail() +Mail_Mime(); Set 'Return-Path'and 'Return-Recipient-To' to get errors in "[email protected]"; Now using a class mentioned here (http://stackoverflow.com/questions/1097382/how-to-handle-mail-delivery-errors-with-php) I want to...

safe html filtering with php ?

function validCleanHtml( $unclosedString ) { preg_match_all( "/<([^\/]\w*)>/", $closedString = $unclosedString, $tags ); for ( $i = count( $tags[1] ) - 1; $i >= 0; $i-- ) { $tag = $tags[1][$i]; if ( substr_count( $closedString, "</$tag>" ) < substr_count( $closedString, "<$tag>" ) ) $closedString ....

Search for a value in where clause from Serialized Array

Hello, The title could be confusing, but I think my doubt is clear. I'll explain. I'm doing this query: $sql = 'SELECT * FROM calendar WHERE day = "'.$day.'" AND month = "'.$month.'" AND year = "'.$year.'" AND realizada = 0 AND colaborador = "What to put here?!"'; But the field "colaborador" is a serialized array. One example, whe...

Send multiple galleries grouped together via one link in an email.

Hello all, Are there any galleries which allow for one time grouping to send as a link in an email to clients? I need to be able to send 3 or 4 slideshows from folders off my server in an email with details. I would imagine some kind of a CMS but nothing I have seen online has had this ability. Thanks in advance. Jesse ...

WordPress: Category RSS link on single.php

On single.php I want to display a list of categories, similar to the one using the_category but instead links to archive of these categories, I want links to RSS feed of these categories. Is there a way to do this, without a plugin? Thanks in advance for all your answers. ...

getting rid of the ending of the url

I am using php and i want the part of the url without the /floor-plans/dsafasd so i want something/whatever instead of something/whatever/floor-plans/dsafasd ...

return words spaces numbers or match everything expect special chars like *&$!^& ?

ok i have some string 'Hello^<php>World&*124>< i ju*st press enteR' how do i return it to ( a function is better ? ) 'Hello World123 i just press enter' allow numbers text spaces , newline , etc how do i do that with a regex? do i have to use regex? is there a another way ? Thanks Adam Ramadhan ...

php - get numeric index of associative array

I got an associative array and I need to find the numeric position of a key. I could loop through to find it but but is there a better way build into php? $a = array( 'blue' => 'nice', 'car' => 'fast', 'number' => 'none' ); // echo (find numeric index of $a['car']); // output: 1 ...

Register a function to be run in PHP when sessions are destroyed

I would like a function to run whenever a session is destroyed. I've looked into using session_set_save_handler but I don't want to manually handle the storage of sessions, I just want to do a little processing when they're destroyed. Is there any way to do this without using session_set_save_handler? ...

How to insert PHP code into WordPress Custom Fields

I'm trying to figure out how to put PHP code into a custom field, but so far all that happens is that it displays the code literally, instead of executing it. So, how would I go about getting the PHP I'm inserting into a custom field to actually execute?—rather than display it like it was plain text. ...

DELETING any record in any table in the database if feildx=123

is there a mysql statemnet that goes through every table in a data base and says if applicationid =123 or schoolid=123 or familyid = 123 DELETE THE WHOLE record? i need to write a php script that will do this. ...

Help with applying exception in preg_replace

Hello How can I can I allow only digit [^0-9] and a minus sign in front the digit. Example : Valid = -1...-9, Invalid = --1-... ...

Wordpress, if function returns "nothing".

I am building a wordpress theme I want to have the next and previous DIV only appear IF their is a next and previous button available. If there is 10 posts and the display limit is 10 posts I don't want an empty div. However when there are 20 posts and the display limit is 10 I want the next and previous buttons to show in there own di...