php

Image getting cropped using imagepng. How should i avoid that?

Hello I am trying to functions: 1. imagecreatefrompng 2. imagepng my php code looks like this: <?php ini_set('memory_limit', -1); try{ //if(!$image=imagecreatefromjpeg('zee3.jpg')){ if(!$image=imagecreatefrompng('leo.png')){ throw new Exception('Error loading image'); } imagepng($image, 'leoAfter_9compression1.png...

Process SOAP Headers in PHP

Hi, I am building (in PHP) a SOAP server that is configured by its WSDL to accept messages that look like this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://my.awesome.namespace/"&gt; <SOAP-ENV:Header> <ns1:Header> <ns1:APIKey>E4C5BDE0-48DC-543C-1CA3-8E55C63F8E...

Center float except last row

I need to center some floated divs inside a container. The code I'm using works but I need the last row of floated elements to be aligned to the left and not centered. It's a photo album and all the thumbnails are automatically generated by a gallery script. This is what the code produces This is what I need I don't think this is pos...

search canadian province

Hi, I have an input search on the site and I want to search in the database (MySQL) after province name. In database I have just the provinces initials - ex: QC for Quebec, AB - Alberta, etc. The people can introduce into the input search field: QC or PC or Province du Québec or Province Quebec or Quebec or Québec (capital letters or ...

separate php file as template - security hazard?

I was looking at templating systems for php, and I've come to believe that pure php code seems to be the solution I want to use. I'm the lone developer, so there's no designers who need a nerfed arena to work in. Template engines like smarty seem to suffer from the "Inner-platform effect". If I stick with good practices ( pre-computed ...

Are there helpful PHP naming conventions?

I come from Java / Objective-C to PHP and find it horrible. I mean, PHP is nice, really. But when you look at a bunch of variables, you don't know: Is that an number? Is that an string? Or ist that even a fancy object that can perform actions when calling methods on it? So I wonder if there are helpful re-usable naming conventions for v...

Sorting a array's numeric values without re-indexing (PHP)

What I'm doing is this: I get a list of ID values (numeric) from the DB and store it into an array (1, 2, 2, ...) I then count the duplicates with array_count_values. this outputs ([1]=>1, [2]=>2, ...) I then want to reorder the array in a descending order via the count I then just use array_keys($array) to get the IDs in a count order...

delete array element with foreach loop?

i want to loop an array with foreach to check if a value exist. and if it does, i want to delete that element. i have following code: foreach($display_related_tags as $tag_name) { if($tag_name == $found_tag['name']); // DELETE CODE } but i dont know how to delete the element once the value is found. ho...

How can I get the full string of PHP’s getTraceAsString()?

I'm using getTraceAsString() to get a stack trace but the string is being truncated for some reason. Example, an exception is thrown and I log the string using: catch (SoapFault $e) { error_log( $e->getTraceAsString() ) } The string thats prints out is: #0 C:\Somedirectory\Somedirectory\Somedirectory\Somedir\SomeScript.php(10): S...

How to do a "backwards" regular expression search and extract

I have a bunch of URLs to parse in PHP, like this: www.example.com/shopping shopping.example.com example.com/pages/shopping for about 100 different pages (not just shopping - some are contact, some are directions, etc.). I have a seed set of data, which tells me where to look for the page names, like this: www.example.com/[pagenam...

collecting multiple GET or POST values

Hi I have a form that passes something like in a URL ?choice=selection+A&choice=selection+C I'm collecting it in a form with something like (I remember that $_GET is any array) $temp = $_GET["choice"]; print_r($temp); I'm only getting the last instance "selection C". What am I missing ...

Getting dead.letter... Saved message in /home/content... after sending message in a form

I am using a wordpress plugin that sets up a basic contact form on a website. After filling in the fields and submitting, I get the dead letter message. I have read what a dead letter is, but I don't understand why I am getting the message. The email is actually sent to the recipient, but he does not like this error showing up and scarin...

mysqli_fetch_assoc empty the data?

i get some data from mysql. $result = $forum_model->get_info($_SESSION['group_id']); // step 1 while($user = mysqli_fetch_assoc($result)) { some code } but when i later some lines beneath want to use the same data pulled out from mysql it doesnt work. // step 2 while($user = mysqli_fetch_assoc($result)) { some code } is...

PHP Server Setting Stripping HTML Posts

A client's web host recently changed servers on them and it's broken some of the administrative tools. I'm providing a YUI WYSIWYG editor for them to create content on the site. The HTML content is now being "cleaned" by something before I get to it. For example, a link tag like <a href="http://www.stackoverflow.com"&gt; gets turned i...

php fsockopen connection

Hey I'm using php and fsockopen to connect to port 80 on another server to read content from a website. I'd like to use the same function to access port 25 to read the mail servers header. Port 25 us being used by my mail server on my server. Is it possible to connect to port 25 on the other server from port say 99 on my server (Or an...

cannt set my xampp to work with any php debugger

hi, i have been trying to set my XAMPP to work with xdebug php debugger, i have edited the php.ini file with the following parameters: zend_extension_ts="C:\Program Files\Development\xampp\php\ext/php_xdebug-2.0.5-5.2.dll" xdebug.remote_enable=On xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler=dbgp after ...

CakePHP: Prevent GET form fields in URL

I've got a CakePHP search form that has 'type'=>'get'. Basically, one of the elements in the form is a submit button of type image. When the form is posted, in the URL I always get these x & y coordinates of the image submit button: http://site.com/controller/action?x=22&amp;y=36&amp;query=hello Is there any way I can prevent the coor...

Magento: Getting Product Url's for Products within a Grouped Product

For a grouped product, I would like to display a link to the simple products it is composed of. For example, if I have a grouped product called Dining Set composed of plates, knives, forks, etc. I'd like each of the subproducts to have a link to that subproduct (click plates goes to the Simple Product for plates) <?php foreach ($_associ...

array_key_exists, array_search, in_array doesnt apply to multidimensional array?

ive got an array like this: $display_related_tags[0][20] = 'text1'; $display_related_tags[1][21] = 'text2'; $display_related_tags[2][22] = 'text3'; i want to either check if value (text1) exists or if key (20) exists but the mentioned array functions just apply to one dimensional arrays. what are my alternatives without having to use...

PHP Strict standards: Creating default object from empty value - How to Fix?

All, I have the following PHP5 code. $request = NULL; $request->{"header"}->{"sessionid"} = $_SESSION['testSession']; $request->{"header"}->{"type"} = "request"; It appears that line 2 and 3 are producing the following error: PHP Strict standards: Creating default object from empty value How can I fix this e...