php

Give no one access in a directory .htaccess

Hi It is probably very simple but I can't find it. I want to make a .htaccess file so no one can get into the folder. except for the php on the server. does anyone know the code line? Thanks Matthy ...

Is this possible with php

I have two indexed arrays $measurements[] and $diffs[] , $measurements[] is filled with values from a database and the $diffs[] gets values from a function which calculates the difference from two measurements. When I have a collection of different measurements in $measurements[] I want to add a value to just one array element in the $...

Strange characters in mysql dbase

When I type strange characters like é or ë and store it in a mysql dbase; the character will be converted to: é It probably will have to do something with my character set. But i don't now where to start. On top of the page i inserted: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> The collocation of the fiel...

What is the shortest way of inserting a variable into text with PHP?

I'm wondering if there is a shorter way of inserting text in PHP than <?php $city = "London"; ?> This website is a funky guide to <?php print $city; ?>!!! For example, using ruby on rails, I could set city = 'London' somewhere in the code, and in my .erb file I could do This website is a funky guide to <%= city %>!!! I did rea...

How do I access a string-indexed element of a PHP array?

I have the following array (in php after executing print_r on the array object): Array ( [#weight] => 0 [#value] => Some value. ) Assuming the array object is $arr, how do I print out "value". The following does NOT work: print $arr->value; print $val ['value'] ; print $val [value] ; So... how do you do it? Any insight i...

Few Google Checkout Questions

I am planning to integrate a Google Checkout payment system on a social networking website. The idea is that members can buy "tokens" for real money (which are sort of the website currency) and then they can buy access to some extra content on the website etc. What I want to do is create a Google Checkout button that takes a member to t...

mod_rewrite for clean urls gives 500 internal server error

I'm having some troubles with mod_rewrite. On my index page (index.php) I show a blog and a single blog post page looks like this: http://www.mydomain.com/blog/post-title mod_rewrite for this is: RewriteRule ^blog/([A-Za-z0-9-]+)$ index.php?postslug=$1 [L] This works like a charm. But I also have another page called artists.php and...

Do I need htmlentities() or htmlspecialchars() in prepared statements?

In an article http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html, it says the followings: There are numerous advantages to using prepared statements in your applications, both for security and performance reasons. Prepared statements can help increase security by separating SQL logic from the data being su...

E-commerce package for PHP / Customer management and "order tracking"

Hi, We're developing a PHP based website through which people can subscribe to certain services. I'm looking for a solution (open-source or reasonably priced) that helps track customer's orders - what have they ordered --> have they paid or not --> has that been approved by the site administrator, etc. The end-user can have multiple sub...

PHP Framework for existing database

We are developing a mobile version of our current site, and will prefer to read from the same DB as the main site. Given that this will be a mobile site, it will have only minimal (search + display) functionality. From what I gather, most framework make it very difficult to use an existing DB. Given the above, which PHP framework would...

Pass PHP Array via jQuery Ajax

Hello all, I've got a php array: $toField = explode(",", $ids); //Which looks something like '24,25,26,29' I want to pass this array via jQuery AJAX, with this: <form id="myForm"> <input type="hidden" value="'.$toField.'"> <input type="submit" id="sendMessage" class="faceboxSubmit" name="ok" value="Send Reply"/> </form> And ...

Magento Custom Forms

I'm trying to build my own Request Catalog Form in Magento, heavily based on the Contacts module that comes out of the box. I've set up my XML files: ./app/etc/modules/RequestCatalog_RequestCatalog.xml ./design/frontend/default/{theme}/layout/requestcatalog.xml ./code/local/{namespace}/{module}/etc/config.xml In my config.xml, I set...

In where shall I use isset() and !empty()

I read somewhere that isset() function is that an empty string tests as TRUE, os isset() is not an effective way to validate text inputs and text boxes from a HTML form. So you can use empty() to check that a user typed something.... Q1. Is it true that isset() function treat an empty string as TRUE? Q2. Then in which situation I shou...

java and python equivalent of php's foreach($array as $key => $value)

EDIT: Amazingly, newacct's answer has accumulated 12 points in the four hours since I posted my question. This, despite its being incorrect. As alternatives to php's associative array, newacct offers Java's HashMap and Python's dictionary, neither of which preserves key order. cmcg provided a correct answer for the Java version. That is...

Shell: SVN status pipe to php to check syntax

I know this is simple but I just cant figure it out. I have a bunch of files output by "svn st" that I want php to do a syntax check on the command line. This outputs the list of files: svn st | awk '{print $2}' And this checks a php script: php -l somefile.php But this, or variants of, doesn't work: svn st | php -l '{print $2}' Any...

How can I read/write from/to a file, byte by byte, with PHP5?

I've worked with reading and writing text files with PHP. Now, I'd like to read and write binary files. I've not found any useful resources/tutorials for doing this with PHP5. Is it possible? How? Specifically, I'll be searching for specific 2-byte patterns. If it matters, I'm on a Mac (OS X 10.4 Tiger). ...

php email attachment

hi i am using this script for the email attachment but when i execute the form on my server it shows to warning 1-Warning: fread(): supplied argument is not a valid stream resource 2-Warning: fclose(): supplied argument is not a valid stream resource pls help ...

php email piping

Im trying to setup a program that will accept an incoming email and then break down the "sender" and "message" into php variables that i can then manipulate as needed, but im unsure where to start. I already have the email address piped to the php file in question (via cpanel) ...

Mysqli Prepare Statement - Returning False, but Why?

I have a function that generates a prepared INSERT statement based on an associative array of column names and values to be inserted into that column and a table name (a simple string): function insert ($param, $table) { $sqlString = "INSERT INTO $table (".implode(', ',array_keys($param)).') VALUES ('.str_repeat('?, ', (count($p...

What am I missing to get a PHP ScriptEngine in Java

I try to get a PHP ScriptEngine from the ScriptEngineManager, but getEngineByName("php") returns null. The following unit test works, if I replace "php" with "javascript", but it fails for "php". import static org.junit.Assert.*; import org.junit.Test; import javax.script.*; public class ScriptEngineTest { @Test public void exe...