php

Change position of currency selector in Magento

Currently, the currency selector is at the top, here’s my development site: http://nordschleife.metaforix.net/118/118/index.php/kyocera.html However, I would like to switch the currency selector to just under “Price” heading of the table. I tried getCurrency() ?> but there’s nothing. I guess I need some method like getCurrencyHtml()...

How mature is PHP:SVN

I was thinking about using PHP:SVN for managing svn repositories on a production website. Currently svn commands are built up and executed on the command line which feels like a major security vulnerability. PHP:SVN would have the advantage of not executing any commands directly and allowing me to scrap a lot of code. My question is h...

Webmail Contact List Importer

Does anyone know of a Webmail Contact List Importer scripts (ColdFusion, PHP etc) like those used on Twitter and LinkedIn ? I've found some but they are paid for and I want some more bespoke & open. To clarify a little more I'm not looking for a way to process .csv files :) I'm looking for a bit of code that can logging into gmail, yaho...

php/MySQL insert row then get 'id'

the 'id' field of my table auto increases when I insert a row, I want to insert a row and then get that ID. I would do it just as I said it but I'm wondering if there's a way I can do it without worrying about the time between inserting the row and getting the id. I know I can query the database for the row that matches the information...

Reading rewrited (mod_rewrite) files from php

Assuming you have only the URL to a file (hosted on the same server as the app) that has been rewritten via mod_rewrite rules. How would you read the contents of that file with PHP without having direct access to a .htaccess file or the rewrite rules used to building the original URL? I'm trying to extract all the script tags that have...

problem maintiaing form state with mysql and php

I have a page which should show a form with checkboxes, post back if it is checked or not, store the result in the database, and then on next loading of the page show the checkbox as checked, and update it as unchecked as necessary. I understand my solution having the floating "checked" is not ideal, but it works fine, and I want to sti...

php security

I've got this code on my page: header("Location: $page"); $page is passed to the script as a GET variable, do I need any security? (if so what) I was going to just use addslashes() but that would stuff up the URL... ...

PHP hand-made serialization trouble.

In my task would be very nice to write a kind of objects serialization (for XML output). I've already done it, but have no idea, how to avoid recursive links. The trouble is that some objects must have public(!) properties with links to their parents (it's really nessecary). And when I try to serialize a parent object which agregates so...

How do I make data uploaded by PHP safe during transmission?

I'm allowing authenticated users to upload image files with my PHP application. Assume I've built in the necessary security to make sure the file itself is valid, is there a possibility of the http transmitted file to be intercepted in some way? If so, how can I protect the transmission of the file? Would HTTPS be the way to go? Also, ...

How does php execute a function assigned to variable?

Ok, I didn't really know how to even phrase the question, but let me explain. Suppose I have a variable: $file = dirname(__FILE__); What happens if I assign $file to another variable? $anotherVariable = $file; Does the dirname function get executed each time I assign? Thanks for any help. ...

How to get mod-rewrites and php 301 redirects?

I was hoping someone could also guide me on setting a redirect on a php site pcs4cheap.ca ....I tried to do mod re-writes through the .htaccess, works fine but prevents any othe login or admin page to open ! Any other way I could achieve this would be much appreciated =) ...

php 1 is a string not integer

I'm using a GET variable and people get to it by the following URL: page?siteID=1 and I check to make sure that siteID is an integer, but PHP is saying it is a string. How can I convert it to a integer? I noticed that intval() would convert 0x1A to 26, which I don't want to happen. ...

How to send URL (with vars in it) as a single var?

I have a url string like this: http://www.google.com/cse?cx=017840637368510444960:ny1lmky7r-0&client=google-csbe&output=xml_no_dtd&q=simon+g I need to send this url from ajax to a php script as a single string variable. I am having trouble though because it keeps getting split into several vars because of the vars in the ...

unicode in php

I have previously read Spolsky's article on character-encoding, as well as this from dive into python 3. I know php is getting Unicode at some point, but I am having trouble understanding why this is such a big deal. If php-CLI is being used, ok it makes sense. However, in the web server world, isnt it up to the browser to take this i...

PHP Regex Question

I have a series of urls in a web doc, something like this: <a href="somepage.php?x=some_document.htm">click here</a> What I want to do is replace the bold piece: <a href="somepage.php?x=some_document.htm">click here</a> .. with some sort of encrypted variation (lets just say base64_encoding) .. something like this: for each match, ...

Validating User Data based on Controller Names

I'm building a CakePHP site for a client and I've got a bit of an interesting problem. They want to add a new feature whereby users can create their own landing pages within the site using this type of URL: http://mainsite.com/username. Since this is a Cake site, there are plenty of values for username that would result in all sorts of...

PDO - SQL Server RESTORE DATABASE query - wait until finished?

I am using PDO to restore a SQL Server 2008 database, and issuing a query to restore the database like this: $pdo->exec('RESTORE DATABASE [blah] FROM DISK = \'c:\blah.bak\' WITH NOUNLOAD'); But the exec() returns before the database is fully restored, is there any way I can make it wait? If not, is there a query I can run in a loop wi...

mysql data into Dojo datagrid table

Greetings all. I have a php script calling MYSQL and displaying data in a table. It is rather ugly and I would rather have it displayed in a Dojo style table/datagrid. Can anyone point me in the right direction? thanks! ...

php cpanel

I have a php account with my provider, and I also have cpanel installed for me. I currently have two drupal sites there, let's called the main myMainSite and another one under construction called myNewSite. So when I go to www.myMainSite.com, I go to the main site. When I go to myNewSite.myMainSite.com, i go to the drupal site that is ...

On form submit background function php running

Hi: I am looking for a way to start a function on form submit that would not leave the browser window waiting for the result. Example: User fills in the form and press submit, the data from the form via javascript goes to the database and a function in php that will take several seconds will start but I dont want the user to be left wa...