php

Assign session variable to class variable while initialize the class variable in PHP

Hi, I have a problem regarding assign session variable to class variable while initialize the class variable. Check my below code <?php class ModifyProfile { var $userType=$_SESSION['wb_user_type']; var $tablename=WB_CUSTOMER_TABLE; var $primarykey="nCustomerID"; } ?> When i run the above code by creating this class o...

Where should I commit a transaction -- in the Stored Procedure or in the calling application code?

I'm using PHP + Oracle and was wondering if there are any recommendations on where to commit my transactions. I call stored procedures to do all my inserts/updates/deletes, and currently am committing at the end of my stored procedures. I was wondering: Is there any difference between calling commit/rollback in my stored procedure vs...

php object within object, getting the top level object instance

I am experimenting with PHP OOP what i'm trying to find out is, Is it possible to access a object instance from withing a object that was created in this object instance? sounds confusing, so here is a example: contents of index class mainclass { var $data; function __construct($data){ $this->data = $...

Symfony (Propel) Admin Generator Behavior - Why does it work like this?

Hi there, I've been having some 'issues' with the admin generator (Propel version). The HTML generation behavior between the list view and the form view is very different, and I'd like to know why, as the form view works better (and as expected) compared to the list view. I have the following YAML for the 'edit' action, edit: action...

PHP: Warning: array_merge_recursive(): recursion detected

I have a list of arrays (unknown amount), I need to merge all of them recursively. So what I did what create an array of all of those arrays and pass them into this function: function mergeMonth($array) { foreach($array as $date_string => $inner_array) { if(isset($temp_inner_array)) { $temp_inner_arr...

XPath - Get root node attributes

Hi, I have an XML document with a basic structure like this: <?xml version="1.0" encoding="UTF-8" ?> <records timestamp="1264777862"> <record></record> <record></record> <record></record> <record></record> </records> I've been using the following so far: $doc = new DOMDocument(); $doc->load('myfile.xml'); $xpath = new DOMXPath($doc)...

Have loaded a php variable into flash but cant apply it in a function...

hi I have created an actionscript function which stops an animation on a specific frame which works fine. I have then loaded in a php file with a variable which will contain the number for the frame i want the animation to stop on. This has loaded in fine and i have loaded it in a function. what i cant seem to do is to get the variable i...

PHP: grayscale jpgs, gifs, pngs... also with alpha channels?

Hey guys, $im = ImageCreateFromString(file_get_contents($source_file)); ImageFilter($im, IMG_FILTER_GRAYSCALE); any idea what i could do, to properly grayscale gifs and pngs with transperancy? This snippet actually works good, it transforms jpgs and pngs to grayscale. However gifs are a little bit "buggy" - they don't always work, it...

XML data to HTML form and back

I am storing data in XML databases. Now I want users to be able to edit certain records. E.g. my db could look like this: <items> <item id="1"> <prop_a>some text</prop_a> <prop_b>TRUE</prop_b> <prop_c>29.01.2010</prop_c> ... </item> // next item and so on Is there a tool which can generate a html form (for which ...

Can you use $_GET variables when including a file in PHP? Is it possible, even from an AJAX call?

I have a PHP file that handles sending out confirmation emails. I also have a calendar that I use AJAX to do various updates. When AJAX calls the update file, it updates the database with the new information, and I want confirmation emails to be sent out. So from inside the php file that the AJAX calls, I figured I should include("email...

How can I handle packed data from Perl/PHP in C++?

I got a problem implementing a PHP programm in C++. It is about the PHP/Perl function unpack. I don't know how to do the follwing in C++ (no problem in reading a file... but how do i unpack("C*") the read contents). <?php $file = fopen("bitmaskt.dat", "rb"); //create the data stream $matrix_x = unpack("C*", fread($file, 286));...

Data: PHP form => email => Access 2007 database

I have a form which is submitted to a PHP page. The data from the form needs to be added to an Access database, however the website is hosted and the Access database is on a network drive. So for now, the form just emails the data to someone who enters it by hand. We're trying to improve this process. So there is no way for the PHP page...

Stop a php function

Hello guys :) I got this code: codeviewer.org/view/code:b6f It simply validates a date, but ends the script if a error occurs (exit ()). Now i gonna put this same code in a single function that returns false on error: codeviewer.org/view/code:b70 I dont want to use "if/else". I want to return false on error and stop executi...

Compressing and Decompress in PHP and JS

I was wondering if someone has come up with something similar to this?? a way to compress a text: <?php $str = 'Hello world!';// the text here can be any characters long $key = compress($str);// should return a key 32characters long/ or a fixed number of characters $value = decompress($key);// should return "Hello World!" ?...

PHP Piped Email Creates Bounce Back

I am piping my php email to a php script it works fine and executes except it sends back a bounce email, do I have to return something or echo something or set some headers to stop this? ...

jQuery won't work on a page

I have a page that allows users to edit a record from the DB. Simple. The html source looks like this: <form id="prize_modify_form" enctype="multipart/form-data" action="" method="POST" accept-charset="utf-8"> <p><label for="header">Header</label><input type="text" name="header" value="More Tvs!" id="header"></p> <p><label for...

Searching for base CMS

I'm searching for a PHP/MySQL based CMS with some basics like Register/Login. It shouldn't be that complex like TYPO3. Drupal and Joomla I don't want. ...

PHP Session with Adobe Air application?

I don't have a lot of experience with either PHP or Adobe AIR. I'm just researching at the moment. I am considering creating some kind of internal AIR app. It would basically be a web chat interface that can be minimized to the tray, with the ability to notify users of new messages, etc. In other words, a pretty basic web chat applicatio...

How do you get a commenter's email address from a WordPress cookie?

Whats the best practice for getting a commenter's email address from the cookie (this is for a WordPress plugin)? Part of my plugin relies on having an email address and I'd like to try to get it even if they are not logged in by checking for the existence of a comment cookie (which should be there if they've made a comment in the last y...

opening a webpage within a webpage

i am trying to display a webpage within a webpage as you can see over here http://www.yoursdproperty.com/index.php?option=com_jumi&amp;fileid=8&amp;Itemid=34 the top and left part is my site, and the stuff that is the main content in the middle is a different site. i may not be doing it correctly since it is not displaying it at size t...