php

How do I save a flex application snapshot to a file with PHP and then display it in the browser?

I'm trying to save a snapshot of a component in my flex app that is then sent to a php script to be saved and then spit back out into the browser window. I can't seem to get this to work. Here's my FlashBuilder code: private function saveImage():void { var parameters:String = "snapshot=" + takeSnapshot(this); var variables:UR...

dealing with double tabs in a tab delimited file in PHP

$lineArray = preg_split('/\t\s*(?=([^"]*"[^"]*")*[^"]*$)/', $line); Above code snippet it to split a tab delimited file where tabs are not inside double quotes. It works fine except the cases where there double tabs (missing fields). Basically PHP sees only one tab when there are two. Is there a tab-width option? ...

How Can i integrate a Google Login Method in PHP Application?

How can i integrate a google login Method to my PHP Application? how can i work with that?what i mean is how my program will understand this is a particular user? ...

Performance of Singleton Class Instance Method vs. Static Class Method in PHP?

Hi all, I'm interested in objective analysis of which is more performant; calling instance methods of a singleton class or methods of a static class. I've already seen this so I'm not looking for a discussion about the difference between the two or a discussion of which is "better." I'm only interested in relative performance between t...

How to get key values with foreach?

The Problem: Hi! I'm making a file upload form where I can upload photos, I added multiple="" to the input and for the name="upload_photo[]" so I'm able to upload multiple files. When I print $_FILES['upload_photo'] I get this and I want to get the values of each key with foreach. So for example I want to get just [name] what will be...

Facebook App, Ajax, and Internet Explorer

I have been playing around with facebook for the past few days and have written a simple app that asks the user a question about a random friend. I am using ajax to change the question and I though I had it working until I tried it in Internet Explorer. Please bare with my code since I am learning :-D This work perfect in Firefox and C...

Pass and restore a session id in zend framework

Hi, First, yes i know this is a big security NONO. But the scenario is this; In the checkout of a webshop i use a payment-gateway, which can proxy my checkout form through their SSL. (following url's is just the theory, other urls apply for the application) The way it works, website redirects user to their https://gateway.org/secure-...

data structure for transversal tree in PHP?

I don't have a background in CS or data structures. I want to make a PHP class that stores a modified preorder transversal tree, for manipulation and syncing with a database. Basically I need to store data like: +-------------+----------------------+-----+-----+ | category_id | name | lft | rgt | +-------------+-------...

Making Loop in xPath() : Call to a member function xpath() on a non-object

I want to making loop with xpath() with this function: function rs(){ $rs = array(); $cities = array("city1", "city2", "city3", "city4", "city5", "city6", "city7", "city8"); foreach ($cities as $value) { $rs[] = $xmls->xpath("area[city= '$value']"); } return $rs; } $rs = rs(); Edit: function meteor(){ $request_url = "htt...

Programatically scaling rackspacecloud servers up and down through API

I was speaking with Rackspace tech support today looking for a simple solution to scale my server up / down based on load and he said that it could be done through their API programatically. Has anyone actually done this before or have any advice on how to best approach this? I'd love to know if someone has some outline code or notes b...

PHP if statement?

Hi i wonder what i might be doing wrong. I have two conditions that returns true or false.For same reason it doesnt work. I would appreciate if someone point out what i might be doing wrong. <?php $pagetype = strpos($currentPage, 'retail'); if(isset($quoterequest) && $pagetype === True && $currentPage !== 'index.php'){ echo "t...

How can I get PHP simplexml to save < as itself instead of &lt;

Basically I have a script that updates an xml document in various places... However, I need the text to be in CDATA... So I attempted this: $PrintQuestion->content->multichoice->feedback->hint->Passage->Paragraph->addChild('TextFragment', '<![CDATA[' . $value[0] . ']]>'); Unfortunately when I save the XML back to file,...

Adding another parameter to a join query

Hello, I am using some MySQL tables. Their structures are listed below. "login": loginid username password email actcode disabled activated created points website location age gender Each user has a loginid "submission": submissionid loginid title slug url displayurl datesubmitted In the submission table above, the "loginid" is...

How to load iframe on top of content in a neat sticky window with jquery

Im integrating a simple chatbox application into my site, which is simply added by iframeing chat.php I dont have a static place to put this on the webpage, and I want to load the iframe on top of the site's content on the top right (with ajax), which would remain visible unless I X it out at the top. Auto-triggering the chatbox to lo...

the best way to know if a website used my script?

i want the best php way to know if some one used my script of his server ...

trying to put a php variable into the code for the "twitter for wordpress" plugin

Hi I am using the 'twitter for wordpress' plugin to display the last tweet in wordpress. it works fine but needs the username for the twitter account harcoded into the line of code: <?php twitter_messages('myaccount', 1, false, false, false, true, true, false); ?> What im trying to do is replace 'myaccount' with a variable ...

How to use preg in php to add html properties

I'm looking to write a script in php that scans an html document and adds new markup to a element based on what it finds. More specifically, I was it to scan the document and for every element it searches for the CSS markup "float: right/left" and if it locates it, it adds align="right/left" (based on what it finds). Example: <img alt...

Need to remove duplicates values from array during foreach

Hey All, Just wondering if you can help me out. I have a column with rows of tags. In each row i have each tag separated with a comma and space. for example: BMW M5, Leather Seats, 24 Inch Wheels, etc. What i need to do is loop through the array, explode it, and then print the values to the page. So far I have been able to do it; how...

Magento learning curve and best tips

Ok, magento is new to me, and in fact ecommerce site development itself is new. Magento seems to be extremely difficult to get to grips with - I have spent 3 days now going round I'm circles trying to create a custom theme and modules. The documentation is poor, the code and structure appears obfuscated - when will it get easier?! A...

factory pattern apropriate for problem?

Well, I have a problem (ok, no real problem, but I wanna try out something new) with creating objects. Actually I have some orders, which contains a list of orderitems. These orderitems are used and so spreaded in the whole application, and I need a way to create them. The main problem is, I want to be able to create these objects in m...