php

PHP editors for Ubuntu

What are the Light weight PHP editors available for ubuntu? And is there a ubuntu version of the Notepadd++ editor Thanks ...

Limit Amount Of Widgets In Wordpress

I have designed a Wordpress theme and on one of my sidebars there can only be 3 widgets. I need to limit the amount of widgets a user can add to this theme some how. Any ideas? I can use plugins if necessary ...

Use javascript and php via ajax to run MySQL queries

I was looking through some code on a project of mine and thinking about all the php pages that I call with ajax that just run a simple update or insert query and it made me think. What if I could essentially run an insert or update sql query from javascript. assuming I am using the prototype javascript framework for ajax and php on the ...

PHP - Auction Script

Hi, I need to auction an item among a small group online, please could anyone point me to any PHP class or any open source script. Thanks, Kaartz ...

Trying to write to a file and force download with php

Im using the following code to present a file for download. The file saves on the server correctly with the data, and prompts for download, but the downloaded file is empty. The new file is in the same directory as this script. <?php if(strlen($_POST['name'])<1){ echo "error: you must enter a filename<br><a href=data.php>back</a>"; exi...

More than one value in Smarty {if}

Hy i have this code. {if $isModerator && $order->kind==1} bla bla {/if} and $order->kind can be 1,2,3,4,6 so making 5 if is not the idea any idea? ...

Is there a simpler way to check if a variable equals a variety of numbers?

This is what i have currently if($j == 1 || $j == 2 || $j == 3) Is there a simpler way of writing this. Something like... pseudocode if($j == 1-3) ...

Create class in PHP

Hello all, i'm a newbie to PHP and i don't like to write my code in notepad-like editors. Is there an editor like VS for PHP? Also, if you could give me a reference to a good introductory PHP eBook (one that covers simple concepts like declaring and using classes in PHP) that would be great. Thanks in advance! ...

PHP Class and inheritance, serialization

Hi! Serialized varibale does not seem to retain its state from classes that were extended. I have a class, called directly from somewhere that accepts a serialized variable: class Main extends Admin { function __construct($serialized){ parent::__construct($serialized); } .... (omitted) } class Admin extends Page{ var $pagearg...

Trying to find a (jquery?) popup date/time selector with callback to php

I have a large table with input boxes. Three columns of these are dates/times (in unix format). Im trying to find an easy to implement way of allowing the user to click on this box, being able to (graphically) select a date/time, and when done, sending the selection to a php script to make the physical changes of the data. (i can conve...

$_SESSION up all $_POST variables?

Is there any way to do some kind of while() for each post variable and session it up... like in mysql while($row=mysql_fetch_array($result)){ echo($row['name']; } But to get this result with the $_POST while($_POST){ $_SESSION['BLA'] = $_POST['BLA']; } Thanks in advanced :) ...

Drupal: passing variable from preprocess to template.php?

How can I get a value from a preprocess function to template.php, in a function named sitename_modulename_user_loginblock($form)? I created the value in the preprocess function with a custom query so I could do that in the loginblock function itself, but only $form is available there and I need 3 other variables to construct the query. ...

Convert two string to the same byte length

I have 2 strings in my PHP code, 1 is a parameter to my method and 1 is a string from an ini file. The problem is that they are not equal, although they have the same content, probably due to encoding issues. When using var_dump, it is reported that the first string's lenght is 23 and the second string's length is 47 (see the end of my q...

which is the better way to get the ip...

What is the better way of getting the IP address in PHP: getenv('REMOTE_ADDR'); or, $_SERVER['REMOTE_ADDR']; please tell me the difference, if any, between the two. ...

cURL problem fetching binary data via HTTPS

Hi everyone, I need to fetch images for one of my projects via https connection. I use Snoopy PHP class as HTTP server. This class uses cURL program for performing https requests, I mean it calls cURL directly using system() PHP function. The problem is that I get images broken. When I fetch HTML pages through secure connection, everythi...

PHP Sort array by month then year

Hi, I have an array or objects with a dates which I wish to sort by. I have the following custom function that I pass to usort function sortMonths($a, $b) { if ( $a->received_date == $b->received_date ) return 0; return ($a->received_date > $b->received_date) ? 1 : -1; } Which does as required and sorts dates so I get: 2009-...

Get wan ip address using php

Hai Guys, How to get wan ip address of my user using php.... ...

PHP Debugging with Expressions?

Hi, I am new to debugging and I'm very interested in knowing how to setup expressions in debugging environment. For example, if I want to see when a variable $a changes it value to non-empty, how would I find it out? ...

Run Apache / PHP / MySQL (CakePHP) application on a USB stick?

Hi, I have an existing CakePHP that runs on a LAMP environment and need to install it on a USB drive for mass public distribution. There are a few requirements: Protect the source code No installation required Windows support essential MAC & Linux would be a bonus Must run offline, without Internet connection Ability to sync with ser...

Using ajax to send GET to php file after change to input

I have a series of dynamically generated inputs that I need to have ajax update in a php file for me once the user clicks off of the input. I think I have the right code, but it's not working for reasons beyond my understanding. I'm a complete javascript/ajax noob, so be gentle. The js/ajax: <script type="text/javascript"> // Initial...