php

Need to access a single div in an html field loaded into a variable in PHP

Hi guys, here is the situation. I'm retrieving a page using curl into a variable. So I now have all the HTML in one snug variable. I need to however using code access a certain DIV notes contents actually its like this - there is one div node on the page with the ID of 'image' and its kinda like this: <html> <body> .......... ...

PHP/MySQL: Best money operations/storing practices??

Hi all! First of all sorry for my English, it's not my native language. So, I am planning to make an application (PHP/MySQL) which deals a lot with money, and I am thinking about how to store and operate with the money, referring to PHP float data type and MySQL decimal. I was thinking of two options. One of them is to operate and st...

create ftp account in plesk using php

i will create ftp account in plesk using php that ever user register in site can have an ftp account with his username and password . i found many php api for cpanel but in plesk i can't find any thing ? can you help me ? thank you so a lot before ! ...

fatal Error when using pear pager !

hi , i used PEAR Pager in my Projects . it's works fine in my local server but when i upload it to hosing server it's gaves me fatal error : Fatal error: Cannot redeclare class PEAR_Common in /usr/lib/php/PEAR/Common.php on line 1123 i don't know what's the problem , how can i solve that ?! ...

Which PHP frameworks are used by corporations?

There are several questions about PHP frameworks, but I'm curious as to which one(s) are used in the commercial world when developing web applications with PHP. At my first web-based job, they didn't have a framework for the PHP codebase. Is this common when dealing with PHP? If not, what frameworks to companies producing a product (eith...

How to implement DataList (asp.net) kind of functionality in PHP?

I want to display data in two columns as below Entry 1 Entry 2 entry 1 description entry 2 description Entry 3 Entry 4 entry 3 description entry 4 description Entry 5 entry 5 description Now In asp...

Enumerate all Check Box in PHP

I have web page in PHP which displays all records in a table. I want to add check boxes against all rows and user can check a check box to select a row and then submit the page. When the page is submitted I want to enumerate all check boxes and check whether they are checked or not, How can I do this? ...

PostgreSQL: Unknown Date Output Format. How Can You Convert Date Output Format?

I've been storing dates in a PostgreSQL 8.3 database table using a query resembling something like this: INSERT INTO files (date_uploaded) VALUES (now()); According to the documentation there are four formats that PostgreSQL 8.3 will output depending on the setup. My select statement is returning an unknown fifth format: 01:10:00.578...

Unix timestamp > days, hours and minutes

Possible Duplicate: Unix timestamp to days, hours, minutes So, I have a field in my users table named last_active which updates every time a user reloads a page. It's stored in unix timestamp. I would like to output it like this: Last activity: 4 d 18 h 19 m ago How would one do that with PHP? Thank you. ...

Logging Caught and Uncaught Exceptions?

Hi, I have been working with Exceptions lately. I think it makes sense to log uncaught Exceptions, because it greatly helps developers to take care of possible problems in the source by simply looking at Exception log. However, when an exception is dealt with, is there a need to log it any longer? Yes, to some extent. If you have "bad" ...

file_get_contents from url that is only accessible after log-in to website

I would like to make a php script that can capture a page from a website. Think *file_get_contents($url)*. However, this website requires that you fill in a username/password log-in form before you can access any page. I imagine that once logged-in, the website sends your browser an authentication cookie and with every consequent browse...

Page generation from PHP class

I'm actually creating websites for fun and some of my friends told me that I could be more efficient if I could create the output of the page with a php class that would represent the whole page. I was wondering how you people would do it. Thanks ...

Link checker - mail for invalid links

Hey! I got this link checker script and i would like it to give me a mail when a link doesnt work. I need it to remember that it send me an email about a link so i dont get multiple emails about the same link. I would appeciate if anyone help me with this since it was too hard for me. <? function checklink($links) { $working = 0; ...

PHP - failed write

I am stuck and in need of a hand. Hope someone can help? Anyone have any idea why I am getting "failed write" in this code? $write_file = "/usr/home/public_html/php/users_v2.sql"; $write_handle = fopen($write_file, "w") || die("Couln't open users_v2!"); if (is_writeable($write_file)) { if ($write_handle === FALSE) echo 'Failed ha...

How to Display the Total Order Amount per Day in a Chart

I cant seem to get this working, i need to display the Total Order Amount per day on the Chart. I got the Open Flash chart to work by the following code: <?php // Settings for Database Connection include_once($root_folder_path . "includes/common.php"); include_once("./admin_common.php"); include_once("./ofc_chart_library/open-flash-...

How to refactor this constructor so it is testable?

I have a class that is a container for a bunch of module objects. Right now the container takes in an array of file paths, then includes the files and instantiates the modules class module { function execute(); } class container { public $Name; public $Modules; public __construct($Obj){ $this->Name = $Obj->Name;...

What do you say about the following Date Function ?

What do you say about the following Date Function ? The following code is from a shopping cart. function va_date( $mask = "", $date = "" ) { global $months; global $short_months; global $weekdays; global $short_weekdays; $formated_date = ""; if ( !is_array( $date ) ) { $date = is_numeric( $date ) ?...

Do I need to make sure output data is valid UTF-8?

Hi, I have a website that tells the output is UTF-8, but I never make sure that it is. Should I use a regular expression or Iconv library to convert UTF-8 to UTF-8 (leaving invalid sequences)? Is this a security issue if I do not do it? ...

what are queue access concurrency solutions?

I am trying to find out the difficulty of implementing a queue system. I know how to implement a basic queue, so i'll explain a little about what i'm after with some background: I will be implementing a queue where messages will be placed, this will come from several users, the messages will be scheduled to be posted at user defined tim...

Can PHP tell when the browser goes away?

If I'm generating a stream of data to send out to a browser, and the user closes the browser, can I tell within PHP that I don't need to bother generating or sending the rest of the stream? I'd like to insert something into this loop: while (!feof($pipes[1])) { echo fgets($pipes[1]); } My fallback plan is to have the browser use a...