php

jquery ajax post to non-ssl page while current page is ssl

Ok, situation: an https / ssl page jquery a form submitted via ajax to a non-ssl pagge getting no usefull response the same scenario, non-ssl to non-ssl works perfect. I can view my console, but cant get any usefull info from it why the request fails... $.ajax({ type: "POST", url: form.attr("action"), data: form.serialize(), err...

POST to a form that POSTS to another form

From an external site, I need to present a form that POSTS data to secure.domain.com/index.php. Inside of index.php, I fill some hidden fields which in turn need to be posted to secure.domain.com/foo/index.php. I also set some session variables. The reason for this is a temporary redirect while I finish building a user portal which wil...

Using regex in PHP

I tried this: $mtcDatum = preg_match("/[0-9]{2}/[0-9]{2}/[0-9]{4}/", $lnURL); This returns an error message: Warning: preg_match() [function.preg-match]: Unknown modifier '[' Why doesn't this work? I'm used to Linux's way of doing regex, does PHP handle regex differently? ...

PHP SOAP Request includes multiple identical tags

OK, so I have this external SOAP based webservice, and PHP SoapClient. Everything is fine with basic requests, but I need to create a parameter set that looks like this: <DatasetList> <DatasetID>K0001</DatasetID> <DatasetID>K0002</DatasetID> </DatasetList> For a single nested DatasetID tag I'd do: $req = array( "DatasetList" => a...

UTF-8, PHP and XML Mysql

I am having great problems solving this one: I have a mysql database encoding latin1_swedish_ci and a table that stores names and addresses. I am trying to output a UTF-8 XML file, but I am having problems with the following string: Otivägen it is being outputted as Otivägen when i vim the file. Also when opened it IE i get "An inv...

What should I use .htaccess for in Zend Framework 1.9.5 application?

I've written several Web MVC apps but never before in PHP, and I'm trying to figure out the best way to work with Zend Framework v1.9.5. I'm confused about the role of .htaccess in a Zend Framework 1.9.5 application. I have consulted many tutorials, books, and SO questions on Zend Framework (but most of them are for v1.8 at newest) and ...

Returning an array from a PHP function to jQuery

I have a PHP function that returns an array. What is the best way to "receive" this using jQuery? ...

Doing a substring operation based on a regex in PHP

In Python, I can do substring operations based on a regex like this. rsDate = re.search(r"[0-9]{2}/[0-9]{2}/[0-9]{4}", testString) filteredDate = rsDate.group() filteredDate = re.sub(r"([0-9]{2})/([0-9]{2})/([0-9]{4})", r"\3\2\1", filteredDate) What's the PHP equivalent to this? ...

Facebook authentication script from ASP to PHP

Im trying to convert the code below to a php version, if anyone can help thanks. private bool IsValidFacebookSignature() { //keys must remain in alphabetical order string[] keyArray = { "expires", "session_key", "ss", "user" }; string signature = ""; foreach (string key in keyArray) signa...

How to include files with die(); function?

Hi. file1.php and file2.php with die(); function. include.php: <? include 'file1.php'; include 'file2.php' ?> file1.php <? echo 'included'; die(); ?> file2.php <? echo 'not included'; die(); ?> How can I included both files with die(); function? P.S My English poor, sorry for that. ...

Handling mail forwarding with php

I have a feature in my app that handles and parses incoming emails. The mails come in through the usual method with exim as a .forward file: | /path/to/php /path/to/mail/handler.php This sends RFC822 formatted text to my handler, which uses a parser to break it down and hand over to the rest of my app. New feature needs to be added ...

List of openid urls

I am creating an openid authentication code for my website. I need to show a list of URL's (google, yahoo, etc) that the users can select. I can't find all the open id URL's of these other websites. Is there a list somewhere? I know that google is https://www.google.com/accounts/o8/id. Is there a list showing major openid providers and ...

make variables available outside function in PHP ?

I have this function which declares variables: function imageSize($name, $nr, $category){ $path = 'ad_images/'.$category.'/'.$name.'.jpg'; $path_thumb = 'ad_images/'.$category.'/thumbs/'.$name.'.jpg'; list($width, $height) = getimagesize($path); list($thumb_width, $thumb_height) = getimagesize($path_thumb); ${'thumb...

PHP check if array elements are 'undefined' and if so, set them to zero (0) ?

I am creating an array like this: function imageSize($name, $nr, $category){ $path = 'ad_images/'.$category.'/'.$name.'.jpg'; $path_thumb = 'ad_images/'.$category.'/thumbs/'.$name.'.jpg'; list($width, $height) = getimagesize($path); list($thumb_width, $thumb_height) = getimagesize($path_thumb); $myarr = array(); ...

Getting content of a div (including child tags) with DOM

Hi, i am using DOM to get content of div tag but inner html part is not shown. Function is: $dom = new DOMDocument; libxml_use_internal_errors(true); $dom->loadHTMLFile("$url"); libxml_use_internal_errors(false); $xpath = new DOMXPath($dom); $divTag = $xpath->query('//div[@id="post"]'); foreach ($divTag as $val) { echo $val->getAttribut...

PHP session slowdown

I am having massive performance problems on a site running two versions of the same CMS using PHP sessions. A page will take 5-6 seconds to load on one computer, and 300ms on the other. I'm fairly sure the problem is located in session handling. I am already using different session_name()s and cookie paths for the different CMSs, to no ...

Base Location for PHP

I recently decided to incorporate PHP into my website, but I've never worked with it before so I'm not familiar with the functions... My problem is that I am using the include() method for my header and footer on each PHP page like this: <?php include('../php/header.php'); ?> This navigates from /public_html directory to the /php dir...

What's the best way to make small schema updates with Doctrine/Symfony?

What's the best way to make small schema updates to your symfony/doctrine application? My issue is, I'm working on a new side-project and occasionally find myself adding a new column here, a new column there as i find the need. However, my DB already has existing data and I dont want to run a complete rebuild and drop my DB with the ch...

xajax - bad response when calling a static method

When using XAJAX I have a call to a function that trims a string. this is a simple function and works just as expected. Now I want to make this function available to the whole system so I have added it to a helper class as a static method. ever since I moved this function to this class I get a bad response, something like this. Erro...

Can't get value of variable in HTML element ID, small syntax error probably!

<?php for ($i=1; $i<=(count($img_array))/4; $i++): ?> <input type="hidden" id="img{$i}_name" value="<?php echo ${'image_src'.$i};?>" /> <?php endfor;?> In the output, the 'id' is exactly as the code, ie: img{$i}_name, but I want the $i to be replaced offcourse, by its value... Syntax error probably, any ideas how to write it? PS:...