php

prevent $_SESSION vars from being on multiple domains on same server?

I am in the process of planning for a series of websites that will all point to the same server and share the same back end code, but have different domain names, different content, and look completely different. Here is my issue, say a user visits one website and adds something to the cart, then visits the other website. (which is actua...

How can I specify a special character in PHP

I am trying to output a sigma character () in a label in a FusionChart graph. How can I specify that character in a PHP string? I have tried the htmlentity σ, but it is not interpreted correctly by the graph. Is there any way to specify the character in PHP using some sort of character code? ...

Complex WHERE clauses using the PHP Doctrine ORM

I'm using the PHP Doctrine ORM to build my queries. However, I can't quite seem to figure how to write the following WHERE clause using DQL (Doctrine Query Language): WHERE name='ABC' AND (category1 = 'X' OR category2 = 'X' OR category3 = 'X') AND price > 10 How can I specify where the parentheses go? What I currently have in my PH...

LDAP and PHP

I am trying to connect to a secure LDAP server (using LDAPs) via PHP, but I am having problems with it. I get the following error Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in /var/www/test.php on line 16 I works when I try to connect without LDAPs, but it is required that I use LDAP...

accessing values globally

Hello, I have 2 files namely: uploading.php emaillinks.php both include a file inc.php which has all the include files and initiate database connection. a variable is declared in file uploading.php, i wanted to know how can i access it in emaillinks.php, i cant include uploading.php in emaillinks.php. I want to avoid cookies becau...

How backwards compatible is php 5 with php 4?

Hello everyone, I work on a code base written in php 4. I'd like to go through the process of upgrading the code to php 5 (the latest version my host provides). I'm wondering if anyone else has gone through a similar upgrade experience and can share what gotchas/pitfalls there are, what has to change in my code, what is not backwards co...

Combine Directory and File Name in PHP ( equivalent of Path.Combine in .Net)

This should be a simple question, but I just can't recall the relevant API. A search on google with the term "combine directory name php" doesn't yield any results. So I guess I am doing both myself and the programming community a service by asking this question. How to combine directory and file name to form a full file path in PHP? Le...

Suggested way to allow others to plugin to my php script and change variable values?

People want to use my Jquery plugin, but get a list of images from a database instead of a directory, which is the standard way the plugin works. My Jquery plugin that uses the ajax() function to deliver & return data to a php script. The php script pulls files from a directory with getdir(), adds those files to an array and assigns th...

Get remote text file, process, and update database - approach and scripting language to use?

I've been having to do some basic feed processing. So, get a file via ftp, process it (i.e. get the fields I care about), and then update the local database. And similarly the other direction: get data from db, create file, and upload by ftp. The scripts will be called by cron. I think the idea would be for each type of feed, define the...

Zend Framework Query

Can anyone help me to do this in the right way?I mean.. like that : $db->select()->group..... I tried a few times, but doesn't work for me :( $this->q->fetchAll('select * from clubs, club_photos_default where clubs.id=club_photos_default.c_id group by clubs.id'); Best Regards, ...

Why am I getting an "Undefined variable" notice in PHP?

So I have the following: <?php show_form(); ?> <form id="add" method="post" action="addIssue.php"> Name: <?php input_text('name','str_name', $defaults , '1'); ?> <input class="submit" type="submit" value="Begin download" /> <input type="hidden" name="_submitCheck" value="1"/> </form> <?php function show_form($er...

Why does PHP require an explicit reference to "$this" to call member functions?

That's pretty much it. Scoping in most OO programming languages resolves symbols fine without an explicit reference to the current instance (i.e. '$this' in PHP). Why does PHP require me to precede every call to a member function in the same class with $this? ...

How do I ignore a single row in a query result using SQL or PHP?

Can I somehow ignore the post with the earliest date? With SQL or PHP? SELECT subject, date FROM posts WHERE id = $id ORDER BY date DESC while ($row = mysql_fetch_array($query)) { Cheers ...

VIM Disable Automatic Newline At End Of File

So I work in a PHP shop, and we all use different editors, and we all have to work on windows. I use vim, and everyone in the shop keeps complaining that whenever I edit a file there is a newline at the bottom. I've searched around and found that this is a documented behavior of vi & vim... but I was wondering if there was some way to d...

PHP new COM("word.application") SaveAS causes "Disk is Full" Error

Hello, I have a PHP script running on XAMPP in Windows XP that will open a .doc file and then save it as a different copy. This was working fine earlier on, but out of nowhere the error message keeps appearing. $path = "c:/xampp/htdocs/"; com_load_typelib('Word.Application'); $word = new COM("word.application") or die("Unable to instan...

How can I remove duplicates in an object array in PHP?

I have an object like this: class FanStruct{ public $date; public $userid; function __construct($date, $id){ $this->date = $date; $this->userid = $id; } } I have maximum of 30 of them in an array, and they are sorted by $userid. What is the best way to go though the array, and remove duplicate objects base...

PHP dependant foreach loop

What I am trying to accomplish here is to separate a firstname, lastname combo to store in a database. I already added the the new columns in the database to hold the first and last names. What I need to do now is to actually separate them and run an SQL update against the changes. Can someone please give me a hand? Thanks. Here is my ...

Use php's readfile() or redirect to display a image file?

I've a directory outside the webroot with images, css and javascripts. These files often change. I could write a script which locates the file, figures out the mime type and outputs it to the browser. Or i could locate the file, copy it to a webaccessable directory and redirect to that file using header location. When the file is reques...

webserver crash with exec in php

i am try to convert some file with exec in php and get the return . i do this and this is work so successfully but if i run it for more than 10 times, the webserver (wampserver) get crash and i must restart server to continue ? please let me know what is the problem if you know . System : wampserver version 2.0 on windows xp and 2003 se...

iPaper Module for Drupal

I have successfully installed the iPaper module from Scribd.com. But I could not upload files. What's happening is that the "attachment" is being uploaded to my webserver but it wouldn't go to scribd.com. Any tips on what to look for? ...