php

PHP long string without newline

Hi, I have a long string in php which does not contain new lines ('\n'). My coding convention does not allow lines longer than 100 characters. Is there a way to split my long string into multiple lines without using the . operator which is less efficient - I don't need to concat 2 strings as they can be given as a single string. Than...

Should I access POST-Parameters in the model or pass as method arguments from controller?

I have to process about 20 POST-parameters, and I am not sure where to do that. I could define each as an argument of the method on the model, and pass them from the controller when the method is called. This would result in quite a bit of work and make the function call less readable, due to the number of arguments. Or I could call th...

Easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard)?

What is the easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard)? I'd prefer to use any built in versions before resorting to downloading from the PHP or MySQL websites. I'm comfortable at the command line in Terminal. ...

Get SWF file information using PHP (or javascript)

For one of my projects I would like to use PHP to read an SWF file on the server and get the dimensions of the stage of the SWF. So, the SWF file is not yet embedded in the page. Does anybody know if this is possible and which route I should take? ...

How to Implement Ajax to display some content in php?

I want to create a page which displays some contents when left navigation menu is clicked. For Eg. When MY FAVOURITE VIDEOS is clicked then the list of the users favourite videos should be displayed on the right side using AJAX. Help me ...

Why is MD5'ing a UUID not a good idea?

PHP has a uniqid() function which generates a UUID of sorts. In the usage examples, it shows the following: $token = md5(uniqid()); But in the comments, someone says this: Generating an MD5 from a unique ID is naive and reduces much of the value of unique IDs, as well as providing significant (attackable) stricture on the ...

How to enable autocomplete/syntax-highlight for PHP core functions in Eclipse?

I searched a lot, checked many times the neccesary steps, but it still don't work. My environment is : Latest eclipse for PHP developer package Project is newed, not check out directly from SVN .project has a line <nature>org.eclipse.php.core.PHPNature</nature> .buildpath has a line <buildpathentry kind="con" path="org.eclipse.p...

MySQL commit and rollback

Hi Friends I develop a webpage in that i face this problem. please see below. In user table i have following fields: Userid password Address phone Email In service table i have the following fields: Ser_name ser_id USER_Refid All these are in same page in php. When i add values in service table it stores under the same USER_R...

prime generator optimization

I'm starting out my expedition into Project Euler. And as many others I've figured I need to make a prime number generator. Problem is: PHP doesn't like big numbers. If I use the standard Sieve of Eratosthenes function, and set the limit to 2 million, it will crash. It doesn't like creating arrays of that size. Understandable. So now I'...

PHP array printing using a loop

If I know the length of an array, how do I print each of its values in a loop? ...

PHP: Split a string in to an array foreach char.

Hi I am making a method so your password needs at least one captial and one symbol or number. I was thinking of splitting the string in to lose chars and then use preggmatch to count if it contains one capital and symbol/number. however i did something like this in action script but can't figure out how this is called in php. i cant f...

Problem with SQL query

Hi, I have the following: <?php $result = mysql_query("SELECT `category_id` FROM `categories` WHERE `category_parent_id` = '80'"); while ($row = mysql_fetch_array($result)){ $childrows [] = $row['category_id']; $clean = array_unique($childrows); $category_string = implode(",",$clean); echo $category_string; ?> And this outputs: 4...

how do i use php to read an external file and put insides into variables?

I had no idea to correctly form the title of this question, because I don't even know if what I'm trying to do has a name. Let's say I've got an external file (called, for instance, settings.txt) with the following in it: template:'xaddict'; editor:'true'; wysiwyg:'false'; These are simple name:value pairs. I would like to have php ...

accented words in email subject break spacing - how do I stop this?

We have a custom php email marketing app, and an interesting problem: If the subject line of the message contains a word with accents, it 'swallows' the spaces between it and the following word. An example: the phrase Ángel Ríos escucha y sorprende is shown (by at least gmail and lotus notes) as ÁngelRíos escucha y sorprende The p...

trying to parse weird formatted xml in php

I am trying to chop XML data into usable strings to reuse them later on in my script. I am receiving the data via a Curl request and his goes great. now chopping the data kills me.. this a part of the XML I am receiving (the whole data part is about 90 lines) <professions> <skill key="IT Specialist" maxage="40" group="IT" worked="...

Information about SSL and apache

Every now and then and since the last week more often I get questions about HTTPS & SSL. So no I wanted to get more into it and looking for some good information about the subject. Furthermore, I have develop on XAMPP and VISTA and I am looking for a good tutorial to get SSL working on this environment. Has anyone got good resources o...

PHP5: dns_get_record() only returning A records for subdomains.

Running PHP 5.2 on Linux, I am running a series of queries with dns_get_record(). It would appear from the documentation that this function replicates dig(1) but I am seeing inconsistencies. My goal is to get the primary and secondary nameservers that are authoritative for the domains that each hostname belongs to. dns_get_record('exam...

Handling Multi Users (issuing invoices)

Handling Multi Users Requirements: I have an applications (mysql php jquery) where the users can: Review records and update certain fields. Issue invoices by selecting orders. Issues: The issue is that an invoice should not be issued twice for the same time period. Also, a field should not be updated by two or more users at the sa...

Can preg_match() (or other php regex function) match a variable number of parenthesized subpatterns?

Suppose I have '/srv/www/site.com/htdocs/system/application/views/' and want to test it against a regexp that matches each directory name in the path? Something like this pattern: '(/[^/])' That yields an array with 'srv','www','site.com'... etc. PS: the regexp syntax I wrote is just to illustrate, it's not tested and surely wrong, but...

Adding Zend Framework to php.ini include_path causes Drupal site to go blank

Hello Everyone, My hosting plan allows me to host multiple sites. When I try to add the Zend Framework libraries to php.ini, another Drupal site I have becomes a completely blank whitescreen. This is the offending line: include_path = "/home/myusername/myzendusingsite.com/html/Zend" The Drupal site is located at: /home/myusername/m...