php

PHP: Why would 'filetype()' and 'is_file()' fail reading a file on a FTP server?

I'm having a few problems while trying to check files on a FTP server. I installed a FTP server (filezilla) on a test machine where i could interact with it from another webserver running on the LAN. I used PHP to walk through the directories on the FTP server over the LAN. Within my app i had calls to 'filetype()' and more recently 'is...

Advice for integrating a blog and wiki in a custom site

I've been tasked with building a site for a client. They want it to include a wordpress blog and a wiki with both integrated apps sharing the look and feel of the main site. Currently, they use MediaWiki and would like to stick with it, but they are flexible with respect to the software we choose. I've nailed down two fairly discrete ...

If fetched data from MySql is smaller than *number*, show this, else show something else?

Hi Masters of Web Programing. I've got this code: <?PHP $db_user = 'user'; $db_pass = 'password'; $db_name = 'dbname'; $db_host = 'localhost'; if(mysql_connect($db_host,$db_user,$db_pass)) { mysql_select_db($db_name); mysql_query("CREATE TABLE IF NOT EXISTS smsads(id bigint unsigned primary key auto_increment, link varchar(255)...

php calendar script

does anyone know of a rudimentary php script that will take data from a list of events (like something output from a cms) and display them in a html table calendar I don't need an js or ajax, just the server side code ...

Allowing line breaks in comments Wordpress

Any ideas to prevent Wordpress stripping new lines from comments? ...

How to get root dir on PHP

I use realpath('../'), it work fine but the result is D:wampwww ( real path is D://wamp/www ). Anybody can tell me how to get realpath by the right way? Thanks you verry much. ...

Time counter with Javascript or PHP

Hello, I'm a PHP programmer...done some study on google and tried it, but didn't get the output i need Users will enter the time in the textbox provided...now i need to give them counter from the time they entered ? Example : If i enter 1:27:38 and click on submit then time should get decreased and i shud get alert when it reaches to...

Removing a dependency in a constructor using PHPunit

While trying to get a legacy codebase under test, I've come across an object that does the following: class Foo { public function __construct($someargs) { $this->bar = new Bar(); // [lots more code] } } Bar in this instance has a constructor that does some Bad Things e.g. connecting to a database. I'm tryi...

How can I search for and delete an array element in PHP?

I have a PHP array that looks like this: Array ( [0] => Array ( [start] => DateTime Object ( ) [end] => DateTime Object ( ) [comment] => A comment. ) [1] => Array ( [start] => DateTime Object ( ) [end] => DateTime Object ( ) [comment] => Another comment. ) ) I would like to create a function that...

Ajax doesn't work in iPhone safari

My ajax works fine in firefox but it does not work on my iPhone. I thought it might have been the XMLHttpRequest but that doesn't seem to be the issue. I am for sure it's not my php script. Sorry that I didn't post it earlier. It was really hard to post on iPhone, especially since I can't scroll down to highlight all the code Here is my...

return variable approach

Ok I have ten variables but one needs to be set, but I need to check for each of the values until one is set. I'm doing a SWITCH/CASE statement but I'm not sure if this is the best approach because I don't see how I can return only the variable that I need set. $passed_var = 'A'; // Static $var_array = getSelectedVar($passed_var); for...

Drupal - Breadcrumb and 'In this section'

Hello, I have looked all over the Drupal site to find out how to view the breadcrumbs that the menu breadcrumb module installs, but no one else seems to be having the same problem as me, has any one come across the menu breadcrumb module in Drupal and knows how to use it? Also is there a solution in Drupal again couldn't find an answ...

Php.ini Causing Ajax To Load Slow?...

Strange bug here... ajax has been loading slow on this server since day one... we thought it was the internet connection, until yesterday. I accidentally added an invalid extension into the php.ini file (ie. extension=php_pdf.dll), and then all of a sudden, the ajax loaded extremely fast. When I took out that invalid extension, the ajax ...

what this php regex does?

$str = preg_replace('#([\x00-\x1F])#e', '"\x" . sprintf("%02x", ord("\1"))', $str); ...

Can a PHP script continue running after ending the HTTP request?

How do I write a PHP script that continues running, even after flushing out some text and ending the HTTP request? Is this possible? ...

Can a PHP script abort itself or detect abortion?

PHP scripts can continue executing after the HTTP page request, so how do I finally stop it executing when I'm done with it? Also, is there an event to detect when the OS is going to forcibly abort the script? or how do I keep an internal timer to predict max_execution_time? ...

Structure of orders in restaurant

What would be the best way to structure orders for a restaurant (available languages are php and javascript)? Since there are multiple tables (the ones you keep things on...), I thought of using objects in javascript. But I am quite new to javascript and absolutely new to OOP, so I'm not sure whether this is the best solution, and whethe...

Can a JSON object returned by PHP contain a date object

Is there a way to create a JSON object in PHP that contains a javascript date object? Does json_encode automatically convert PHP's DateTime to Javascript's date? ...

Web Based Documentation Generator / Editor

Hello all. I'm looking for a good documentation generator that supports various programming languages, but PHP is a must. The thing is, I'm looking for it to do a very specific thing, which is essentially build the standard automatic documentation such as function definitions, class structures, etc, but then allow me to edit them as I ...

how can I assign a variable to hold an image in php

Hi, I was just wondering if I could have a variable to hold an image, I'm using phpmailer to send email and I need an image to be attached to it, so I was wondering if I could put the image in a variable and use $mailer->AddAttachment($image); to send the email with attachment. thanks for your help. ...