php

PHP Notice: Undefined index when looping array...

Hi, I'm looping a two-dimensional array like this: if (!empty($aka)) { foreach ($aka as $ak) { if($ak["lang"]=="es") { $sptitle=$ak["title"]; } } } Pretty simple. If the array ($aka) is not empty I loop trough it and when it finds that the "lang" index is equal to "es" I just save the "title" value for that index in $sptitle....

Reading a Git repository, without Git

Hello! I'm researching the idea of building a super-small (preferably PHP) web app, which will serve (among other things) as a minimal front-end to a git repository. Any library/article for reading a git repository (".git" folder) without having to execute the "git" process? I'm looking for an API to manage a git repository. I'm only i...

Regex to parse define() contents, possible?

Hi, I am very new to regex, and this is way too advanced for me. So I am asking the experts over here. Problem I would like to retrieve the constants / values from a php define() DEFINE('TEXT', 'VALUE'); Basically I would like a regex to be able to return the name of constant, and the value of constant from the above line. Just TEXT...

AJAX and the MVC pattern

Hi all. Please redirect me if a similar question exists.. I haven't been able to find anything, though I'm sure that my problem is fairly common... I have a page that has 5-6 divs that can be individually loaded through Ajax requests. Through a prototype ajax.request(), the server (php) echoes back the HTML code for the division before ...

Create an encrypted zip archive with PHP

I am searching for a way to encrypt a .txt file into a zip, but in a secure password protected way. My goal is to email this file to me, without anyone being able to read the content of the attachment. Does anybody know an easy, and above all, secure way to accomplish this ? I can create zip archives, but I do not know how to encrypt th...

Need a php script diagnosis for a small snippet of code

Hi, Can somebody tell me what I am doing wrong really? I am going nuts, the following code works perfect on localhost/WIN and when I try it on the webhost/linux it gives warnings: $lines = file('english.php'); foreach($lines as $line) { $matches=array(); if (preg_match('/DEFINE\(\'(.*?)\',\s*\'(.*)\'\);/i', $line, $matches)) { ...

SourceGuardian Error

Error printed to screen: Fatal error: SourceGuardian Loader - script checksum error [12] Encoded script was modified in /home/user/public_html/domain_com/includes_encoded/params.php on line 2 Facts: Using a Hostgator host which have SourceGuardian loaders already in place, phpinfo also confirms they are loaded. Using demo version...

Janrain php library and google endpoint for OpenId

Im using janRain Php library for OpenId and yadis discovery and no matter what i do, i will work in stuff like user.openid.org or my own provider, but if i try to use the google endpoint, i cant get any discovery information. Even if i run the discovery example for the janrain library, i get the next result Claimed Identifier http://...

Can PHP read text from a PowerPoint file?

I want to have PHP read an (uploaded) powerpoint presentation, and minimally extract the text from each slide (grabbing more info like images and layouts would even be better, but I would settle for just the text at this point). I know that google apps does it in its presentation app, so I am guessing there is some way to translate the ...

MySQL query in PHP gives obvious wrong result.

Hi there, I'm using PHP and PHPMyAdmin to create a small profile site. I'm giving members an ID number, based on which is the biggest number currently in the database, +1 I did 25 tests before I got the PHP script where I wanted it to be. I then deleted those 25 entries using PHPMyAdmin. But now, when my PHP code does this: function...

Include HTMLpurifier with Zend_Loader

Hey guys, I want to use the HTMLpurifier in combination with the Zend Framework. I would love to load the Class and its files with the Zend_Loader. How would you include it? Would you just use the HTMLPurifier.auto.php or do you know a better way of doing it? ...

Is it wise to use PHP for a daemon?

Hello all, I wish to create a background process and I have been told these are usually written in C or something of that sort. I have recently found out PHP can be used to create a daemon and I was hoping to get some advice if I should make use of PHP in this way. Here are my requirements for a daemon. Continuously check if a row ha...

I need some guidance on payment gateways

I've never done anything with payment gateways, can anybody give me suggestions? ...

Showing a Splash Screen during script execution

Hi, I want to know how to show a splash screen (like a gif or jpeg file) on the user screen during my script execution. Thank you for your help. ...

What is the best way to implement 2-way encryption with PHP?

I would like to encrypt the passwords on my site using a 2-way encryption within PHP. I have come across the mcrypt library, but it seems so cumbersome. Anyone know of any other methods that are easier, but yet secure? I do have access to the Zend Framework, so a solution using it would do as well. I actually need the 2-way encryptio...

Detect exact OS version from browser

Hello, I was ondering if there is a way I can detect the exact OS version from my browser using PHP/JS/ASP? I know I can detect the type of OS (Windows XP,Windows Vista,OS X,etc) but I need to detect the exact version: Vista Business, Vista Ultimate, Windows XP Home, Windows XP Pro, etc... Thanks, Roy. ...

Smarty: How to reference to the associative array index

Array $imagelist: Array ( [additional] => Array ( [count] => 2 [image] => Array ( [nokia_e61_1.jpg] => Array ( [name_body] => nokia_e61_1 [name_ext] => jpg ) [nokia_e61_2.jpg] => Array ( [name_body] => nokia_e61_2 [name_ext] => jpg ) [nokia_e61_3.jpg] =>...

How do I migrate my website, mySQL, php pages, files, settings etc to Amazon EC2?

Hi I am completely new to EC2 and new to server admin and have been working on a windows 2003 server with our current web application made with PHP pages, mySQL database, and serving image files from a single standalone windows 2003 server. I would like to know how to go about 'packing up' our server and installing it as an image on Am...

Can someone give me a good reason for why assert in php behaves the way it does?

PHP's assert statement doesn't behave like most other languages. assert('return false'); actually evaluates the string and then asserts its result (false). Instead of comparing the paramter to true, it goes through the extra step of examining the argument, and if it's a string evaluating it, then performing the comparison. Very strang...

Escaping CURL @ symbol with PHP

I'm writing a php application that submits via curl data to sign up for an iContact email list. However I keep getting an invalid email address error. I think this may be due to the fact that I'm escaping the @ symbol so it looks like %40 instead of @. Also, according to the php documentation for curl_setopt with CURLOPT_POSTFIELDS: ...