php5

json post request size limit (now a verified php-mysqli bug)

I'm sending a request to my PHP application through a JSON-encoded ajax request (form process). A post-request with character length of 4174 is successfully processed and the result is received correctly. Adding one additional character to the request causes my application to loop infinitely until Apache2 seg-faults. There are only 2 ...

Why doesn't this PHP preg_replace() work?

I've got some bad MySQL entries that I need to fix. I'm trying to do so in PHP. What I've got: a whole bunch of text with no numbers Entry #: 2439. a whole bunch of text Click here to blah blah blah What I want: a whole bunch of text with no numbers Entry #: 2439. a whole bunch of text <BR><A href="somepage.php?entry_no=2439">Click...

PHP: Storing objects in a Symfony plug-in module's lib/ directory

I am building a Symfony project, and have created a new plug-in named sfUtilsPlugin. I currently have a directory structure that looks like this: sfUtilsPlugin/ modules/ sfSearchLucene/ actions/ config/ lib/ templates/ Now, in the sfUtilsPlugin/modules/sfSearchLucene/lib dir...

PHP: Checking if a directory contains a Zend_Search_Lucene index

I am looking for a reliable way to check to see if a directory contains a Zend_Search_Lucene index. Currently, the only way I have managed to work this out is to check the contents of an exception returned to me using the following code: <?php try { $newIndex = Zend_Search_Lucene::open( $luceneDir ); } catch ( Zend_Search_Lucene_Exc...

How to get user data in form in Symfony 1.2?

I'm using Symfony 1.2 in a standard Propel form class. public function configure() { $this->setWidgets(array( 'graduate_job_title' => new sfWidgetFormInput( array(), array( 'maxlength' => 80, 'size' => 30, 'value' => '' ) ) )); //etc } However, I want the value of this field to come from the user information, which I'd no...

PHP 4 and PHP 5 both running on IIS7

I have a server that hosts a bunch of sites in PHP5. I have an old site that was designed for PHP4 that I also need on the server. Originally, I was just going to port the code to PHP5, but have discovered that process is more intense that I have time for so I need to have PHP4 and PHP5 running on the same Server 2008 box. I think thi...

PHP: Invalid character breaks html

Hello, how should I clean up a string which contains invalid characters and would break html after printing it in textarea? PHP's ord() returns 0 for the said character, but I suspect it's not null, which I don't think it matters anyway. When string is displayed in textarea all text after the invalid character would disappear as well ...

PHP: Outlook style rule engine

I am trying to construct a rule-based system for interpreting data. However, I am having issues deciding on a way to construct the logic for storing and interpreting rules. Currently, there is a database structure that quite complex, but will deal with all aspects of storing the rule data. The idea is that the system will be able to mim...

Another Hosting Question: Linux, Apache2, PHP5, PostGreSQL 8.3

Hello SO, I'm hoping that someone will be able to recommend a good hosting company that provides the following environment. I know that I could just google for one, but I'm asking here first because I'm looking for someone that has previous experience working with such a company. Linux Box. Apache 2.0. PHP5 (5.2.6 to be exact). PostG...

Using DOMXPath to replace a node while maintaining its position ...

Ok, so I had this neat little idea the other night to create a helper class for DOMDOCUMENT that mimics, to some extent, jQuery's ability to manipulate the DOM of an HTML or XML-based string. Instead of css selectors, XPath is used. For example: $Xml->load($source) ->path('//root/items') ->each(function($Context) { e...

How do I properly format this json object in PHP

I need to be able to create a data structure in PHP which creates for instance, an array of car vendors. Each of those arrays, has child arrays which are types of cars for that vendor. So you'd have something like $cars['toyota'] = array("camry", "etc"); I need to be able to create this data structure in PHP so that on the JavaScript ...

Symfony routing problem

I've set a website up. If I try and click on a link such as register I get the following error: 404 | Not Found | sfError404Exception Empty module and/or action after parsing the URL "/trevelyan.alumni/register" (/). The links are generated using <?php print link_to( 'Register', 'register/index' ); ?> And I have a 'regi...

PHP MySQL insert dropping data

Ok this is a new one for me. Basically I have a table articles: id: int auto increment title: varchar(200) description: varchar(1000) ctext: longtext chtml: longtext Now I do an insert into this table with mysql_query: INSERT INTO articles (title, description, ctext, chtml) VALUES ('$title', '$description', '$text', '$html') All v...

How can I remove the NULL character from string

I have a PHP variable that contains a string which represents an XML structure. This string contains ilegal characters that dont let me build a new SimpleXMLElement object from the string. I dont have a way to ask the source of the content to modify their response, so I need to execute some cleaning on this string before I create a Simpl...

PHP: Creating a psuedo-join method inside an object

I am trying to create an object that is capable of handling query-like conditional statements. This is so I can 'join' two conditions together to create a dependency between them based on the type of 'join' being used. I currently have a simple object that contains the following methods: public function addCondition ( Condition $conditi...

Allow php sessions to carry over to subdomains?

Hello I use php sessions (not cookies, except for session id cookie) for all user data, and when a user goes to their profile user.mydomain.com they are immediately "logged out" untill then remove the subdomain. Is there a way to accept sessions from all domains as long as its *.mydomain.com thanks! ...

Having a problem with mysqli and prepared statments.

I have the following function and its always returning false. It does not even try to execute the statement, I know because I changed the $query = "aldfjaf lkjfsk" and it did not return an error for me. Any suggestions? class Mysql { private $conn; function __construct() { $this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB...

Why would print_r ($row); only be returning a number 1?

I am trying to learn PHP5 and am having a couple of problems with it. I am working with prepared statements and am trying to run the following code: <?php require_once 'includes/config.php'; $conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database.'); $query = "SELECT * FROM...

Having problems inserting and updating tables in a database with prepared statements

Very new to PHP5 and have some problems still. I figured out how to Select with prepared statements now trying to insert/update my code is as follows function input_lab_results($name, $image, $descrip) { $query = "INSERT INTO pat_table (pat_name, pat_image, pat_descrip, pat_doctor, pat_resident, pat_create, pat_modify) VALUES (?, ?, ...

How to Best Handle Authentication Via the URL in PHP

I need to be able to send users a link that contains an encrypted value which is used to authenticate the user when they visit the link. The current process uses a salt and roughly 40 character unique hash which is then encrypted and base64 encoded so that it can be safely be transported via email and in theory come back safely through...