php

PHP & MySQL question.

Is there a tutorial or script that can show me how to build a form that allows me to add categories, sub categories and sub sub sub categories and so on to my web page using PHP & MySQL? ...

Set a test timeout duration with PHPUnit

I have some test cases that can go into an infinite loop upon failure. Is there a built-in way to set a test timeout duration with PHPUnit? If not, what would be the most unobtrusive way of adding this feature to a test case? ...

No translation for the language 'en_US' available, why ?

Here is my config.ini resources.locale.default = "en" resources.translate.adapter = "gettext" resources.translate.data = APPLICATION_PATH "/../languages/" resources.translate.option.scan = "directory" resources.translate.registry_key = "Zend_Translate" resources.translate.disableNotices = true resources.translate.default = en And my l...

Session variable is not visible on another pages

Hello. Here is my problem: i have login page. Php code registered $_SESSION['id'] variable and on the login page all seems to be ok, but on another pages $_SESSION['id'] is not set. Used session_start(); at all pages. Any ideas why? ...

Getting the remote address from a <script> tag.

Hi! I have a page with a tag in it pointing to a php script that generates javascript. In this php script, I verify the remote ip to see if this ip has the right to use the script. My question is: how do I get the IP from the machine that embeds the tag? In $_SERVER, I have REMOTE_ADDR which is MY ip address (the client) and SERVER...

Using Header as download link in PHP

Hi guys, So I am having this problem wit my download link. Basically my previous way of creating download link is to just have a form button with method='link' and the action to be the link to the file. This works for firefox and others but not safari. For some reason, when the user tries to download the file (excel file) from safari, ...

jQuery UI accordion that keeps multiple sections open?

I may be an idiot, but how do you keep multiple sections in jQuery UI's accordion open? The demos all have only one open at a time... I'm looking for a collapseable menu type system. ...

Bitwise operation error ?

I'm developping a site for fun and I'm trying to implement a directory access control based on bitwise operators. I've defined GUEST = 1, GROUP1 = 15 and GROUP2 = 23 If I compare echo (23 & 1); // print 1 but if I define GUEST, GROUP1 and GROUP2: define('GUEST', 1); define('GROUP1', 15); define('GROUP2', 23); // and then ...

Problems with serialize() and unserialize() - inserting and selecting data PHP MySQL

Hello I am attempting to grab a date supplied via POST, then generate a list of dates over a 12 week period from the supplied start date. These dates would then go into the DB and a 12 week schedule would be output, which the user can interact with (add/edit/delete). I am successfully taking the start date, generating the 12 week date...

Which is quicker; Comparing text against an array, or an external file?

I have to implement a "bad words" filter on my website, which is a classifieds website. I have a big list of "bad words" but don't know which method is best to compare the user inputs to. In my case, a textarea inside a form, needs to be checked for "bad words". <form name="test" action="test.php" method="post"> Inside test.php I...

mysqli persistant connection

In short, is there some sort of mysqli_pconnect for high-usage PHP & MySQL servers, or do I need to stick with mysql unimproved? And if so, why did they remove it? ...

Execute "less" from command-line PHP w/ Scrolling

I want to execute less and similar programs from the command-line in PHP. I have tried the usual suspects (exec, shell_exec, passthru, etc), and while many of them can dump the file to the screen, the process is terminated before I can make use of it. If I wanted cat, I'd use it. How do I execute a program in this fashion? ...

Safely passing a URL through a URL to open in iframe

Hi, I'm trying to pass URL to a website so it can be opened in an iframe, the URL is for a registration confirmation so users get their id / password, I know how to do that and the URL opens fine, but what are the implications for the website it is being passed to (it is an online store). Here is the script on the store site: <? echo ...

Running PHP on 64 bit Windows platform - issues?

Hi, We need to have our PHP application hosted on a 64 bit Windows OS due to another application's requirement. However, reading a bit more on the topic revealed that the PHP implementation is only for a 32 bit environment on Windows. From: http://en.wikipedia.org/wiki/PHP PHP interpreters are available on both 32-bit and 64-bit ...

ffmpeg and pipes via php on os x doesn't work as it does on linux?

Greetings! I've run into a strange issue with using php passthru() building a realtime transcoding proxy on os x, here's the command: passthru("/usr/bin/ffmpeg -i '/path/to/file.avi' -r 20 -ar 44100 -ab 196 -b 1500k -deinterlace -croptop 0 -cropbottom 0 -cropleft 0 -cropright 0 -f flv - 2>/dev/null"); On linux this works perfectly an...

php: Creating automatic database sharding logic?

Hi everybody, I did just come up with the following idea, but I lack the knowledge to say if it is applicable to a production application. We have a web application, built on PHP/mySQL to make it easy. A table in the database are prone to grow large - a couple million of records easily, so table sharding might be an option here. Here...

Would having x number of UPDATE queries in a MySQL transaction be worse or about the same as putting them into one UPDATE query?

This may be a silly question with an obvious answer, but I've pondered it for quite some time and can't really come up with a good answer on my own. I'm working on a telecommunications website and I've made a mapper framework and query builder of which I'm rather proud. The mapper has a set function (generates an UPDATE query) to update...

Abstract Factories not possible in php < 5.3?

I was working on an abstract class to save on some code for a couple of classes. These classes are all factories that instantiate themselves through different static calls. I could save some code by putting all those methods in an abstract class. However, I ran into a late static binding problem... since our web host isn't using 5.3 or...

PHP file permission

Ideally I would be using suPHP however I have been forced to use DSO... How worried should I be about setting the folders permissions to 777 and how can I improve the security of doing so? ...

PHP Regex for splitting a string at the first occurrence of a character.

This may be a lame question but I am a total novice with regular expressions. I have some text data in the format: Company Name: Name of the company, place. Company Address: Some, address, here. Link: http://www.somelink.com Now, I want to use a regex to split these into an array of name : value pairs. The regular expression...