php

Handling complex data collection with a CMS

I do web work for a group at the university I attend. We’re having a design company redo our site and will be coding the site ourselves. We’d like to build the new site on top of a CMS so that people can easily add content. So far I’ve been looking into using Drupal. The problem I’m running into while thinking through how well Drupal wil...

PHP - Destroy Session

Possible Duplicate: How do I expire a PHP session after 30 minutes? Hi All, The problem I am running into is that my host will not let me overwrite PHP.ini settings. They currently have the max lifetime of a session set to 24 minutes (ridiculous). My idea is to destroy the session completely and then recreate it (ideally gi...

Is it possible to extends a Model with Doctrine 2?

Following situation: Parent: namespace Base; /** @Entity @Table(name="section") */ class Section extends Skeleton { /** * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; /** @Column(length=256) */ protected $title; /** @Column(length=256) */ protected $stylesheet; } Child: namespace Base2; u...

Delete files then directory | PHP

I have this so far: <?php $path = "files/"; $files = glob("" . $path . "{*.jpg,*.gif,*.png}", GLOB_BRACE); $i = 0; foreach($files as $file) { $delete = unlink($file); if($delete) { echo $file . " deleted!<br />"; $i - 1; } else { echo $file . " could not be deleted...<br />"; ...

PHP object isset and/or empty

Is there a way to check if an object has any fields? For example, I have a soap server I am querying using a soap client and if I call a get method, I am either returned an object containing fields defining the soap query I have made otherwise I am returned object(stdClass)#3 (0) { }. Is there a way to tell if the object has anything? ...

PHP: Looping through and displaying data only if it's unique (dates)

I need to display a list of dates from a database. There can be multiple records with the same date, but I only want the date to display once. In other words, I need to only display unique dates. Any ideas? ...

Uppercasing first letters of words using preg_replace in php

I need to turn names that are always in lower case into uppercase. e.g. john johnsson -> John Johnsson but also: jonny-bart johnsson -> Jonny-Bart Johnsson How do I accomplish this using PHP? ...

Sign on several sites

i have 2 sites (example.com, ex2.com). Fisical is a 1 site with 1 db. When user sing in ex2.com, he was sing in example.com too. How do this? P.S. Can do this with ZF? I found a very interesting article on this topic. The author gives some ideas how to implement Multidomain authentication. http://codeutopia.net/blog/2008/09/25/sharing-...

reg ex telephone number

How do i change any of the following to just numbers 1-(999)-999-9999 1-999-999-9999 1-999-9999999 1(999)-999-9999 1(999)999-9999 i want the final product to be 19999999999 ...

PunBB or FluxBB?

I'm looking for some objective advice about choosing FluxBB instead of PunBB, and vice versa. I need lightweight, but powerful forums. Please can you tell me the pros and cons of each one? ...

[Drupal] using a specific node ID to call a template file

The standard template for a node in Drupal is node.tpl.php It's possible to call a different template for a content-type, like 'newsitem'. You will call it like this : node-newsitem.tpl.php. I was wondering if there's a way to call a specific Node ID? node-34.tpl.php does not work. Thanks ...

XDebug profiling in PHP - can't get output

Hello everybody, I've got a strange issue. I've setup XDebug to profile a PHP application we're working on. I believe everything is setup correctly but I get no output when I run it. My configuration looks like this: zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so [XDebug] xdebug.profiler_append = 1...

jquery call for a remote php function

Hi, I have a selectbox that needs to be updated dynamically. I am using jquery to perform that using .load($url), where $url is the location of the php file to call. I am wondering if there is a way to call a specific function within that php file instead of calling the entire php file. ...

PHP curl via proxy

Hi, My wordpress install (local development environment) is stuck behind a proxy and I'm having to hack plugins so they can see things likt the flickr API. I'm doing this by adding proxy options to curl requests. Does anyone know of a way of setting curl options globally? There are no php.ini directives. Thanks, ...

Using CodeIgniter built-in form validator class without an actual form submission

Is it possible to validate a set of data (an array) with the form validation class in CodeIdniter? i.e. when there his no form submitted. If it's not possible, what other way could I validate this data using the set of validation rules written in form_validation config file? Thanks in advance! ...

Any PHP tagging libraries extended for multiple object types?

I have used freetag in other applications. (And I'm satisfied with it in those applications.) But like other tag libraries I have seen, it assumes a singular object type in the tagged objects table. create table tagged_objects ( tag_id int unsigned, object_id int unsigned ); (This is not the table definition from freetag.) ...

special characters from iPhone causing POST error in SQL

I have an iPhone app which submits user entered data to a SQL database. It causes an error, either cuts off the data or enters "null" when special characters are used. Seems that apostrophes and question marks and periods are ok, but anything outside of that causes it to cut off the post or post nothing at all. My SQL Query to insert th...

PHP mySQL not letting me insert into a table

Hey, I'm using the code: function insertV($deptx, $coursex, $secx, $isbnx,$titlex, $authorx,$usedpx,$newpx) { $sql = "INSERT INTO `$deptx` (`course`, `sec`, `isbn`, `title`, `author`, `usedp`, `newp`) VALUES ('$coursex','$secx','$isbnx','$titlex','$authorx','$usedpx','$newpx')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysq...

PHP extract article excerpt from a page

Hi, anyone have any idea how to generate excerpt from any given article page (so could source from many type of sites)? Something like what facebook does when you paste a url into the post. Thank you. ...

Downloading BLOB file with Oracle and PHP

Using PHP, I'm trying to download a blob file that has already been uploaded to an Oracle 10g database. I've seen and imitated numerous examples I've found. When I access the page a File Download dialog appears allowing me to Open or Save. If I click Open, media player comes up as it should but never retrieves the file. If I choose Save,...