php

symfony: question about a choice widget

Hi, I have a choice widget in a form: $years = range(14,130); $this->widgetSchema['age'] = new sfWidgetFormSchema(); foreach (array('from', 'to') as $value) { $this->widgetSchema['age'][$value] = new sfWidgetFormChoice(array( 'label' => $value, 'choices' => array_merge(array('' => '-'),array_combine($years,$ye...

Need to write XML using PHP - how?

ive got this basic code. <chart lowerLimit='0' upperLimit='100' caption='Revenue' subcaption='US $ (1,000s)' numberPrefix='$' numberSuffix='K' showValue='1' > <colorRange> <color minValue='0' maxValue='50' color='A6A6A6'/> <color minValue='50' maxValue='75' color='CCCCCC'/> <color minValue='75' maxValue='100' color...

PHP Script To ASP.NET (3.5)

Hi. I am not a PHP guy and would really love to see what the below PHP script looks like in ASP.NET (I am working in 3.5 but anything that gets me started would be wonderful). I have tried downloading Microsoft's migration assistant but am having difficulties running it on my machine. Any kind soul out there willing to convert this f...

PHP development environment

I normally work on Python projects and we have a good tool called virtualenv for setting up project environments. Does something similar exist for PHP? I have not been able to find one. ...

PHP how could I make this class better? Suggestions/Feedback welcome

Best suggestion will be the accepted answer Class: <?php class LogInfo { private $first_run; // Flag to add line break at the beginning of script execution private $calling_script; // Base name of the calling script private $log_file; // log file path and name private $log_entry; // inform...

How to manage User Roles in a Database?

Hi all, I'm creating a website in which I will be managing users and their permissions. I am looking to implement user roles, and can't seem to wrap my head around how things should work. I want to be able to assign a user a certain role, and have each role contain one to several permissions that can be read easily by my script. Just wa...

Php login panel

I have developed a small application. I created a login panel for it. I have only one user so, I hard coded both user name and password. Below is the code but it is not working.I don’t have any db for this bcoz, it will have only 1 user. Any help ii be appreciated. Thanks in advance. <?php if(($_POST['na'] = 'admin') == ($_POST['pwd...

Memcache returns false on long keys

I use Php memcache on PHP Version 5.2.4-2ubuntu5.10 Below you can find the info from phpinfo. When I use key larger than 250 characters memcache returns true on $memcache->set and false on $memcache->get . Any idea how to set it to work normally (truncate key at 250 chars)? If not - what would be the easiest way to override memcache ...

how to import the all products of another site into magento site

hi can any body help me please..i have installed magento on live server and now i want to import all products and category of a website which is allready running live.. how can i do it please any help.... ...

Parse error: syntax error, unexpected T_OBJECT_OPERATOR

I'm getting the following error when trying to add some data from myXml.xml to a string: Parse error: syntax error, unexpected T_OBJECT_OPERATOR. $xmlstr = file_get_contents('myXml.xml'); $xml = new SimpleXMLElement($xmlstr); foreach($xml->order as $order){ $replace = array(); $firstName = (string) ...

Can anybody suggest me some nice challenging project(website) at intermediate level in PHP?

Hello, This time i have PHP in my curriculum. Can anybody suggest me some unique challenging project for PHP that apart from regular CRUD has something else to do? The time duration for project is 8 weeks(roughly 2 months). I will be really grateful to all. If you can give me links to some nice websites then too it can be a good referen...

Managing External and Internal Libraries in Codeigniter with PEAR

I want to start using more libraries for my codeigniter project, but I am weary of having them all in my vcs or having to manually manage versions of the libraries. I've recently found this PEAR Guide but I don't see anything about existing codeigniter libraries being available through this system. Does a CI specific PEAR repo exist and ...

How to "Group By" with MongoDB

I would like to know if there is anyway I can "group by" my results with MongoDB/Php. This is the code I'm using to display my rows: $count = $col->find(array('order_id' => array('$gt' => '0')))->count(); I need to group them by order_id. Apparently, we cannot do a count() on a group() as find() WORKS: $countfind = $col->find()->co...

How to read a bulk data feed via php?

I have a large file that I would like to read via php, and then insert various fields into MySQL. Each file in the feed is in plain text format, separated into columns and rows. Each record has the same set of fields. The following are the delimiters for each field and record: Field Separator (FS): SOH (ASCII character 1) Record Separa...

Which PHP Session class should I use?

Hey everyone, I'm looking to do basic stuff with sessions (user logins, authenticated forms & pages) and am just wondering what's the best wrapper/helper class out there to do this. If you have one that you've written or really like that you'd like to share with some snippets, I'd greatly appreciate it. Cheers, ...

Vimeo id PHP Regex

Does anyone know a regexp to extract just the video id from a Vimeo embed using php? eg: 13084859 from: <object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13084859&amp;amp;server=vimeo.com&amp;...

chmod() and chown() of a symlink file in PHP

Are there PHP commands to change file access permissions/owner of a symlink file as opposed to those of the object the symlink points to? From the shell I can $ mkdir adir $ ln -s adir alink $ chmod 0700 alink -- changes permissions of directory adir $ chmod -h 0700 alink -- changes permissions of file alink but I don't ...

PHP global declaration.

I'm using PHP's global declaration to make an array available to a number of functions in a script. The variable is declared at the top of the script and is referenced with global in each of the functions which uses it, as follows: <?php $myarray = array(1, 2, 3); function print_my_array() { global $myarray; print '<ul>'; ...

Script to insert data on different domain

I am thinking about writing a script that will perform a sort of checkout procedure automatically similar to a program like Ebay snipe. I will know what the page exactly looks like. All I really want to do is load the page from a different domain than the one that is running my script into an iframe, have jquery insert the data into the...

HTML 5 multi file upload with PHP

Here is the code I have, and I'm wondering what I'm doing wrong that it doesn't display the name. <form action = "self.php" method="post" enctype="multipart/form-data"> <input type="file" name="imageURL[]" id="imageURL" multiple="" /> <input type="submit" value="submit" name="submit" /> </form> And the processing info that isn't worki...