php5

PHP Session Id changes between pages

Hi All, I have a problem where i am losing the PHP session between 2 pages. The session_start() is included in a file called session-inc.php into every page requiring a session to be set. This works for all pages on the site except one particular page, member-profile.php. When this page is visited a new session with a different id (s...

PHP empty() on __get accessor

Using PHP 5.3 I'm experiencing weird / non-intuitive behavior when applying empty() to dynamic object properties fetched via the __get() overload function. Consider the following code snippet: <?php class Test { protected $_data= array( 'id'=> 23, 'name'=> 'my string' ); function __get($k) { return $this->_data[$k]; ...

PHP monitor VPN connection

I have a a sonicwall nsa 4500 and i would like to monitor the vpn tunnels on it. Is this possible? I have walked the snmp and I didn't see anything that was related to VPN tunnels. Anyone have ideas on this? ...

Symfony Model Callback Equivalent

I'm working on a Symfony project (my first) where I have to retrieve, from my Widget class, a set of widgets that belong to a Page. Before returning the results, though, I need to verify--against an external service--that the user is authorized to view each widget. If not, of course, I need to remove the widget from the result set. Usin...

Logics between php mail(), sendmail(), using SMTP in php

what is the main Logics between php mail(), sendmail(), using SMTP in php why we are creating [email protected], [email protected],... and so on. Is there any problem in this? WE are building Newsletter management which we try to sent minimum 6000 mails per day. Our domain is in dedicated sever. WE are trying to sent 10,000 mails...

Doctrine listener - run action only if a field has changed

How do I check if field has changed? I'd like to trigger an action in preSave() only if specific field has changed, e.q. public function preSave() { if ($bodyBefore != $bodyNow) { $this->html = $this->_htmlify($bodyNow); } } The question is how to get this $bodyBefore and $bodyNow :) ...

PHP, Return everything to the left, strrchr() ?

Hello! The following code returns everything to right of the last occurrence of a dash: $string1 = 'some-random-string-123456'; $string2 = strrchr($string1, '-'); echo $string2; output: -123456 is there a function that will return everything to the left of the last dash? so the out put would be: some-random-string Thanks! ...

better implementaion of a global Zend_Log instance?

Is there a better way to have a globally accessible Zend_Log object? In Bootstrap.php I'm doing: protected function _initLogging() { $logger = new Zend_Log(); $writer = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../app.log'); $logger->addWriter($writer); Zend_Registry::set('log', $logger); } Then throughout the a...

Understanding Smarty and MVC Frameworks

Hello there, I just created this thread to discuss with people who have adopted the smarty system, and how many time it took to you to understand it, because i just can't get the idea, instead of making every easier as everybody says i think it just make more complex to code. More than a problem with only smarty is with the whole MVC m...

PHP Regular expression, how to match the first section which includes a [ symbol?

Hi Guys ive tried to search for this answer all morning, but with no luck, all i want to do is match [slideshow or [gallery with the included [ bracket.. code as follows. $gallery = get_post_meta($post->ID, 'gallery', true); if (preg_match("|^/[slideshow", $gallery)) { echo "Slideshow was forund"; } else if (preg_match("|^/[ngga...

PHP - JSON Data Parsing

All, I have the following JSON Data. I need help writing a function in PHP which takes a categoryid and returns all URLs belonging to it in an array. Something like this:: <?php function returnCategoryURLs(catId) { //Parse the JSON data here.. return URLArray; } ?> { "jsondata": [ { "categoryid": [ ...

Debugging PHP on NetBeans 6.8 without Apache

Hi all. Is it possible to debug PHP projects on Glashfish with NetBeans 6.8 without installing Apache server? After I press CTRL+F5 im getting 404 not found error. As ASP.NET developer I have (I think) similiar developer server bundled with Visual Studio, so there is no need to install any other server like IIS. Am I right that Glassfi...

accessing images

I am new to Symfony. I created a layout page in which I have this : <img src="images/header.jpg" width="790" height="228" alt="" /> but the image isn't displayed in the page when accessed from the browser. I put the file header.jpg in the web/images/ folder. I thought I could learn Symfony in a week while working on a small projec...

php code is not executing?

<?php class abhi { var $contents="default_abhi"; function abhi($contents) { $this->$contents = $contents; } function get_whats_there() { return $this->$contents; } } $abhilash = new abhi("abhibutu"); echo $abhilash->get_whats_there(); ?> i've initialized variable contents a default and a...

how do i insert html markup into a new html page using php?

I have a php script that uses a $content variable to write text to a newly created html page that is empty. my php script works great using regular ascii text. when i try to insert html markup tags i get an error and script stops working. here is an example. the html write doesn't work no matter what html tags i use. $Content = "echo...

difference between php and php5

i want to study oops related php, mainly for mashups and some development. I started with php n mysql, whats main relation or difference b/w php and php5. Is there anything like different php for web development and other php for software development?? guide me some books with php oops examples and concepts......... ...

echo not displaying value on page

I have used "echo $query" to see whether it is getting value or not but it is not showing anything on the page. What is the other way to see what value it is getting? I use Aptana Studio 2.0 PDT but I am not able to set the breakpoints. Quite new in it. <?php error_reporting(E_ALL); ini_set('display_errors', '1'); $ulName = $_GET[...

Problem with getting ID after inserting a record that has relation in Doctrine

Problem was solved check my answer Hi, I'm having a trouble with getting the id after inserting a new Record using PHP Doctrine Project. In inserting a new record in a table with no parent table (no foreign key) no problem happens. But when inserting a related record here comes the problem, that I get only the parent id which is use...

PHP Access sub property by name at runtime

Hello! Is it possible to access a sub-property of an object dynamically? I managed it to access the properties of an object, but not the properties of a sub-object. Here is an example of the things I want to do: class SubTest { public $age; public function __construct($age) { $this->age = $age; } } class Test...

Unable to decode JSON stripslashed String?

Does anyone know why this happens? var_dump(json_decode(stripslashes(json_encode(array("O'Reiley"))))); // array(1) { [0]=> string(8) "O'Reiley" } var_dump(json_decode(stripslashes(json_encode(array("O\'Reiley"))))); // NULL Are ' used at all by the JSON functions? ...