php

Undefined index 'PWD' in $_server

I got this error when I am trying to run a simple PhP script via php.exe. The name of the script is gulliver ( no extension), and I type this into my command prompt: php %Dir%\gulliver Here's the content in the gulliver file: <?php //***************** Operating Systems parameters ************************** if ( PHP_OS == 'WINNT' )...

PHP to read secured file

I have a xml-file on subdomain a, and a php script on subdomain b. I want to read, and use, the data from the XML file, through PHP. Here's the catch. The file is secured using HTTP Authentication. How do I make PHP log-in, and read the contents of the file? ...

Is this method good/secure enough for showing errors to users? - PHP

Hi I'm developing a website, and due to user-input or by other reason, I need to show some error messages. For this, I have a page named error.php, and I get the error number using $_GET. All error messages are stored in a array. Example: header( 'Location: error.php?n=11' ); But I don't want the users to the enter the error code in...

Load page within the page

Hi.. I'm a beginner in PHP and Javascript.. I found a link from http://cmichaelis.whsites.net/whblog/jquery-extjs-1/example2 Inside it there is a code saying : function addPanel(location) { tabpanel.add({ autoLoad: {url: location}, title: 'More Information...', closable:true, autoScroll:true }).show(); }...

Where is the setCouponCode function is defined in Magento

I know that setCouponCode is catch inside __call in Varien_Object but I can't figure out where it is defined. I need it because I want to show the coupon code even if the discount equal zero. I believed it's done inside this function. So if anybody know where the function is defined or where I can modify the code to get the coupon code...

Attach file in formmail. (php formmail)

I'm writing a mailform i php for placeing orders, and sense they have to get send a picture to me for the order to work properly, I'd like to be able to attach the file in the formmail. How shuld I do this? I have seen some different sulutions but non that I've complety understand. ...

How can I implement jquery in my Zend Framework application in a custom manner?

How can I implement jquery in my Zend Framework application in a custom manner. appending jquery.js ok appending script ok send POST data to controller ok process POSTed data ok send 'AjaxContext' respond to client now ok (thanks) I'm using jquery for the first time, what am I doing wrong? ...

How to check if an email address exists without sending an email?

I have come across this PHP code to check email address using SMTP without sending an email. Has anyone tried anything similar or does it work for you? Can you tell if an email customer / user enters is correct & exists? Thanks! ...

How do I create a regular expression that disallows symbols?

Hey, I got a question regarding regexp in general. I'm currently building a register form where you can enter the full name (given name and family name) however I cant use [a-zA-Z] as a validation check because that would exclude everyone with a "foreign" character. What is the best way to make sure that they don't enter a symbol, in bo...

PHP error: Unable to Load Dynamic Library (memcache.so)

error_log shows the following line on startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so' - (null) in Unknown on line 0 The file exists and it compiled properly. PHP version is 5.2.6. After Googling for a couple of hours I managed to find a couple of similar problems, but no solutions...

The difference between declaring a variable as "var $foo" or "$foo" in PHP?

The title explains it all. What's the difference? var $foo; $bar; What's the main difference between this two variables? I've noticed that "var $foo" is mostly used to declare class attributes, but why is it so? Thanks in advance for all your answers. ...

Coding standards and line length

Every coding standard I've ever seen has a recommended or absolute limit on number of characters in a line. There are various ways of working within this limitation, but I've not seen any specific guidance in this regard. Obviously, if possible, don't write excessively long lines. But what if that's not practical? How should long lines...

Automated mailing list - PHP

i have an application on my site where people can sign up to receive newsletters, and then someone in a paid group can write and send one immediately to everybody who signed up... ...meaning that i need an efficient way to loop through my database of subscribers and mail them copies of the email using php. clearly, there is the mail() ...

Complete Mail header - php

I need a set of mail headers to attach to my mail() function in PHP. I send emails with HTML in them, and sometimes clients like Yahoo block them. Therefore I need to make sure that I am at least providing the right headers. My code: // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $h...

Can't execute PHP script using PHP exec

I am trying to invoke a script which takes several seconds (web services with 3rd party) using the PHP exec call. After much struggling, I reduced this to the classic hello world example. The calling script looks like: exec('/usr/bin/php /home/quote2bi/tmp/helloworld.php > /tmp/execoutput.txt 2>&1 &'); When I run this, the output (ex...

OOPS, there goes the performance?

I was working on my website written in php/mysql. When I first wrote it, it was spaghetti with lots of php embedded in html and the like - very hard to maintain. I rewrote the whole thing with a nice modular structure with OOPS, and now it is much easier to maintain and expand. But when testing the site performance using webwait and si...

CodeIgniter Install Problem

Hi All, I'm having a problem getting CodeIgniter to work on my shared hosting account. The URL is http://test.tallgreentree.com. It's not giving me a .php error, but it is displaying a 404 page for everything I type into the address bar. Here's the beginning of my config.php file. <?php if ( ! defined('BASEPATH')) exit('No direct s...

Use of mysql_unbuffered_query in Zend Frame Work, is it supported?

I need to run a query which will retrieve a huge amount of records. This means I can't use the ZF wrappers for mysqli, which deep below the hood uses mysqli-store-result. So, is there a wrapper in ZF for using the mysqli mysqli-use-result link text, which will return an Iterator/record-set/resource and not the array with all the results ...

Zend Framework 'AjaxContent' & ResponseSegmentation problem

I'm using jquery in Zend Framework, it's my first trial. I've already found out through another question, that I can change the response by changing the context like so: $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('myaction', 'html'); $ajaxContext->initContext(); Now this has helped a lot bu...

Is PHP allowed to modify .htaccess file in current folder?

I have a PHP web app located on shared hosting. My goal is to modify .htaccess file from PHP code when the PHP page is running. I need that .htaccess to insert a couple of mod_rewrite lines into it. The problem is that on Windows+Apache I can dinamically modify .htaccess file but the same code on Linux reports a problem when I try to ac...