php

PHP upload pics with space

Hello, please I need hep with the following. I have an upload pictures form. I need to make sure that pics which contain spaces in name are replaced wiht something else, I guess is %. ie pics name is: aa 22.jpg If uploaded this way it does not show it because of the space between aa and 22. What it the way to get rid of the space or ...

JQuery, AJAX, PHP, XML; Image overlay script stops working on callback content.

A button click fires my function that fetches image data via an AJAX-call: $("#toggle_album").click(function () { album_id = $("#album_id").val(); $.post('backend/load_album_thumbnails.php', { id: album_id }, function(xml) { var status = $(xml).find("status").text(); var timestamp = $(xm...

What's the difference between ++$i and $i++ in PHP?

What's the difference between ++$i and $i++ in PHP? ...

Sphinx for php code documentation

Sphinx is a Python library to generate nice documentation from a set of ReST formatted text files. Not the tool used for full-text searching I'm also fully aware of doxygen / phpdoc tools. I'm trying to figure out if there is a way of using Sphinx to document php projects? or even any other non-python languages? http://sphinx.pocoo.or...

how to add php tag in htaceess file

how i can write a PHP file that overwrites .htaccess with the correct information ...

How to reset a field when changing a date ui.datepicker.js [Solved]

Hi, I'm using ui.datepicker.js I have a form and when the date is changed I want that another field reset the status (this field is a dropdown select box). The case is the following: The user enter the latest billing date in the calendar (when he prepare a bill) and he select the status unpaid, when he will received the money he will...

Zend Framework getting started with Eclipse

Where can I find a good tutorial to get started with the latest version of Zend Framework using Eclipse or Netbeans? I would like Eclipse as my IDE as I like these features: * Syntax highlighting * Outline * Code assist * Code templates Besides that I use Mysql 5 as the db. Is there any free / paid video tutorials for the Zend frame...

Fast way to extract portions of array?

I have a large array in PHP. It contains strings that are split into a kind of categories using underscores: category1_property category1_category2_category3 category2_category3_category4_category5 I have a function named array get_values($prefix) that returns all values of the array that start with a given prefix, e.g. get_va...

How are PHPDoc comments analyzed in PHP?

In frameworks like Zend Framework (or extensions of it), it is sometimes possible to pass information like type hints to the framework code by using PHPDoc style comments. I cannot imagine that the framework parses the files using PHP, but I do not see any other way to achieve this, except for some built-in language feature of PHP, whic...

Which validator should be used to implement login in Symfony?

Currently, my login form looks like this, class LoginForm extends BaseFormPropel { public function setup() { $this->setWidgets(array( 'login_id' => new sfWidgetFormInput(), 'pwd' => new sfWidgetFormInputPassword() )); $this->widgetSchema->setLabels(array( 'login_id'=>'Login Id', 'pwd'=>'Password'...

Using cpulimit from within PHP

I have a script that's scheduled to run periodically on a customers production server to import some data from their FTP server. This needs to run as scheduled, even during the day when the customer is working. Occasionally, the script takes up large amounts of CPU which slows down the customers production environment. I thought I cou...

PHP Array Combinations

Hi Guys, Im using the accepted answer in this question. As I have the same requirements, I need to get all combinations of an array of variable length with a variable number of elements. However I also need it to produce all combinations which don't use all the elements of the array, but are in order. If that makes sense? So if this is ...

How to create Wordpress-style widgets in Drupal

Hi all, I'm investigating which CMS to use for my next project and am currently looking at Drupal. What I will need to do for the project is create widgets kind of like in Wordpress. Basically, little boxes that the user can provide parameters for, and I use the parameters in the widget. They can then place the widgets on the page, just...

How to make when we tick on checkbox and another input will fill up automatically

Form by example. $fullname = 'John Travolta'; <input type="text" name="fullname" /> <input name="same" type="checkbox" /> Tick if same name When we tick on the checkbox the input fullname will insert automatically by data from $fullname How to do that by javascript, jquery or etc ? ...

401 error on iis when uploading files via PHP

I have an upload script that runs on a windows webserver 2008. The uploads works nice, the file is created on the server. But when I try to access the uploaded image file via http, I just get an error 401. How can I resolve this? EDIT: setting the chmod to 0777 after the file has been uploaded did not help, too. ...

PHP: Prevent Direct Access To File Called By ajax Function

I'm calling the php code from ajax like this: ajaxRequest.open("GET", "func.php" + queryString, true); Since it's a get request anyone can see it by simply examining the headers. The data being passed is not sensitive, but it could potentially be abused since it is also trivial to get the parameter names. How do I prevent direct acc...

How to loop through a mysql result set.

What are some different ways to loop through a mysql result set? I'm new to PHP and MySQL so I'm looking for simple ways to loop through and an explanation as to how the provided code works. ...

In PHP/CodeIgniter how do you calculate Class & Form Rank based on grades for a student?

I have a database table that holds the following grade information for a student: student_id subject_id gpa letter_grade (which is calculated based on gpa, s the best way to do it? ...

URL Decoding in PHP

I am trying to decode this URL string using PHP's urldecode function: urldecode("Ant%C3%B4nio+Carlos+Jobim"); This is supposed to output... 'Antônio Carlos Jobim' ...but instead is ouptutting this 'Antônio Carlos Jobim' I've tested the string in a JS-based online decoder with great success, but can't seem to do this operation s...

PHP filter string input, cut off all newlines, 1 chars.

I'm writing in PHP! There's a user string input, and I want to cut off all newlines,1 chars that are more than 1 in a row (avoid <br /><br />...). example: I am a SPaMmEr! would become: I am a SPaMmEr! or I am a . . . . SPaMmEr! likewise ...