php

What are some well coded examples of standard data structures in PHP?

I'd like to see some well done PHP code samples of some standard data structures. Do you know of any code samples of Classes like Linear Linked Lists, Stacks, Queues, Binary Search Trees, etc? ...

[PayPal] exchange_rate IPN question

Hi... I'm confused about WHEN I'll get a exchange_rate non-null value from IPN... If I have option "block payments from other currencies etc" set to "No, but convert to USD" (in the payment receiving options of account) do I will ALWAYS get the mc_gross already converted to USD and null exchange_rate? Could someone explain-me it more ...

PHP - Where should I call ini_set?

Hello all, I am looking for a best practice for where I should place the statement ini_set. For example, ini_set('session.use_only_cookies', 1); Thank you ...

Why getting image via PHP does not work ?

I'm working with WampServer Version 2.0 on Windows XP and FireFox 3.6.8. I'm trying to get image content via PHP script like this: HTML: <img src='temp_get_file.php' alt='picture not found' /> PHP: (temp_get_file.php) <?php header('Content-Type: image/png'); $img = imagecreatefromjpeg("1.png"); imagejpeg($img); imagedestroy($img); ...

How to call AJAX request on dropdown change event ?

index.php <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <a href='one.php' class='ajax'>One</a> <a href='two.php' class='ajax'>Two</a> <div id="workspace">workspace</div> one.php $arr = array ( "workspace" => "One" ); echo json_encode( $arr ); two.php $arr = ...

PHP - How to display this Server Error in a decent way

Hello all, Here is my login PHP code. <?php // rnlogin.php include_once 'rnheader.php'; echo "<h3>Member Log in</h3>"; $error = $user = $pass = ""; if (isset($_POST['user'])) { $user = sanitizeString($_POST['user']); $pass = sanitizeString($_POST['pass']); if ($user == "" || $pass == "") { $error = "Not all fields were entered<...

Unit tests for HTML Output?

This may be a dumb question, but do you make unit tests for the HTML output of your PHP functions/scripts? I try to keep my HTML and my PHP separate - i.e. HTML includes with placeholders, and functions for certain recurring elements (tabular data / any sort of looped output) - but I'm not sure how to go about verifying this. Is there ...

Get Everything between two characters

I'm using PHP. I'm trying to get a Regex pattern to match everything between value=" and " i.e. Line 1 Line 2,...,to Line 4. value="Line 1 Line 2 Line 3 Line 4" I've tried /.*?/ but it doesn't seem to work. I'd appreciate some help. Thanks. P.S. I'd just like to add, in response to some comments, that all strings between the first ...

Looking for a Strategy to get multiple tables from a MySQL Query in PHP

I'm trying to build a set of results from a query in a PHP page. My where clause is complicated and potentially expensive. In my usual languages I'd do something like: CREATE TEMPORARY TABLE ShortList (ID INT); INSERT INTO ShortList SELECT ID FROM Table1 WHERE {Super long query}; SELECT * FROM Table1 JOIN ShortList ON ShortList.ID ...

GET DIR URL of current script

This is current script url : localhost/do/index.php -> I want a var or function that return localhost/do :) (something like $_SERVER['SERVER_NAME'].'/do'); ...

Would it be okay to learn Ruby On Rails?

I know HTML&Css, Little Javascript & Little PHP. I really want to get in the world of programming languages and I think Ruby looks way better then PHP. But I might be wrong. Should I stick learning PHP? Or should I go along with Ruby On Rails? ...

function __autoload & using require_once / ignore certain instances

Hi everyone, I am using the autoload function for a certain library... But I am trying to implement Doctrine and I am getting a 500 Internal Server Error. I believe its because I am creating = new instance and in the autoload... It checks a different directory. Is there a way to create new instances of classes that will ignore the au...

TinyMCE adds closing div

Greetings, I want to know if it is possible to stop tinyMCE from adding closing divs to the text. For example if I enter this text: <div id="content"> <div id="section-content"> <h3>Our Work</h3> It then becomes this: <div id="content"> <div id="section-content"> <h3>Our Work</h3> </div> </div> I do not want those 2 closing divs ...

Joomla error Restricted access

Hi all, I have a site in joomla. I am getting an error 'Restricted access' while i tried to access my site . It seems that the default template is not working and the access is going to the index.php file at outside. The admin panel is working fine and the required template is changed to default one . And the permission of the template ...

Included PHP scripts can't access $_POST when output buffering?

I have an HTML form POSTing to the following index.php: <?php require_once("/home/full/path/to/included/file.php"); ?> And in file.php, I am trying to access $_POST: ob_start(); session_start(); var_dump($_POST); $contents = ob_get_contents(); ob_end_clean(); echo $contents; But var_dump($_POST) returns an empty array. Moving the ...

keeping radio button value after post

HI i'm using a php page and i need to keep the value of and check box and radio button (checked or not checked) after post page. how could i make it? thanks ...

Redirection problem--from Facebook application to Facebook tab

I want to redirect from my Facebook app-canvas page to Facebook tab I'm using PHP when I redirect with header('location':$taburl) tag it remain at the same canvas page. Please give me answer of this problem as soon as possible ...

How to send mail through localhost ?

<?php $to = "[email protected]"; $subject = "HTML email"; $message = " <html> <head> <title>HTML email</title> </head> <body> <p>This email contains HTML Tags!</p> <table> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td>John</td> <td>Doe</td> </tr> </table> </body> </html> "; // Always set content-type when sending HTML ...

Compile AS3 into a SWF online using Flex SDK's mxmlc

Read my question thoroughly before responding, I know there’s a site called wonderfl.net I‘ve got the Flex SDK 4 on my Mac and I found a way to compile AS3 into SWF files using Flex's mxmlc compiler in Xcode, so I wondered, would it be possible to do this sort of simply online? Using for example a language I'm familiar with, PHP? I tho...

Which version of Apache Tomcat should I install in my linux server space?

I need to install Apache Tomcat on my linux server space in rackspace.com. I'm not sure which is the best version I need to use. I also need support for PHP, Java, JSP, servlets and ASP. Do I need to install these separately or does apache/linux support these by default? If I need to install them separately, which versions of PHP, Java, ...