php

Retreive elements of XML page via PHP

Hi, I'm trying to wrap my head around PHP and XML. I'm trying to do something: There is an XML document that I'm retrieving via cURL (also tried various PHP XML library parameters such as XMLReader::open($url) etc. The method of retrieval doesn't matter; I can and have got this part working. The problem is parsing the XML on the re...

How to use single quotes inside single quotes?

Hello. Can anyone explain how to make this code work? echo '<div id="panel1-under">Welcome <?php echo "$_SESSION['username']"; ?></div>'; I've tried removing the single quotes so it's like this: - "$_SESSION[username]" but it doesn't work. Appreciate any help. Thanks! ...

jQuery Pagination Question

So I have the following jQuery pagination plugin installed. http://d-scribe.de/webtools/jquery-pagination/lib/jquery_pagination/README I understand how to create the pagination navigation, but not quite sure how to implement a new server call everytime a new page is clicked. Below I've mapped out the steps that I currently have built ...

Passing values to formmail.cgi without refresh (HTML form PHP handling)

My host has a formmail.cgi script to send html form data to emails (http://formmail.dreamhost.com/), but I dont understand how to pass it values that it understands. Ive tried using this method to pass form values: HTML: <form id="contact_form" action="http://formmail.dreamhost.com/cgi-bin/formmail.cgi" method="POST"> <input type=...

How to check whether Suhosin is installed?

I'm not familiar with Suhosin (never used it) but if possible I need to check using PHP whether it is installed. This is for part of an installer that I'm writing. Thanks. ...

'+' character not saving through CKEditor/PHP/MySQL/HTMLPurifier

Hi there, I am trying to get UTF-8 encoding working with CKEditor/PHP/MySQL/HTMLPurifier. I have converted the character sets of the database tables/fields to utf8-unicode-ci. I have set the following in the ckeditor config: config.entities = true; config.entities_latin = true; config.entities_greek = true; config.entitles_processNum...

How do you strip whitespace from an array using PHP?

I was wondering how can I strip white space from an array using PHP? ...

Foreach loop brings to Fatal error: Call to a member function bindParam() on a non-object

Hi there, That's the first time i get an error like this one, let me explain : Here is my code : function printSiteIndexedItems($co, $id){ global $allSections; foreach($allSections as $aSection => $aSectionName){ $tr = $co->prepare("SELECT COUNT(id) FROM ". $aSection ." WHERE site=:id AND valide=1"); $tr->bindParam(':id', $i...

How do you strip whitespace from user submitted data that is not an array PHP?

I was wondering how can I strip white space from elements that are just whitespace and whitespace from all elements from user submitted data using PHP? ...

Calculating an End Date

I need a bit of help using symfony to calculate an end date. The user will select a start date, a frequency (Ex. Every 7 Days, Every 14 Days, Every Month, Semi-Annually - Every 6 Months, etc), and the number of occurrences. Examples: Start date: 08/01/2010 Frequency: Every 7 days Occurrences: 4 End Date = 08/29/2010 Start date: 08/01/...

PHP not decoding POST

Hey there, Is it normal for PHP not to decode $_POST sent as application/x-www-form-urlencoded through AJAX? I want to use urldecode but it gets rid of my + characters. Help? : 15:51:55.490[755ms][total 755ms] Status: 200[OK] POST Load Flags[LOAD_BYPASS_CACHE LOAD_BACKGROUND ] Content Size[72] Mime Type[text/html] Request Heade...

What are namespaces?

What is PHP Namespace(s)? What is Namespaces in general? A Layman answer with an Example would be great. Thank you in advance ;-) ...

class object in class with php oop

I am not even sure how to ask. I do this all the time in C# but for the life of me I cannot find any decent examples in PHP. Can you help? What I am trying to do is for example. Say I have a class called Company who has many Employees. I want to be able to store all the employees in the company class then later when I iterate throug...

URL file-access is disabled in the server ------> SOLUTION?

I Know this is a problem in the php.ini which comes with a default allow_url_fopen = Off and allow_url_include = Off How could i deal with this... if the hosting place dont change this.. im trying to access an outside url totally diferent from mine, so the server root thing wont work.. what could i do? ...

Return sql query as array

Hello, I'm using jqueryui and its Autocomplete plugin. It use a json to extract items. I want to modify it so that items will be extracted from my db. Here is how items should be : $items = array( "Great <em>Bittern</em>"=>"Botaurus stellaris", "Great2 <em>Bittern</em>"=>"Botaurus stellaris 2" ); How to make an sql query that extra...

preg_replace_callback stuck

I have an array of URLs I'm running thru an included preg_replace_callback function, the idea being that each loop will yield a new result. Problem is that it keeps outputting only the first result, as if it stalls after processing the first URL. Here is the code: if (!function_exists('name')) { function name($match) { return($match[1...

Dealing with Zend Authentication failure via AJAX request

I'm currently using a Zend Controller Plugin to check authentication. The following probably looks familiar: class SF_Plugin_Member_Auth extends Zend_Controller_Plugin_Abstract { public function preDispatch(Zend_Controller_Request_Abstract $request) { if (!SF_Auth::getInstance('Member')->hasIdentity()) { if ($r...

PHP Generated Inputs and Standard DOM Inputs display differently.

As you can see the following produces the exact same configuration of Select:Text:Image. However whatever the HELL I do I cannot get them to display the same without different CSS which I do not want to do. I have used CSS resets, Identical CSS, removed attributes etc. Any idea what is making them act so stupidly? It is really starting t...

PHP user entered data problem?

Okay when a user enters tags into the database I strip out HTML elements and separate tags by using a comma , But for some reason when I strip out the html tags an empty value is submitted into the database along with the other tags for example if a user enters the following data. <html>,tag2,tag3,tag4 //an empty value is entered ,tag2,...

CMS: store custom pages as files or in MySQL database?

I am creating a custom CMS in PHP (written from scratch) and want to know whether I should store user created pages as files or in a MySQL database. The content is all HTML code, at least for now. I cannot decide which to do as writing files with php seems like a security risk, and retrieving file contents from MySQL on every page load...