php

PHP: Need to merge/sort a multidimensional array based on one key in the dimension

I hope I will be able to explain what I'm trying to do - and really hope someone will be able to help! Here is the array I am working with ( [0] => Array ( [city] => Middletown [state] => OH [freq] => 146.610 [pl] => 77.0 [call] => W8BLV [distance] => ...

Replacing html tag with preg_replace

I'm trying to match tags using preg_replace. The regex used is: <video[^>]*>(.*?)</video> But I'm getting a server warning: Message: preg_replace() [function.preg-replace]: Unknown modifier ']' Any clues on why? Also, How could I modify the regex so it can match [video] tags instead? Thanks! ...

AJAX & PHP: load foreign domain via proxy and use session cookie?

hey guys, i wonder if i'm doing anything wrong or I am just getting this wrong? I'm loading a part of a of subdomain with jquery load(). just before i'm firing the load method i'm saving a password to a $_SESSION with php. The part of the subdomain i'm loading with jquery load() needs this password information. Does this count as the ...

How to set class for a html tag when loading the page?

Hi, The problem: I want to use PHP include to import file "header_menu.html" into all pages that share the same navigation menus, but each page has its own current highlighted menu item. For example, the following are the menus, in index.php, only the first should be set to "current" class, and in download.php, only the second should ...

php client content uploads (cms)

HI I'm building a php based website and wanted to know if there any way to allow my client to upload their content from a word document (or any word file)? The upload should replace (or add) content to a page, allowing her to update her content. I know this is some sort of cms, but I don't know where to begin. I currently have an artic...

adding a combo box at run time - JQUERY

i have added html elements at run time using append Code: function addFormField() { $("#inputss").append("<strong>asif</strong>"); } but how can i add a select element at run time that looks like this.. PHP Code: <select name="pre_req" id="pre_req" class="inputs" value=<? if($this->uri->segment(2)=='update') echo $resu...

PHP & MySQL - How to count the number of records

Okay so I have this web site search script and I'm trying to count how many records will be displayed when the user enters there search term or terms. I was wondering how would I be able to do this when i don't know what keywords will be entered? Below is my search query. Here is the part of my PHP & MySQL search code. $search_explode...

PHP Regex Problem (username, birthdate, email address)

The below regex's don't seem to be working. Is it because of !preg_match? Username if (!preg_match("/^[A-Za-z](?=[A-Za-z0-9_.]{3,31}$)[a-zA-Z0-9_]*\.?[a-zA-Z0-9_]*$/",$_POST['username'])) { $hasErr = true; $return['username'] = 'Please enter a valid username. Use 4 to 32 characters ' . 'and start with a l...

change event for combobox not getting fired in jquery.

Hi, i am working in php. I have written code for displaying combo box like this : <select name="country" id="idCountry" class="clsCountry" > <?php foreach($objCountries as $objCountry):?> <option value="<?php echo $objCountry->getId()?>" ><?php echo $objCountry->getName()?> </option> <?php endforeach;?> </select></td> For chang...

first data global integration

hi, i am first time using linkpoint global payment, i have created the test merchant account and i got the store number ,.pem certificate and i changed the settings in PHP_FORM_MIN.php,also the key file path is given as $myorder["keyfile"] = realpath("./1234567890.pem"); but while running this gives error : FAILURECould not connect a...

How to point at the right key to get some value from array?

I have array data as shown below, I want to store 'sale' value into database if my currency are USD. Array ( [currency] => USD [sale] => 9120.00 [buy] => 8970.00 ) Array ( [currency] => SGD [sale] => 6653.75 [buy] => 6520.75 ) Array ( [currency] => HKD [sale] => 1173.40 [buy] => 1152.10 ) Array ( [currency] => CHF [sal...

AJAX and proxy: loading foreign website with another query?

so that's a weird thing i'm working on. some of you already helped me with this script: proxy.php <?php if( isset( $_GET['url'] ) ) { # Get the Referred URL $raw = file_get_contents( $_GET['url'] ); # RegExp to Strip All Script tags and/or links with Javascript in them. $safe = preg_replace( '/<script[^>]*>.*<\/script>|[\"\']jav...

Convert a Python snippet to PHP?

Can anyone translate my small Python snippet to PHP? I'm not a familiar with both languages. :( matches = re.compile("\"cap\":\"(.*?)\"") totalrewards = re.findall(matches, contents) print totalrewards Thank you for those who'd help! :( ...

How to call a PHP script from a PHP script on another server

Hello, I have access to two distinct servers. I would like one's PHP script to call a URL on the other's server (and pass a secret variable). However, I want to make sure nobody else can spoof this call. What is the best way to do this, short of SSL? I was thinking about hashing but anyone can read the POST request's hash and spoof it....

Web console supporting the SSH Command

Hello, I am trying to implement a web console using the PHPterm . By the PHPterm most of the commands can run in the console.But can't login to a server by using the SSH command.It will display an error that host key verification failed.Is there any other web console supporting the SSH command using PHP and ajax.I am in an urgent need...

Imagecopyresampled Auto-Crop Image

I'm using imagecopyresampled to create thumbnails based on a certain width and height. The problem I'm having is that their height is being squished. What I want is for all thumbnail images to be 140x84 and if their aspect ratio does not match that the top and bottom extra portions of the image are cropped to center. Here is what I ha...

MySQL LIMIT question

I'm using pagination for my search results but for some reason my pagination is not working correctly with my search script. I can't seem to find the correct place to put the LIMIT $start, $display in my search query code where ever I put it in my code it displays the pagination all wrong. Can some one please help me? Here is the part o...

Asynchronous external aplication execution in PHP

Hello. I was wondering if is is possible to send output from application ran by php to client. For example i have application that outputs: Hello world And after 10 seconds it outputs 10 seconds passed I'd like to know if it is possible to send "Hello word" and "10 seconds passed" to client without waiting until whole program fini...

how to send an object to C# WCF service from PHP using SOAP.

Hey all! I'm having trouble sending a custom object thats defined as a datacontract in my WCF web service from PHP. I'm attempting to accomplish this via SOAP. Here is what the dataContract looks like: [DataContract] public class simplyCustomer { [DataMember] public int id; [DataMember] public s...

how do I programically create a page in WordPress if it doesn’t exist already?

how do I programically create a page in WordPress if it doesn’t exist already? ...