php

How to display youtube-like video player in website?

I'm working on a website where I want camera-recorded vidoes to be uploaded, and be viewable (but not downloadable) to logged-in users only. I'd also like to edit the videos, have certain images appear in the background, and possibly note the time at which they last stopped watching a video. (I.e if they stopped watching after 30 mins, i...

Passing cookie data between iframes

Say I have a website, www.example.com, with a login box which sits in an iframe situated in api.example.com. My question is: Is it possible to pass cookie data from the inner iframe (api.example.com to the website, so the website knows when the user logged in? Is it possible to do this client-side, without the need to refresh the whole...

sum value from mysql in php

Hi, Anyone knows how to get sum of number? For example i have mysql column name package. Package 3 4 1 3 4 If package 3, the value should be usd 5, if package 4, value should be usd 10, if package 1, value should be usd 1 and so on. So the total value above should be => 5 + 10 + 1 + 5 + 10 = 31 So how do i get sum of it in php? i...

protecting adobe air apps

Hi, I am about to deliver an Adobe AIR app to a customer. But it's my first delivery of any sort, i.e. I have no experience whatsoever with licensing etc. Users of this app may or may not be online, so can't count on that. In fact it's 99% sure that they will be offline. Nor do I expect them to very tech-savvy, who will spend enough t...

var for a class in PHP

Hello. I am using a PHP class for login purposes. The MySQL database that the login process checks for the user is defined like this: class flexibleAccess{ var $dbName = 'mydatabase'; However, as I install the application for different people, this $dbName needs constant changes. I have decided to make a config file where I kee...

Custom eCommerce Site - ASP.Net or PHP?

I currently have a very functional customised online ordering website written from scratch in ASP. This was built approx 4 years ago, and works exceptionally well. I need to build a similar one for another company. Do I simply upgrade and get a like product developed in ASP.Net 2.0, or do I need to do some homework on other options such...

How to create virtual column using MySQL SELECT ?

Hi, If I do SELECT a AS b and b is not a column in the table, would query create the "virtual" column? in fact, I need to incorporate some virtual column into the query and process some information into the query so I can use it with each item later on. ...

What alternatives are there for PHPLint that run under Windows?

I just finished a little 5000-line PHP application and are now going into testing and debugging. A short while before the end I stumbled upon PHPLint. I really liked the idea - with some special comments I can specify variable types and the tool then checks my code for all kinds of mistakes. Neat. I thought that at the end of the develop...

Handling errors as exceptions. Best methods?

I'm trying to figure our if there's a good or better method for handling errors in PHP than what I'm doing below. I'd like to throw an exception if there's a problem with the parse_ini_file call. This works, but is there a more elegant way to handle errors? public static function loadConfig($file, $type) { if (!file_exists($file)) { ...

Can you include PHP in a Perl file?

I have a page written in Perl by someone else. I don't know Perl, so I wrote a PHP file that right now just links from the Perl page. What I'd like to do is embed the PHP file in the Perl file if the perl page has been passed a certain variable. If I were using PHP for both I could just do if ($_GET['sidebar']) include "embedded.php"; ...

Datetime To Unix timestamp

Is there anyone sitting on a PHP function to convert a date of format 0000-00-00 00:00:00(datetimesql) to unix timestamp? Thanks in advance. ...

You say Topic or Thread? (Progamming question about English idiom from non-English speaker)

Topic or thread any difference? what do you english speakers think is the correct? im working on a forum and i wonder if you say "topic" or "thread". Hope you understand. Thanks in advance ...

What is the best method to merge two PHP objects?

We have two PHP5 objects and would like to merge the content of one into the second. There are no notion of subclasses between them so the solutions described in the following topic cannot apply. How do you copy a PHP object into a different object type //We have this: $objectA->a; $objectA->b; $objectB->c; $objectB->d; //We want the ...

Does PHP feature short hand syntax for objects?

In javascript you can easily create objects and Arrays like so: var aObject = { foo:'bla', bar:2 }; var anArray = ['foo', 'bar', 2]; Are simialar things possible in PHP? I know that you can easily create an array using the array function, that hardly is more work then the javascript syntax, but is there a similar syntax for creating o...

Ajax: Partial refresh of a parent page (update a div) from "lightbox" window

Is there a way to update information in a div of a parent page from a pop-up/"lightbox" window. I would like to create a pop up window that contains a form that updates a database (currently i am using php/mysql with prototype). In other words... I would like a user to be able to use a form in a popup window to update the database, and...

what is the function __construct used for?

I have been noticing *__construct* a lot with classes. I did a little reading and surfing the web, but I couldn't find an explanation I could understand. I am just beginning with OOP. I was wondering if someone could give me a general what it is, and then a simple example of how it is used with php? Thanks, Levi ...

Can I swap colors in image using GD library in PHP?

Hi, I got the image like this (it's a graph): I want to change the colours, so the white is black, the graph line is light blue, etc.. is it possible to achieve with GD and PHP? ...

mail function

Hello every body How can I send an email using mail function in php. have I to put mailServer IP address in this function I'm waiting for you reply Thanks anyway ...

Wml problem

I am a newbie in Wap/Wml. I have to develop a certain portion of existing php/mysql website so that people can access certain information from their mobile phone. I have the following doubts: 1) In which language should I deveop this mobile portion? I am guessing WML. But if I develop it in WML, will it wok in all mobiles? 2) I don't o...

Emulating HTTP POST using command line curl and exporting output to text file

How do I emulate an HTTP POST request using curl and capturing the result on a text file? I already have a script called dump.php: <?php $var = print_r($GLOBALS, true); $fp = fopen('raw-post.txt','w'); fputs($fp,$var); fclose($fp); ?> I did a simple test by doing: curl -d 'echo=hello' http://localhost/dump.php but I didn't ...