php

PHP serialize - Store an image

Would it be possible to write a script that gave the user the ability to upload a file (Image gif,jpg,png) and the serialize it and store as text? Essentially the user doesn't have any storage so wouldn't be able to upload a file and store as a file, but I've hijacked a profile field that can store user specific strings. Any help appre...

Pagination on blog content type in eZ Publish

Hi, Im not sure if I have missed anything but I am trying to achieve pagination on blog posts within my blog. Is there a setting somewhere to show a certain number of blog posts per page by default? Or am I going to need to add that functionallity myself? Thanks. ...

Problem with MYSQL database, values are not inserted

Hi, I am trying to insert values in database and values are not being inserted, here is the code i have: $user_name = "username"; $password = "password"; $database = "database"; $server = "localhost"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); ...

Transfer files using SFTP and either PHP or shell/terminal script

I need to write a script that is run as a cron job every night which transfers some report files via sftp to another server. The report files are created every night using another cron in the format 'support_[date].csv' & 'download_[date].csv'. I'm wondering if you had any pointers on how to do the following: Find the 2 files created...

how to hide files in the www directory

Is it possible to hide a folder from the www directory so that the php files will not be seen if you access it through a web browser? I'm doing this because I'm not yet good enough to secure those files and the mysql database that they are manipulating. Or even a trick that would make the web browser not to be able to access the localho...

print_r functionality in iPython

Is there a way to get PHP-like 'print_r(object)' funcionality in iPython? I know I can use '?' to get info about an object, but how do I view the values of the object? ...

Should I use php quote escapes for single quotes or use double quotes in arrays?

I realized that I can have problems with single quotes in php arrays: <?php $lang = array( 'tagline' => 'Let's start your project', "h1" => "About Me" ); ?> So I changed it to double quotes: <?php $lang = array( "tagline" => "Let's start your project", "h1" => "About Me" ); ?> Should I use "php quote escapes", inste...

Advanced Htaccess Rewrite Rule For PHP

I currently have the following code to rewrite search engine friendly url's to something PHP can handle however there are a few issues. Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*)/(.*) index.php?$1/$2 This Rewrites: domain.com/cat/mens/size/large/ To This: domain.com/index.php?cat/men...

What's wrong w this code: file_get_contents from remote zipped file and extract to local directory

The purpose of this code is to pull upgrade.zip from a central server, extract it and place it in a folder on the resident server. I get no errors, it just results in the die("!There was a problem. Please try again!"); require('../../../wp-blog-header.php'); function openZip($file_to_open) { global $target; $zip =...

How to make server side form validation compatible with screen reader

if screen reader fill any content wrong then how to give info (if javascript is disabled) to user to go that field any fill the correct value. with jvascript we can show javascript alert but if js is disabled then? I need solution for asp.net 20 and PHP both. ...

JS or any other language hook on loading resources in a HTML page

What I am trying to accomplish: HTTP GET the contents of a site (say google.com) Then have some sort of hook or filter that will catch all resources that this page tries to load (for instance the CSS files, all JavaScript files, all images, all iframes, etc) The first thing that comes in mind is to parse the downloaded page/code and ...

CMS Question for a shopping cart site

Greetings, i was ordered to build a portal where a user gets rewarded with points by buying to our company, and then those points can be redeemed by ordering some products according to those points. I need to know if there is any e-Commerce CMS that may work that way. the whole points assignation will be managed on another site, and tr...

Recursivly traverse simple tree in PHP

I have a simple tree which takes the shape below ROOT /\ A B / \ A1 B1 \ B11 This is stored in a DB table CLASSES that is self referencing. ID | CLASS_ID | PARENT_ID --------------------------- 1 | ROOT | 2 | A | ROOT 3 | A1 | A 4 | B | ROO...

Why doesnt my php script work

All I want to do (initially) is the following: <?php phpinfo(); ?> I have two different web servers running. If I try to open the above in firefox, Under any filename, with the :80 port from apache, it merely echoes the above. If I try to open the above, as any filename, from a python twisted web server on port :8888, I get a http 5...

Optimization tips and tricks

I need to optimize our web service, but don't know where to begin. We're running GWT, PHP and PostgreSQL. Without even having peaked at any performance data, I'm guessing that the major optimizations are going to happen in the database. I don't know anything about restructuring the DB, nor indexing. (Don't know anything 'bout DBs really...

Should I use Hypens, Underscore or camelCase in php arrays?

I just started using php arrays (and php in general) I have a code like the following: languages.php: <?php $lang = array( "tagline" => "I build websites...", "get-in-touch" => "Get in Touch!", "about-h2" => "About me" "about-hp" => "Hi! My name is..." ); ?> index.php: <div id="about"> <h2><?php echo $lang['about...

How do see subfolders when selecting files from a folder in Google Docs API?

Google provides the ability to search for folders with specific names. While this does search all folder trees for a folder with that name, I would like to search for a folder name that is already under a particular folder. Yet when I use the code that they show as an example on their site: function retrieveDocsInNamedFolder($gdClient, ...

Hiding PHP's X-Powered-By header

Hi I know in PHP, it sends the X-Powered-By header to have the PHP version. I also know by appending some checksums, you can get access to PHP's credits, and some random images (more info here). I also know in php.ini you can turn expose_php = off. But here is something I have done on a few sites, and that is use header('X-Powered-B...

How can i get the page.html#PARAMETERS trought php?

How can I get the value of the URL hash (eg "PARAMETERS" in url "page.html#PARAMETERS") on the server in php? ...

How to recover from a fatal error "Allowed memory size exhausted"

Hi everybody, Do you know any solution to recover from the PHP fatal error : "Allowed memory size ... exhausted" I have a shutdown function that is called when a fatal error appear. This function create an ErrorException from it, and logs it. The problem is : when there is no more memory available, it can't log the error (I log in Fir...