php

Content-Length header always zero

I set a header in the following way: header('Content-Length: ' . filesize($strPath)); On my PC with ZendServer it works fine and I can download a file with the correct file size. On the production server, a Solaris with Apache and compiled PHP, I get a file with the file size equal to zero, so an empty file. Is there a config paramet...

Aggregate photos from various services into one Stream

Helllo All, I'm looking to aggregate photos from various streams into one stream in a similar manner as to friend feed. I'd like to be able to watch flickr and picasa and other sites with RSS feeds of my choosing and then create a timeline of top photos. For example, assume that X's below are photos: Event Name -- March 15th X ...

How to [recursively] Zip a directory in PHP?

Directory is something like: home/ file1.html file2.html Another_Dir/ file8.html Sub_Dir/ file19.html I am using the same PHP Zip class used in PHPMyAdmin http://trac.seagullproject.org/browser/branches/0.6-bugfix/lib/other/Zip.php . I'm not sure how to zip a directory rather than just a file. Here's what I hav...

Parsing Excel XML with PHP

INTRODUCTION I'm using excel downloads as a way of users downloading a score sheet, filling out scores and then re-uploading this score sheet into the system. Part of this requires the data in the database to be put into a CSV. Then its opened on the client computer. PROBLEM The problem I'm having is that the CSV does not allow me to...

PHPMailer: sending email....ask for a receipt?

I am going to create a script that sends out an email. I am currently using PHPMailer. I have been told that they would like the email to request a receipt from the user indicating they read it. (like what you often see in outlook). I have no clue if this is possible. Can anyone tell me if this is possible and if so how to do it? Thanks...

Textorientation in PDFlib with PHP

Hi %, I've found a strange behaviour in pdflib while trying to get a text rotated in a table, in order to save page space. The pdflib documentation states, that: fittextflow={rotate=90} Should produce the effect I want. The strang is, that my pdf creation codes failes to run, loging: ExceptionHandler: cell in column(s) 1 and row(s...

What is the best way to bind decimal / double / float values with PDO in PHP?

It appears the class constants only cover PDO::PARAM_BOOL, PDO::PARAM_INT and PDO::PARAM_STR for binding. Do you just bind decimal / float / double values as strings or is there a better way to treat them? MySQLi allows the 'd' type for double, it's surprising that PDO doesn't have an equivalent when it seems better in so many other way...

Suppress Drupal status messages by role?

Is it possible to suppress the status messages set by drupal_set_messages() for certain roles? One client does not want certain roles (anonymous) to see these messages. ...

Converting Integer String to Money Format

Hello All, I have a set of integers that I would like to change to a US money format. Here are some examples of what I would like to do. The first number is what is in the database and the second is what I would like the money format to look like. 4500 = $45.00 395 = $3.95 19000 = $190.00 I'm really just unsure what function...

Download image php?

Hello, how do i make so when you click on this image you will begin to download it? This is my code } elseif (isset($_REQUEST['animeinput']) && !empty($_REQUEST['animeinput'])) { echo "<a href=\"sig.php?user=".$_REQUEST['user']."&anime=".substr($_REQUEST['animeinput'],0,32)."&color2=".$_REQUEST['color2']."\"><img type=\"im...

PHP/MYSQL: What should the best way to record any undefined optionals data from the user and optimized to search?

I have a table with some fixed columns id,title,created.., but there I need put some optional data from the user that I cant define a specif column, but I need this data for search from others users. What the best way? Store a serialized array Leave some column optionals ( exemple:leaves any 10 column opt1,opt2,opt3...) Create a new ta...

splitting data into multiple tables

I am building a employees page. Some of the information goes into an 'employees' table but some of it goes into a 'availability' table that is referenced to the 'employee' table: availability: id / employeeid (unique id from employees table) / monday available / and on and on / So I don't have that unique ID from the employees table ...

How to determine if a list is subset of another list?

What is efficient way to determine if a list is a subset of another list? Example: is_subset(List(1,2,3,4),List(2,3)) //Returns true is_subset(List(1,2,3,4),List(3,4,5)) //Returns false I am mostly looking for efficient algorithm and not too concern how the list is stored. It can be stored in array, link list or other data struct...

Secure communication between a C# client and a PHP Server

I am maintaining a C# app that's been cracked by people creating spoof auth servers. I want to encrypt all the communications between the client and server to prevent this happening to my next release. I can see that PHP has a way to secure stuff. http://www.php.net/manual/en/function.openssl-private-decrypt.php What I can't find ...

How to eliminate PHP error messages from MySQL calls?

$conn = mysql_connect('localhost', 'root', 'xyvz5j'); mysql_select_db('rata2', $conn); How can I do so this so that it won't print a lot of garbage like "Failed to connect" or something (if there's a MySQL error)? ...

OOP - overloading a child and its parent class in the same time?

Hi, I'm working with a framework, but for sometimes I need to alter some methods by overloading classes. My problem is when a class B inherits from a class A and where I need to overload them both, eg: class B extends A {} First I overload A and B, in order to alter some of their methods: class AA extends A {} class BB extends B {}...

Installing the facebook API

Hi, I'm just starting out to develop my first facebook app in php and I'm having difficulty installing the library files onto the server that I'm using(hyperphp). I've copied all the files (facebook.php, +2 others) into the folder with my index.php file, but I can't get the sample facebook code to work. It can't seem to access the li...

HTML Validator in Javascript/PHP? ( not necessarily XML )

I'm looking for something like http://validator.nu/, I'll be validating html input ( string ) and I want to notify the user if there are any missing end tags, whether a certain element can't have a certain attribute, things of that nature ( HTML 4.01 Strict validation basically ). Sidenote: I won't be dealing with XML/DTDs, and I don't ...

Should my method throw an exception?

My PHP web application is divided into modules, and I use the data model and data mapper patterns. My mapper methods are static, and they exist specifically to interact with the database. I have the following method: ModuleMapper::getRecordCountByModuleIdAndSiteId($moduleId, $siteId) This method is only meant for a set list of module...

Creating classes or just using associative arrays for XML data in PHP?

From a maintenance and code organization standpoint, in PHP5, does it make sense to create/define objects and classes for XML data coming from a web service? Using Twitter's API as an example, I would have a class for each API method (statuses, users, direct_messages, etc). For statuses/public_timeline, I would have something like this...