php

On what Standard version the Magento Enterprise version 1.8.0 is based?

I need a suggestion on what Standard Magento version the Enterprise version 1.8.0 could be based? Possible answers are: 1.4.0 1.4.0.1 1.4.1.0 1.4.1.1 We have one customer with a error related probably to one of the versions which can be found on forum. But to proof that it's related to certain error I need to know to what version 1.8...

Describe how a php page template can write another php page as html

Describe the mechanics in PHP relevant terms of a PHP/MYSQL page (A.php) that will 1) use one template to write itself (simple), 2) take input from the user to update a database (simple), 3) upon command parse another PHP page (B.php) (???) and save (B.php) page as a static HTML (B.html) (???). UPDATE= I found a post, here at SO, helpfu...

Securing credit card checkout - $_SERVER['HTTP_REFERER'] verification

If $_SERVER['HTTP_REFERER'] cannot be trusted according to PHP documentation, how do you be sure that the POST is coming from our own server? Is sessions the only way? ...

PHP: Minutes ago, seconds ago: is this correct coded?

if($timestamp > time() - 60){ // Count seconds ago $deff = time() - $timestamp; $seconds = $deff / 60; echo intval($seconds)." seconds ago"; }elseif($timestamp > time() - 3600){ // Count minutes ago $deff = time() - $timestamp; $minuts = $deff / 60; echo intval($minuts)." minutes ago"; } I think the minutes ago is right, but not the se...

Building a long query and have a lot of if statements - is there a more elegant way?

I have to build a query based on certain conditions. Is there a better way of doing it than the way I have done below? It works fine but I can see it getting out of hand fairly quickly if there were more conditions since I check if any previous conditions had been met every time I check a new one. $sql = "SELECT DISTINCT fkRespond...

In MySQL, need to join two tables with one table having multiple references to the second

I have two tables, one is signups and contained in it are two fields, firstchoice, and secondchoice. Another is a schedule table, and it has things like a begin and end date, and a semesterid. firstchoice and secondchoice from the signups table both reference the semesterid from the schedule table. I am trying to create a page which d...

Is micro-optimization worth the time?

Hi, I am a PHP developer and I have always thought that micro-optimizations are not worth the time. If you really need that extra performance, you would either write your software so that it's architecturally faster, or you write a C++ extension to handle slow tasks (or better yet, compile the code using HipHop). However, today a work m...

File permissions

HI all I have a question regarding file permissions. I have created a log file lets say "logfile.log" which traps certain errors, now in order for it to be writable i set its permissions to 777. But when i do this, it then is accessible to anyone to read via their browser. how would i go about solving this issue? thanks ...

ASCII-characters instead of Swedish chars?

Hi everyone, I have tested PHP's IMAP lib. to fetch emails from a GMAIL account, but I've just can't get my head around trying to make the characters to display correctly. At first, I was close to pull my hair off when I realized that I accidentally fetched the attachments instead of the message body - not good, but now when that is so...

Wordpress: Removing the last comma for tag list

I've created a custom foreach output that helps give me a tag id per post. I'm using commas to separate each tag. However, the last tag outputs a comma too, like this: kittens, dogs, parrots, (<-- last comma) How should I go about revising the foreach output so that the last comma is removed so it displays like this: kittens, dogs, pa...

Why isn't this form updating the database?

I'm learning php through head first's php and mysql and I'm toying with the simplest of php scripts: data from a form is inserted into a mysql database. I have modified the example from chapter two to use it on my own form and db, but I haven't been able to make the db accept anything I write into the form. Where's the error? Here's ...

Tracking Referer with JS and PHP : Problems with IE

Hello All, I want to build a tracker application where the end user gets a JS code which he puts on his website. I want to track data related to that website like http referer. What I am currently doing is to feed the client jQuery and a code snippet. The JS checks document.referer and sends that back to my php script via jQuery ajax G...

Will wordpress login functionality do anything?

I'm building a website and I've decided to use wordpress for the totally public parts (e.g. the blog, about us, etc.), but I still want to have a separate area for registered users of the website that would contain user specific info and options (like chat). My PHP knowledge is limited, but I can learn how to code login scripts etc. if ...

Inserting an image with PHP and FPDF

I'm trying to insert an image but do not want to specify the x and y coordinates. Is that possible? $pdf->Image($image1, 5, 70, 33.78); I want to be able to specify the size (33.78) but not the x and y so that it moves based on the content. $pdf->Write( 70, $reportTitle ); $pdf->Ln( 45 ); $pdf->SetFont( 'Arial', '', 12 ); $pdf->Write...

Differentiate associated array from regular array

Without having to change the function signature, I'd like a PHP function to behave differently if given an associated array instead of a regular array. Note: You can assume arrays are homogenous. E.g., array(1,2,"foo" => "bar") is not accepted and can be ignored. function my_func(Array $foo){ if (…) { echo "Found associated array...

SOAP doesn't work

I trying to work with SOAP, but it doesn't work. I tried localhost and another server. For example: soap.xml: POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="ht...

Youtube get thumbnail and save at my server

Hello friends, I would like to create a youtube video gallery, and I would like to crop the thumbnail and save it to my server, I tryed with cURL but had no success, it works but it seens that youtube is blocking. Is there any option to save the youtube thumbnail? http://i3.ytimg.com/vi/BdoQjb6K6XA/0.jpg I would like to save the above...

Jquery autocomplete

I have mysql table like this: country | city_accented | latitude | longitude | --------------------------------------------------------- australia | sydney | -33.8833333 | 151.2166667 | USA | dallas | 35.3163889 | -81.1763889 | I'm using jquery autocomplete to get country names in form text field....

Where can i find a good video or tutorial on JSON with PHP ?

I have search the net many times and a lot of the JSON tutorials are too hard to understand. I am looking for JSON with jQuery and PHP. if anyone knows any videos or website i can look at that would be great Thanks ...

Little __construct() question?

Hi, I have recently started php and was wondering the differences between __construct() and having a method with the same name as the class? Is there a reason for using it? All I can work out is it overrides the method named Foo or is it down to which you prefer? E.g. class Foo { function Foo() { echo 'Foo stated<br>...