php

Parse error: syntax error, unexpected ',', expecting '}' in here on line 3

function validText ( $input, $min = null, $max = null ) { if ( !empty($min) && !empty($max) ) { $text = "^[a-zA-Z\s0-9]{$min,$max}+$"; } else { $text = "/^[a-zA-Z\s0-9]+$/"; } if ( preg_match( $text, $input ) ) { return true; } else { return false; } } whats the p...

Why does dojo work when using CDN but not when using $this->dojo->setLocalPath (using Zend Dojo)?

I have been using Dojo hosted on Google's CDN. I just downloaded the development version so I can do some debugging. When using dojo stored locally, Firebug reports several syntax errors. They all look like this: SyntaxError: syntax error (no script)(""en-us"")bootstrap.js (line 601) (no script)(""dojo.cldr"", ""number"")bootstrap.js...

pclzip dies with a certain file

Hi, I am using pclzip library to compress files at server level. It works fine, except with one batch of files where the routine dies when adding a certain files. No error messages, the PHP just ends with a blank screen. I assumed this was maybe because the file was a 15MB docx, so I raised the PHP memory limit in the INI to 32MB, but...

Automatic highlight code in a wordpress blog

Hi, I've a self installed wordpres blog full of Python snippets and I'd like to have them highlighted (source code colored). I tried to install a couple of plugins like wp-syntax and Jquery.Syntax but they require me to edit all my posts adding some attrs to the pre tags. How can I hack into the plugins or wordpress in other to apply t...

problem with passing variables with php

I'm trying to pass variables using "get" in php, but ran into a snag. Here's my PHP file: <?php include '../includes/header.php'; ?> <div id="page"> <div id="content"> <h3><?php $_GET['head']; ?></h3> <div id="screenshots"> <img src="../images/sites/<?php $_GET['img1']; ?>" /> <img src="../images/sites/<?php $_GET['img2']; ?>...

PHP getting the PHP file

Is there any way to get the source file of PHP like you would for HTML file or javascript from web browser alone? If so how? If not why? ...

Trying to get Product Name and product ID into url with slash at the end and in between without ?p=

Hello, I guess the title almost says it all. My original url looks like: http://www.something.com/buy/index.php?p=025823 The .htaccess I'm using looks like this: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(\d+)*$ ./index.php?p=$1 The resulting url...

Running symfony unit test returns "There is no open connection"

Symfony seems to have a problem opening a database connection while running unit test. I have my test env specified in config/databases.yml: all: doctrine: class: sfDoctrineDatabase param: dsn: 'mysql:host=localhost;dbname=ms' username: ms password: xxx test: doctrine: class: sfDoctrineDatabase par...

PHP sendmail() formatting not preserved

Hello, I am creating a web application for a client that has the ability to send out emails. I am using TinyMCE for my text editor, which works quite nicely. I am using sendmail() with PHP Swiftmailer to handle the actual sending of the email. Swiftmailer works nicely, as well. The only problem that I am running into is that when I rec...

YouTube API with PHP white screen

Trying to make this code work... when I upload to my server hosted at www.globat.com--- I just get a white screen... no display. Help. What am I doing wrong? Listing videos in a category // read feed into SimpleXML object $sxml = simplexml_load_file($feedURL); // get summary counts from opensearch: namespace $cou...

php, long and deep matrix

Hi, I have a deep and long array (matrix). I only know the product ID. How found way to product? Sample an array of (but as I said, it can be very long and deep): Array( [apple] => Array( [new] => Array( [0] => Array([id] => 1) [1] => Array([id] => 2)) ...

Simple regular expression to get text between <br/> and next <br/>

I have a string that contains this (and another things): <b>SINOPSIS:</b><br/> Text text text and mooore text...<br/> I need a reg-ex to get the text between those first two <br/> tags. Thanks... Note: There are more <br/> tags. I need the first occurrence only.. I will be using PHPs preg_match() function. ...

Maintaining state between browser tabs in PHP

I'm building a web application that allows users to run a query against one of two databases. They are only allowed to submit 1 query to each database at a time. Currently, I'm setting $_SESSION['runningAdvancedQuery'] (for instance) to let me know if they're running a query. This is to prevent someone from opening up a 2nd browser tab a...

How to program an application with unknown future modifications and features?

Background I'm not new to programming, however I am when it comes to handling clients and their needs. Here's my history with my current client: I inherited a PHP application with it being 2/3 completed, continued to make it 100% completed until the client wanted (major) features that caused the application and database to need to be re...

PHP SESSIONS Question.

When a user logs in should I sanitize there logged in $_SESSION['user_id'] user id or not? for example, like in the following code below. mysqli_real_escape_string($mysqli, htmlentities(strip_tags($_SESSION['user_id']))); ...

PHP xml parser is cutting urls inside node

Why does parser is cutting url to this: inside node: http://img844.imageshack.us/content.php?page=done&amp;amp;l=img844/4783/php4dd.jpg after parse: [done_page] => l=img844/8828/php4e8.jpg private function _parse($result) { $XMLparser = xml_parser_create('UTF-8'); xml_set_element_handler( $XMLparser, Array($this, 's...

PHP Show Differences

I have two strings: $stringA = "1,2,3,4"; $stringB = "1,2,4,5"; I want to pick out the values from $stringB that are not in $stringA. How can I do that? ...

Is there a way to determine if a page is compressed or not?

I'm writing a script that can determine if a page is compressed or not, and I've been doing a bit of research and cannot figure out how to determine if a page is compressed. I'd assume that a page compressed would have something in the headers to say that it is a compressed file. Like Content-Type or something. Any help is appreciated. ...

Using JQgrid and sortableRows. Update table row order

Using: http://stackoverflow.com/questions/2382879/using-sortablerows-and-know-when-rows-have-been-moved I have been able to call an alert after the modification of my row order. How would I send this data to PHP/ call the editurl passing this data, similar to when adding or editing rows the editurl receives a $_POST['oper'] variable? ...

Complicated array, how would I set this up and check values against it?

My data pulling looks like this so far: <?php include '/classes.php'; include '/icon_ids.php'; $conndb = new conndb($db_host, $db_port,$db_user, $db_pass, $db_name); $data = new data($conndb); echo $findDisplayIcon[$data->getDisplayID($data->getMainBackpack[23]['entryid'])); ?> Overview: I'm finding an ItemID# in a...