php

date_sub is not working

As my server is not upgreaded to php 5.3 (it is in PHP Version 5.2.11) date_sub is not working. here is the code: $date = date_create(date('Y-m-d')); date_sub($date, date_interval_create_from_date_string('60 days')); $date1= date_format($date, 'Y-m-d'); but its ok in my localhost(which is in 5.3), but no...

XSS attack to bypass htmlspecialchars() function in value attribute

Let's say we have this form, and the possible part for a user to inject malicious code is this below ... <input type=text name=username value= <?php echo htmlspecialchars($_POST['username']); ?>> ... We can't simply put a tag, or a javascript:alert(); call, because value will be interpreted as a string, and htmlspecialchars fi...

What's the best online resource to learn about installing JSON API's

Title says it all..What's the best online resource to learn about installing JSON API's ...

Manipulating jQuery to retrieve the onclick function of an item which lies directly below the current focus with the same parent

First off, I want to thank you for looking into my question as I really do appreciate your time. I've built a list of items using php by having a foreach loop cycle through an associative array printing the array data as parameters of an onclick function call and gives each item it cycles through an ID of $thecount. All items retrieved ...

How would I UPDATE these table entries with SQL and PHP?

I am working on an Asset Database problem. I enter assets into a database. Every object is an asset and has variables within the asset table. An object is also a type of asset. In this example the type is server. Here is the Query to retrieve all necessary data: SELECT asset.id ,asset.company ,asset.location ,asset.purchaseDate ,...

php cache zend framework

server side is PHP + zend framework. problem: i have huge of data appox 5000 records and no of columns are 5 in input.txt file. i like to read all data into memory only once and send some data to the every browser request. but if i update that input.txt file then updated data must be auto synchronized to that memory location. so i n...

What is the tag in facebook API in iFrame for username?

I use this in FMBL = echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>"; But it dont work on the iFrame option. What i need to do in order to see the user name in a iFrame? Thanks ...

Trying to generate proportionally cropped thumbnails at a fixed width/height with PHP GD

I'm trying to create a Thumbnail Generator in PHP with GD that will take an image and reduce it to a fixed width/height. The square it takes from the original image (based on my fixed width/height) will come from the center of the image to give a proportionally correct thumbnail. I'll try to demonstrate that confusing sentence with some...

how to synchronize database table and directory with php

hello, I have a directory with files and a database table with what should be the same files. I would like to be able to synchronize the database table with the directory. What would be the most efficient way to do this? or would I realistically only be able to do this in a brute manner? Here's my approach: 1. retrieve all of the files...

How to receive XMLHttpRequest with PHP?

I would like to be able to read XMLHttpRequest that is sent to a PHP page. I am using prototype's Ajax.Request function, and I am sending a simple XML structure. When trying to print the POST array on the PHP page, I don't get any output. Any help appreciated. EDIT: Below is my code <html> <head> <SCRIPT type="text/javascript" src...

protecting my web page and folder from external using .htaccess and .htpassword in php

Hai I want to protect a folder (protect) and the files inside that folder. I have created a .htaccess file and put the following code. AuthName "Myfolder" AuthType Basic AuthUserFile url/protect/.htpasswd Require valid-user Also created a .htpassword file which contain username:password When I run my URL http://localhost/url/protect...

How do I query in cakephp, if the date in the field 'created' of model 'listings' is more than 2 weeks ago?

I have a model 'listing' with a field 'created' which is in a datetime format. I need to list in a view all listings that were created over 2 weeks ago. An extra thing if possible is to somehow mark them as expired. This is in cakePhp 1.27 ...

Automating Wordpress Development and Deployment

Has anyone ever worked on a WordPress project with multiple developers in different locations? Are there best practices around distributed development teams and automated deployments? I have a team of varying degrees of developers, including plugin developers, theme developers, and simple CSS style tweakers, in a few different locations...

Efficient Method for Preventing Hotlinking via .htaccess

I need to confirm something before I go accuse someone of ... well I'd rather not say. The problem: We allow users to upload images and embed them within text on our site. In the past we allowed users to hotlink to our images as well, but due to server load we unfortunately had to stop this. Current "solution": The method the program...

what is the difference between these two foreach loops ?

I have seen in cakephp that foreach loop is used like this foreach($tags as $tag) : \\code here endforeach; and I used to write this style of foreach foreach($tags as $tag) { //code here } what is the difference between these two foeach loops and which one is better and makes more sense to implement ? Thanks ...

How to load a model?

How can I load a model? I have tried several times but it doesn't work. My code is: <?php class NotesController extends AppController { var $name='Notes'; var $helpers = array('Html','Form','Ajax','Javascript'); var $uses = array('note'); var $components = array('ModelLoader'); function index(){ $this->ModelLoader->setControll...

convert clean url to normal url by mod_rewrite php

Hai I have worked with clean URL in php. Now I want to convert a clean URL to normal php URL Like http://localhost/url/user/2/a to http://localhost/url/user.php?id=2&amp;sort=a Can any one give me the way to do this? also i have one more question. Is there is any way to do this with out .htaccess? ...

Events in inputfields after AjaxRequest.

Hello I have this problem when I do an ajaxrequest that I lose my onchange events from my inputfields. Well I have done this function that would reinit the events to those inputs but Im not sure if that is the best way to do it.. ...

Error in configuration file

I have copied my project folder from my live server to my local host and edited the config file as per localhost, but still i am displayed with the "Internal Server Error:500" The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin...

Uninitialized array offset

Hey everyone, I am using PHP to create a form with an array of fields. Basically you can add an unlimited number of 'people' to the form and each person has a first name, last name, and phone number. The form requires that you add a phone number for the first person only. If you leave the phone number field blank on any others, the h...