php

Refeshing a page to a new state

I have a written a blog using php and mysql which has a login feature. When you are logged out and hit back it should not show the features of a member since you are no longer logged in. How do I correct it so that when a user is no longer logged in and hit back button, the previous page should be in the state before he logged in? ...

php loop: repeat just once

How can I get a php loop to print out: 1 1 2 2 3 3 all the way to 250 250. So basically count from 1 - 250 but print out each number twice? ...

Issue with opening XFDF PDf's from PGP program

I have a system that prepopulates PDF fields via XFDF. THe XFDF code seems fine, but when I try to open it with the header() in PHP, PDF fires an error. If I ignore it and refresh the page, it works fine and poplulates the form correctly. Below is the XFDF code as well as the header I am using... Any idea why PDF doesnt display it rig...

php-cli: What is the best way to detect the hosting OS?

I have a script which I want to run on windows under Cygwin and on Linux. I have to make distinction between the two running environment for some purposes. What is the best way to do it? ...

what should i do with CakePHP Framework?

I'm new to OO PHP and I have read that using Frameworks can really help me with my projects. Can anyone suggest a site where I can learn how to start with CakePHP or tell me what I need to do so that I could use the framework CakePHP? I have no idea X.x Thanks ...

combine two (or more..) multi-dimensional arrays in php

Hi, I have a query that I run several times with different parameters. I am using an xml parser to return the results to jQuery. I can't seem to find a way to combine the results on the first 'node' without overwriting the first entry. Simplified code sample: $temp1 = returnArray(0); $temp2 = returnArray(1); $data = array_merge($t...

PHP gd library clarification

I'm looking at this code and have been through the docs but still don't understand how this should work. The code works fine just as it sits but I'm wondering if I should be outputting the header as png instead of jpeg. What exactly is going on in this code? Is the png image converted to jpeg? What I ultimately want to do is to waterma...

popup based on the result of comparison

hello all, The situation is that the user enters a value in the textbox.Now whenever user enters the value, the value is to be compared to a value(field) which has been retrieved form the database.If the value the user has entered is higher than that of the database then they should be displayed with a popup.How do i do that?The languag...

problem with Zend_View_Helper_* and autoloading

I have set the autoloader to use the Fallback Autoloader like this: $autoloader=Zend_Loader_Autoloader::getInstance(); $autoloader->setFallbackAutoloader(true); If I look at php errors, a notice is generated for every call to a Zend_View_Helper with it trying to read the helper at for example: /var/www/arc/views/helpers/. Here is a sa...

Problem with return value of oci_parse

what will be the condition of if , where i want to execute some command inside if ,if there is no row returned by the query. if() { } else { } ?> ...

Using values inside a function out side

is it possible to use values that are obtained within a loop/function out side the loop/function where it is used or called? below is my function function off($limit) { $string=file_get_contents("feed.xml"); $xml=simplexml_load_string($string); foreach ($xml->FOUND->CAT as $place) { $limits = $place->CORDS; ...

Cake PHP - Form Validiation doesn't work

Hi everybody, my CakePHP (1.2.5.) doesn't validate my form correct. $this->UserData->save($this->data); gives me always a true value back. I can't find the problem. The label for UserData.nichname works. That's the View: <?php echo $form->create('UserData'); echo $form->error('UserData.nick_name'); echo $form->input('UserData.nic...

How to enable PHP short tags ?

I have a web application on a Linux server which starts with <? I needed to copy this application to a windows environment and everything is working fine except that an SQL statement is being rendered differently. I don't know if this has to do with the script beginning with <?php instead of <? because I don't know from where to enable ...

Properly formatted MySQL date insert statement returns all 0's

I've created a PHP script that parses an HTML page, creates a MySQL query, and inserts the parsed data into a MySQL table. Everything works fine, except for one thing : the date field. When PHP runs the MySQL statement, the dates in the table read 0000-00-00 . If I echo the MySQL query, it results in the following : INSERT INTO dispatc...

how i can upload a file in zip archive

now i working with PHP: ZipArchive and there is a function calles addfilefromstr how i can upload a file and get its content from tmp then add it in archive i think file_get_content will do that? or using copy function how i can make it ...

How to create a datetime validator in a Zend Framework form?

By default a Zend Framework date validator uses the date format yyyy-MM-dd: $dateValidator = new Zend_Validate_Date(); But I want to add hour and minute validation. In other words, I want to require the user to enter the hour and minute. But the following does not work: $dateValidator = new Zend_Validate_Date('yyyy-MM-dd hh:ii'); I...

Creating a session for current visitor to edit or delete blog comments

My blog uses PHP and MySql. I wanna give the user a feature to edit and delete their comments when they are in the site. They are not logged in users. In order to do that, how do I go about this? They will not be able to edit or delete once they leave the site as session should expire. ...

How to start a local port on user's computer (Edited question)

Hi guys, sorry in the past I have not been able to formulate my question coherently. This will be my last try. =| Basically, I want to do something like this website is doing: http://www.ninjavideo.net/video/56388. They are rendering an iframe that points to a port on localhost. You will see nothing in the iframe if you dont have their ...

CakePHP displayField usage

hello! can you help me how to use CakePHP's displayField directive, I can not figure out how to use it... so, in a model file, i have following code... <?php class Task extends AppModel { var $name = 'Task'; var $displayField = 'projectName'; //The Associations below have been created with all possible keys, those that are not nee...

curl halts script execution

my script uses curl to upload images to smugsmug site via smugsmug api. i loop through a folder and upload every image in there. but after 3-4 uploads, curl_exec would fail, stopped everything and prevent other images from uploading. $upload_array = array( "method" => "smugmug.images.upload", "SessionID" => $session_id, "Alb...