php

zend framework: can not access file that is already there

I am trying to read and post back to the browser a file uploaded with the zend framework mechanism. The file has been uploaded correctly to the desired location and as I have checked by su www-data and after an ls and a cat, the web user can read it and modify it properly. the problem is that inside a controller when I try to: if(...

Why does sharing PHP sessions between concurrently open pages seem to work in FF, but not IE or Chrome?

EDIT I just realized that I must have had a massive brain fart while writing the abbreviated code sample. See, I'm using smarty. Thus, I'm actually already using Kips's solution, because smarty displays after the session is saved I've been working on implementing a resource manager (for condensing, compressing and minifying CSS & JS) ...

PHP Session empty in one computer, but not another. Weird!

The problem is that I have a PHP script (A) that does signup, authorize Twitter, then the twitter calls back to a return PHP script (B). In script (A), I set some $_SESSION variables, and in script (B) I will get it. Very straight foward. I have tested it on my computersss, and it all works. I can see the session variables in script (B...

Excessive use of $this as object param in PHP5, How to avoid?

Hey all. I've been working in PHP5 for a couple of years now and have developed a lightweight MVC framework that I use to speed up site development. Works great, automated formbuilder, autoSQL module, etc. One bad habit that I have developed, however, is relying on $this as an easy object param. I have yet to figure out how to truly en...

PHP Simple Spell Checker (Binary Search help)

I need help with performing a binary search with a search term ($searchTerm) and comparing it to a dictionary ($dictionary). Basically, it reads a dictionary file into an array. The user inputs some words, that string becomes $checkMe. I do an explode function and it turns into $explodedCheckMe. I pass each term in $checkMe to binarySea...

Checkbox onChange submit problem if checked

The purpose is to have a checkbox, that if clicked, will send via post where I will update the db. The user can check back and forth to set or unset active status. This works perfectly: <form name='form".$value['id']."' action='./filter_edit.php' method='post'><input type='checkbox' name='checkbox[".$value['id']."]' value='".$newActive...

How to prevent multiple web requests from processing the same records?

Lets say you have a table with some winning numbers in it. Any of these numbers is meant to be only "won" by one person. How could I prevent 2 simultaneous web requests that submit the same numbers from both checking and seeing that the numbers is still available and then giving the prize to both of them before the number is marked as ...

Image resize issue in PHP - gd creates ugly resized images

I am creating thumbnails of fixed height and width from my PHP script using the following function /*creates thumbnail of required dimensions*/ function createThumbnailofSize($sourcefilepath,$destdir,$reqwidth,$reqheight,$aspectratio=false) { /* * $sourcefilepath = absolute source file path of jpeg * $destdir = absolute ...

PHP exec() return value for background process (linux)

Hello, Using PHP on Linux, I'd like to determine whether a shell command run using exec() was successfully executed. I'm using the return_var parameter to check for a successful return value of 0. This works fine until I need to do the same thing for a process that has to run in the background. For example, in the following command $...

In Facebook do I need to check permissions before I attempt an email?

Using the API call notifications.sendEmail you can send an email to a application user that has authorised your app and granted the "email" extended permission. Now lets pretend that I have 10 users I need to send an email to. 5 have given me this permission and 5 haven't. Is it necessary that I query FB to see if each user has given m...

How to make the entire 'REQUEST_URI' go to a parameter

I'm using Apache rewrite_mod to have all test after the URL adress go into parameter text using the following in the .htaccess file RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?text=$1 [L,QSA] which works if I have www.example.com/some_text but doesn't when I have www.example.com...

Flickering element, not resolved

Hello, I have a PHP page with the following code: echo "function createimg() { var img = new Image(); img.src='path/to/image'; img.alt='Next image'; img.id = 'span1'; img.style.zIndex = 10; img.style.position = 'absolute'; img.style.display='none'; img.style.top = '130px'; img.style.padding='10px'; img.style.left='440px'; img....

Anything wrong with using PHP as a server side language?

Is it wrong to use PHP as a server side language? For functions such as mail notifications / fraud checks (look for data, flag, then email type approach) / db cleanup / upload folder cleanup / cronjob type functions etc; I've ran into some projects lately where I've been successful with this approach, but I'm not sure if its the wrong w...

Is it a bad idea to let users add their own stylesheet?

I'm new at php and I'm trying to figure out of this is a bad idea or a security risk. I have a table of data that I provide to a user, it has a default stylesheet that it loads, but if the user wants to include their own, I've made it so they can just point to their stylesheet instead: http://www.mysite.com/info.php?css=http://www.some...

get list of children in SimpleXMLElement PHP

how do i get the list of children in xml->request->ABC ABC may have DEF, ZZA, XAS, ETC and i would like to iterate through a list of these children (name required) instead of checking if they exist. -edit- Note: I am looking for the element name. I found an example which returns an attribute IF its known. How do i get the tag/element na...

in PHP, when should I use static methods vs abstract classes?

I'm under the interpretation that if I need to access a method statically, I should make the class abstract only if I'll never need it instantiated. Is that true? ...

pluralize in PHP

I have a lot of information to display from a database. Some are french, other are english. Some are a unique, some a list... The question : how do you manage all that different option in PHP IF ELSE SWITCH ARRAY (with all the text) other method ... now the problem rise on a list of odors, some have one (odor) other have many (odors)...

jQuery and Ajax, loading only one item from the database

Please look at this code: $('ul#navigation li ul li>a').click(function(){ var active = $(this).text(); $('#artcontent p').empty(); $.ajax({ type: 'POST', url: 'homepage/readarticle', data: $(active).serialize(), success: function(databack){ $('#loading').fadeOut('normal'); ...

Google calendar API : Selecting/Creating calendars?

So I want our work calendar to automatically sync with each employee's Google Calendar when the scheduling manager posts/updates the schedules. Users would initially opt-in using the AuthSub token, but after that it should be automatic. In order to avoid conflicts with other events they have scheduled, I want to create a new calendar cal...

php mysqli WHERE IN (?,?,? ...)

According to http://us2.php.net/manual/en/mysqli-stmt.bind-param.php, the different types are: i corresponding variable has type integer d corresponding variable has type double s corresponding variable has type string b corresponding variable is a blob and will be sent in packets However, how can you handle this: ->prepare(...