php

Prevent PHP from sending the PHPSESSID cookie with requests?

I am serving dynamic image content which is generated by PHP. But for such requests to a .php file, the PHPSESSID cookie is being sent along, which is a waste. Is it possible to prevent PHP from sending this cookie with requests to a PHP file? Or is it completely necessary for PHP to work? Thanks for your time! ...

Does a graceful Apache restart clear APC?

Will calling $ httpd graceful clear out the APC cache, or do I have to do a full-blown $ httpd restart to do it? (Keeping in mind that I know there are better ways to do it, like calling apc_clear_cache() programmatically). ...

How to properly add newlines to an XML string in PHP?

I have some xml that I manually construct in a function that is something like: $xml = "<myxml>"; $xml .= "<items>"; $xml .= "<item1>blah</item1>"; $xml .= "</items>"; $xml .= "</myxml>"; When I output the string though I'd like the newlines to be present. How can I add this to the string without affecting a web service accepting the ...

Strange unset cookie problem

Hi there, I have a strange problem to clear Cookie via PHP. Lets say if I have a domain neobie.net I store "remember user login" cookie name as "USER_INFO" which contains string to identify user login in the next time of revisit. now using firefox, I saw that I have 2 cookies USER_INFO with domain "www.neobie.net" and ".neobie.net" wit...

Lost parameter calling WS from PHP

Hi, I'm trying to call this WS from PHP: namespace WsInteropTest { /// <summary> /// Summary description for Service1 /// </summary> [WebService(Namespace = "http://advantage-security.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow ...

Extract all text from a HTML page without losing context

For a translation program I am trying to get a 95% accurate text from a HTML file in order to translate the sentences and links. For example: <div><a href="stack">Overflow</a> <span>Texts <b>go</b> here</span></div> Should give me 2 results to translate: Overflow Texts <b>go</b> here Any suggestions or commercial packages avail...

filename for class files: file.class.php or file.php?

i have seen a lot of coders choosing this filename convention: file.class.php. is this a standard of naming class files? just curious. so i know if i should follow it for all class files in the future. thanks ...

a library for spl_autoload?

i wonder if there is any library for spl_autoload where one can just set all the folders and it will take care of loading them correctly. thanks ...

How to get data from a incoming email and then copy data to some directory

First of all, I have some time reading this page and I find very interesting, the content also has many questions and are very entertaining. My question is about handling my incoming mail server, no matter if you use PHP, Perl, or Python. I do not care, what if I want is the result which should be as close to: I send an email to update...

Design pattern question: encapsulation or inheritance

Hey all, I have a question I have been toiling over for quite a while. I am building a templating engine with two main classes Template.php and Tag.php, with a bunch of extension classes like Img.php and String.php. The program works like this: A Template object creates a Tag objects. Each tag object determines which extension class (...

Delete file using a link

Hi all, i want to have function like delete file from database by using link instead of button. how can i do that? do i need to use href/unlink or what? Can i do like popup confirmation wther yes or no. i know how to do that, but where should i put the code? this is the part how where system will display all filename and do direct uplo...

mySQL ORDER BY ASC works, DESC does not...

I've "integrated" SMF into Wordpress by querying the forum for a list of the most recent videos from a specific forum board and displaying them on the Wordpress homepage. However when I add the ORDER BY clause, the query (which I tested on other parts of the same page successfully), breaks. To add to the mix, I am using the Auto Embed ...

Which Code Should Go Where in MVC Structure

My problem is in somewhere between model and controller.Everything works perfect for me when I use MVC just for crud (create, read, update, delete).I have separate models for each database table .I access these models from controller , to crud them . For example , in contacts application,I have actions (create, read, update, delete) in c...

Can I use string concatenation to define a class CONST in PHP?

I know that you can create global constants in terms of each other using string concatenation: define('FOO', 'foo'); define('BAR', FOO.'bar'); echo BAR; will print 'foobar'. However, I'm getting an error trying to do the same using class constants. class foobar { const foo = 'foo'; const foo2 = self::foo; const bar = self::f...

PHP HTML table is too wide

I have a table that I cannot get to size correctly. The table populates with information from a database via a loop. Sometimes if the data is too long the table extends past where it should. When the data is that long I want the data to wrap in the cells so the table stays where it should. I have tried the normal table data but it ...

Flashvar to included swf (in php)

How to pass a flashvar when I include the swf (to make an embedded player) Something like this does not work.. theme->basePath.'/swf/ebook.swf?xml="test"'; header("Content-Type: application/x-shockwave-flash"); readfile($player); ?> ...

Nearmap architecture

Looking at http://www.nearmap.com/, Just wondering if you can approximate how much storage is needed to store the images? (NearMap’s monthly city PhotoMaps are captured at 3cm, 5cm, 7.5cm, or 10cm resolution) And what kind of systems/architecture is suitable to deliver those data/images? (say you are not Google, and want to implement t...

When selecting an amount of rows, how can I select a percentage of a percentage?

Fairly simple question: Say I want to use 30 percent of the rows in the table of my MySQL table. However I also have a user input where they can select a percentage of that percentage For example: $_GET['percentage']% of 30% so we say that $_GET['percentage'] = 30 How would I select 30% (or $_GET['percentage']) of 30% to use in a wh...

Using curl_init in Zend Application is causing Session Error

Hey guys I'm getting this weird error in my Zend application with this piece of code: $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'www.xyz.com/ab.php'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); curl_close($curl); if (!isset($location->country)) { $location = new Zend_Session_Namespace('lo...

When to alter a function vs when to just write a new one...?

/is n00b Through the gift of knowledge and expertise encoded here, I am doing my best to avoid n00b mistakes as I learn the basics of programming. I use functions when I (think I) can in PHP, and keep them somewhat sorted in different includes. The n00b problem I'm running into now is situations where perhaps 4/5th of an existing func...