php

Calculate possible combinations of an array in order of presented arrays

This is a php question. I have an array of arrays: Array ( [1] => Array ( [1] => 1 [2] => 2 [3] => 3) [2] => Array ( [4] => 4 ) [3] => Array ( [7] => 7 [8] => 8 [9] => 9 ) [4] => Array ( [36] => 36 ) ) I need to make all possible combinations in order but never out of order, and never missing a previous possible..that likely a bad exp...

Assign 10-digit char user ids to 1 of 1000 servers.

Hi -- Looking to shard a database and to assign different users to different home servers based on their user id. User IDs are 10 character strings, e.g., "f4gKUKkj91" ... each server has an ID of 1 - 1000. How can I create a hash function in php to uniquely and consistently assign each user id to a specific shard ? If the user id were...

Security in PHP

I've written some PHP scripts to do some server-side work on a headless linux server machine on a LAN. For example, I have http://ipadress/php/operations.php?operation=registerUser&uName=X&uAlias=Y. Now, I want to secure my operations script so that; not everyone on LAN can call it and/or run it but; only the ones that ... have a...

Codeigniter - PHP Not Being Rendered In Views w/ mod_php 5

I recently transferred one of my websites to a private server which allowed me to use mod_php 5 along with XCache. However, when I switch from PHP 5 CGI to mod_php, the PHP that is directly in my view files is not being rendered. For example, the title of my page is “”. As in you can see the unprocessed code in the HTML. Any ideas as to ...

HTML data entry

I have gotten a project on my desk. It involves updating the bios for a bunch of people, however, my boss does not want into a database (I think that would be the best solution but lets not go there). Although, he never said anything about flat files! :) So, my solution would be to create a PHP page with some form elements with like "Ed...

Alternatives to Smarty for separating presentation from code in php ?

I'm currently using the Smarty templating system for our production site, but am curious how much of a performance hit I'm taking by using this templating engine. Are there faster alternatives? Is there a way to code so I may not have to use such a templating system? Thank you! ...

Basic MySQL question: how to get rows from one table that are not in another table?

I have a list of usernames (with a column called "username") + other info in my "users" table. I also have another list of usernames (with a column called "username") in my smaller "recentusers" table. How can I create a mysql query to get all the usernames that are in the "users" table but not in the "recentusers" table? I know it is...

Ajax long polling (comet) + php on lighttpd v1.4.22 multiple instances problem.

Hi, I am new to this site, so I really hope I will provide all the necessary information regarding my question. I've been trying to create a "new message arrived notification" using long polling. Currently I am initiating the polling request by window.onLoad event of each page in my site. On the server side I have an infinite loop: w...

call member function by reference php

Please stop me if i am doing something wrong. It works but somehow it doesn't appear the right way to me... Look at the member function call in talks.php. Does this look right to you? Is there a better way to solve that? Thanks. show.php I am passing my user class by reference: $talks = new talks($comments, $user); talks.php: [.....

Zend Framework default log level

Hi Is it possible to set default log level for entire applicaton? I would like to set it from application.ini. I would like to set loggers to log to database and firephp. ...

Facebook API + php, photos.upload() not working?

I've set up a Facebook application, I've requested the extended permissions and now I'm trying to upload a photo but it doesn't work! I've tried everything, from $facebook->api_client->photos_upload('photo/789165784.jpg'); To $facebook->api_client->photos_upload('photo/789165784.jpg', NULL, 'My photo', 100000287894654); I'm beginn...

Replacing a new line with its html equivalent in PHP

I am facing a bit of a quandary, I need to replace a new line with <br />. Now, clearly, replacing all instances of \n did not work, as the page did not have proper linebreaks. Here is an example of some possible text: Some text More text Now, this is an issue because there is no \n and I have no way to auto-insert <br />. How can I...

How to get Amazon Seller Central orders programmatically?

We have been manually been keying Amazon orders into our system and would like to automate it. However, I can't seem to figure out how to go about it. Their documentation is barely there. There is: Amazon Inventory Management (AIM) API: That is supposed to manage orders and inventory Event Notification Service (ENS) API: Get order not...

Understanding Twitter API's "Cursor" parameter

I don't really get how to use the Curesor parameter in Twitter's API, for an exmaple - here. Am I supposed to make a new API call for each 100 followers? I'd love it if someone could provide a PHP example for getting a full list of followers assuming I have more than 100... Thanks in advance! ...

Concatenating PDFs in PHP

I've got a grip of PDFs that I need to combine into one using PHP. Googling around gives me very little that seems like a reasonable solution. The best thing I can find is to use exec() and pdftk but that's just ugly. Does anyone know of a more elegant solution that doesn't involve me shelling out all the money on the planet for some non...

How to embed a quicktime video from a MySQL Blob

Hi, I am currently pulling out images from a MySQL Blob using code as follows: <img src="data:<?php echo $type; ?>;base64,<?php echo base64_encode($file); ?>" width="240"/> I am now trying to embed a movie in a page and I am currently using code as follows: <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http:/...

Building a markup parser in php

I have created a very simple markup parser in php. However, it currently uses str_replace to switch between markup and html. How can I make a "code" box of sorts (will eventually use GeSHI) that has the contents untouched? Right now, the following markup: [code][b]Some bold text[/b][/code] winds up parsing as the code box with <b>Some b...

How do you create a web audio playlist?

Hi. I'm researching ways to create a web radio station of sorts. It will have streaming MP3 audio from TV programs for users to listen to. They should have the option of just listening to the stream or pick the shows they'd like to hear and add them to their playlist. It needs to be usable by folks on mobile devices, so Flash is out fo...

What should I learn?

I work for a small web design company, and learned everything I know on the job (my degree is in chemistry!). The other coder here taught me a fair bit of php, and I've had to pick up MySQL and a bit of javascript. I've also increased my knowledge of CSS. (HTML itself I already knew, really, along with a little CSS.) Now, I am the sort ...

Zend_Controller_Router_Route Chaining Problem with more than 3 url parameters

I can't seem to figure out what's going wrong, but I'm attempting to setup module routing based on sub domain. Otherwise the routing is standard. The following works until I add more than 3 parameters in the URL: This is within a controller plugin ... public function routeStartup() { $router = Zend_Controller_Front::getInstance()->...