php

How to change urls generated by admin generator. Also how to return 404 for backend.php

I am using Symfony 1.2.9 (with Propel ORM), to build a website. I have obly started using the admin generator. I have got the admin generator to work so far (thanks to the folks here at SO). The one remaining thing is that I want to change the urls generated by the admin generator. I dont like the fact that it lists the module names pla...

Quick regexp needed for parsing a string

I have a few strings in the following format: S25 22.087 E152 46.125 S23 32.230 E148 10.576 S25 00.039 E152 12.480 S26 19.496 E152 43.501 I would like to parse the strings and split them into two parts, so: $foo = 'S25 22.087 E152 46.125'; would become: $foo[0] = 'S25 22.087'; $foo[1] = 'E152 46.125'; (it doesn't have to be in an ...

Changing CRC of a file through readfile()

I have this code set up that lets a user download a file through my server from a URL they specify. The file streams through using readfile() so it only uses my bandwidth. <?php set_time_limit(0); $urlParts = explode("/", $_SERVER['PHP_SELF']); $file = $urlParts[3]; header("Cache-Control: public, must-revalidate"); header("Pragma: ha...

How can I use a class made in PHP?

I have a ready made PHP class. Now how can I use that class or implement it in my page. How would I go about doing this? ...

PHPUnit Exception testing, error message messes up results output

Hi, my question regarding phpunit for testing exceptions using the command line tool. I can't seem to correctly do this, the error message of the exception just prints out, making the command line window harder to read. Below is how my code is structured and the test code. public function availableFruits($fruit) { switch($fruit) { ...

converting videos with php and ffmpeg

how can i upload and convert the video to mp4 behind the scene so that if user uploads a video than the user could work/visit on rest of site and once the video is converted it displays in the users control panel....!! i want to do this without ffmpeg........ if there is no way out than i will want to use ffmpeg.....!! ...

Pass adodb connection to new php object

Hi, I'm trying to pass through an adodb connection to a class constructor but in doing so get this error: mysql_error(): supplied argument is not a valid MySQL-Link resource So to put it into context, I have instantiated a new adodb connection like this: // establish database connection $db = ADONewConnection($dsn); if (!$db) die(m...

How to update data in database without removing the old data?

hi, i would like to know how this can be done. lets say i have this in my database "first" and if i want to update and add the "second" in which i can have this format "first, second". i used this UPDATE table SET number="second" but it removes the "first". i am using php and mysql, thank you ...

zend session problem

I have a strange problem with Zend Session. I've build a website base in zend frame work and I use Zend_session to store the infos of a log-in user. It's work fine but when I use uploadify to let user upload file to server, i think the uploadify create new session in server and I cannot access the old session i store by Zend_session_nam...

Adding interactions to admin pages generated by the admin generator

I am using Symfony 1.2.9 (with Propel ORM) to create a website. I have started using the admin generator to implement the admin functionality. I have come accross a slight 'problem' however. My models are related (e.g. one table may have several 1:N relations and N:N relations). I have not found a way to address this satisfactorily yet....

Windows XP path problem

My Environmental Variables (& I crosschecked every possible place in the Registry) show my PHP include path as: "C:\PHP\" --and PHP (5.2.9-2) works fine on the system, so that is correct. However, running ini_get("include_path") shows the path as "C:\PHP5\". This causes problems with PEAR, etc. I've searched the system (i.e. php.ini...

Why can't I pass variables into an included file in PHP?

I've had this problem before before with no real resolution. It's happening again so I'm hoping you experts can help. I set a variable on my index.php based on the $_GET array. So I use this code: $admin = isset($_GET['admin']) ? $_GET['admin'] : "dashboard"; Below that, I use a function to include my layout: include_layout("admin_h...

php preg_match problem

how can i get 41P86246HOH7C1G4A983321910HDL63U9 from the following with preg_match input type="text" value="41P86246HOH7C1G4A983321910HDL63U9" id="" ...

execute a query right after connexion in cakePHP

I want to execute a mysql query right after connecting to the database to enable utf-8 SET NAMES 'utf-8' COLLATE 'utf8_unicode_ci' and i want an answer either for a specific model all for the whole application ...

Processing PHP in a database

Hi, I have a basic cms that stores pages in a table in a mysql database - is it possible for me to include PHP in a page and then have PHP process it rather than just output it as-is? ...

syntax error, unexpected '.', expecting ']' in config.php

$dbhost = "10.21.47.198"; $dbuser = "xxxxx"; $dbpass = "xxxxx"; $dbname = "xxxxxx"; $prefix = "art_"; // you can change this prefix but not necessary $cdomain = $_SERVER['SERVER_NAME']=='xxxxxxxxx' ? '' : ".$_SERVER[xxxxxxxxxxx]"; //.yoursite.com $date_format = "F d, Y"; $admin_email = "[email protected]"; the above code is ...

Why do i get a Circular Dependency Exception with these Zend_Application_Resources?

I keep getting the following exception with a new resource Im making and i cant figure out why: PHP Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Circular resource dependency detected' in /opt/local/lib/php/Zend/Application/Bootstrap/BootstrapAbstract.php:656 Stack trace: #0 /opt/local/lib/php/Zen...

php connecting to MediaWiki API and retrieve data

Hi guys, I noticed there was a question somewhat similar to mine, only with c#:link text. Let me explain: I'm very new to the whole web-services implementation and so i'm experiencing some difficulty understanding (especially due to the vague mediawiki api manual). I want to retrieve the entire page as a string in PHP (xml file) and the...

how can I deal with unicode in PHP without mbstring extension

I am using a shared hosting service to host my site so I can't get direct access to PHP configuration or install any extension. So my problem is with utf-8 strings that can't be processed by standard PHP string functions since I don't have mbstring extension installed on the server. I am looking for another way to deal with unicode strin...

Setting include_path in a shared php.ini file

I have 2 Macs whose general configuration I want to keep sync'd. For Apache and PHP, I store the conf files (httpd.conf and php.ini, respectively) in my Dropbox (~/Dropbox/config) and use symlinks to reference the shared from from the expected location. Similarly, I share a couple of code bases in the same way. The physical files are lo...