php

Best data grid for php based application using ajax

What is the best data grid for php based application using ajax? Any reference please? ...

PrestaShop: Different types of users/clients

My scenario happens when registering a new user, or when doing an Express Checkout (w/o registration): How can I have two radio inputs - individual or person (legal entity) - and depending on this selection to show different fields to be checked out? ...

Double mysql_real_escape_string insert of new line characters. How to get new line breaks back?

Hi, I have a textarea field that's inserted into a mysql database which may contain line breaks. The textarea data has accidentally gone through two lots of mysql_real_escape_string functions. Therefore the line-break bit of the field data is now stored as "\r\n" instead of an actual new line, as it's been double escaped? Now when writ...

Twitter trends CURL php

Hey Guys How do I extract current top 10 twitter trends using CURL. All the php tutorials I found seem to use the old twitter urls which have since changed.. Here is a new url I'm struggling with, the new date at the top seems to throw it http://search.twitter.com/trends/current.json Any ideas how to echo the values? e.g. output is ...

PHP Pagination Code

So What I'm trying to do is create pagination, with a max of 5 pages showing. If there are only five pages that are returned from my MySQL statement, return the five pages. Otherwise, return 2 pages in each direction. So ideally, if I'm currently on page 1, it shows pages 1 2 3 4 5. If I am on page 5 and there are a max of 5 pages, sh...

Add some new data into an Array in PHP

Hi all, I got an Array like this: array('Testing'=>array( 'topic'=>$data['Testing']['topic'], 'content'=>$data['Testing']'content']) ); Now I have got some new data to add into the Array shown aboved, how can I do it so that the new Array will look like this: array('Testing'=>array( 'topic'=>$data['Testing']['topic'],...

How is it possible to protect PHP code?

Is it possible to protect PHP code without using a compiled module (.so/.dll)? What software can help with this? ...

Passing a variable from one Controller Action to another.

Hi I would like to pass a variable from one Controller Action to another and display the value on the view script. class ImportController extends Zend_Controller_Action { public function ImportrecordsAction() { //Do some processing and in this case I select //23 to be the value of total rec...

CODEIGNITER :: how to save 2 configs for 1 library ?

hello i want to use upload library, but i want to use it in 2 separate uploads .. for example avatar and profile picture. each one of them has it's configs .... my application is v.big so it's better to save the upload configs library in a config file. but how can i save 2 configs in the same config file and load 1 of them at a time? ...

problem in reading txt file in php

hey guys im looking for a way to read a file into an array and get what i want . this is the code i used to read a file into an array $Path = 'dewp/pix/info.txt'; $productsArray = file($dirPath, FILE_IGNORE_NEW_LINES); foreach ($productsArray as $key => &$product) { $arr = explode("\t", $product); $product =array('album=' => ...

How can I change my multilingual urls from this example.com/index.php?lang=en to this example.com/en/?

Somebody told me that example.com/en is more friendly than example.com/index.php?lang=en. How can I change my URL last part from ?lang=en to /en/? (pd: I don't want to use gettext or any framework like zend to accomplish this) This is how I'm internationalizing and localizing my web page: (live example: alexchen.co.nr/) lang.php: <?...

How to use php function to report form abuse.

I have a contact form on my website, and everything works like a charm. I am using a anti-injection validation script, that I suspect is supposed to send a notification when somebody attempts to use header injection. I have tested this thouroghly and cannot determine why it will not notify me on the event of an abuse. The script is below...

Problem proccessing checkbox on MAMP

Hello I have two separately named checkboxes sending values to the following script. I seem completely unable to reliably tell if the checkboxes are on or off. I have checked the values are being sent in the $_POST and they are as expected. Please help! $form = $_POST['form']; $recruit = $_POST['recruiting']; if (empty ($form)) { ...

[PHP] Distance between two addresses

Hi there, I'm writing a booking web site in php and I would need a library or a remote service (similar to google maps api) that calculate the distance between 2 addresses. Ideally I prefer road distance but I don't care too much about what kind of distance is. Can you help me? Thank you very much, every help will be welcome. ...

PHP: How to get age in php from day, month, year ?

I have 3 variables $day, $month, $year each of them have the values what the users given to them. I want to get his real Age too from these 3 variables. For example the user enters this date for his birthdate in this format day,month,year: 04, 07, 1990 -> Now his age is 19 02, 07, 1990 -> Now his age is 20 I want to have i...

Convert seconds to Hour:Minute:Second

I need to convert seconds to Hour:Minute:Second for example : 685 converted to 00:11:25 can you please help me achieve this thanks ...

Best practices for user physical location (input, data type, display and validation)

I'm building a web application that requires users to provide their location (similar to the way Facebook does it). I'm not sure on the best way to implement this. I require the ability to search through records of another entity (call it 'events') which also have a physical location attached to it, and match the users in the same or clo...

CodeIgniter passing dynamic data from controller to view.

I am passing an array to a view from a controller. Simple stuff. Should work, but is behaving rather too strangely and I cannot figure out the bug. This is the controller- $link = "http://" . $server . ".something.com/uploads/" . $name; $data = array( 'name' =>$name, 'server'=>$server, 'link'=>$link, 'username'=>$userna...

preg_replace question

Hello I'm trying to do the following: Say I have an input string like this {stackoverflow is a {cool|great} website|stackoverflow is the {best|greatest}}. {stackoverflow is for {cool|great} coders|stackoverflow is the {best|greatest} site for coders} How can I convert it to the following format by using PHP {stackoverflow is a [cool...

the_content filter doesn't return html code, any substitute?

Hello guys, I was working on a WordPress plugin, and I found that when the_content filter hook is used, it gives content of the post to the function as a parameter, but in plain-text format. I want to get the HTML content of the post, any way to achieve this? Thanks - Kapeel ...