php

Using _forward with AjaxContext

I have a controller setup that uses a whole bunch of different AjaxContent helpers. My init() for the controller looks something like this: $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('index', 'html') ->addActionContext('compose', 'html') ->addActionContext('sent', 'html') ...

MySQL - storing images in a database??

Lets say each row of our table contains information about various vehicles for sale. And each user can store several images of each vehicle. What might be a good approach to storing these images? Duplicate: User Images: Database or filesystem storage? Duplicate: Storing images in database: Yea or nay? Duplicate: Should I store my image...

Programming first, framework second?

Firstly hello as my first question. Looking for guidance rather than coding fix. The final flicker of Informix 4gl contracting extingiushed for me in 2004. To cut a long story short I am looking to code again by creating a website. I will be using PHP v5 and MySQL. Spent about a year (in spare time) doing all data analysis and DB desig...

Nested foreach()

I have the following array: Array ( [1] => Array ( [spubid] => A00319 [sentered_by] => pubs_batchadd.php [sarticle] => Lateral mixing of the waters of the Orinoco, Atabapo [spublication] => Acta Cientifica Venezolana [stags] => acta,confluence,orinoco,rivers,venezuela,waters [authors] => Array ( [1] =...

how to write a rewriteCond in .htaccess to exclude a subdir and its subdirs

Hi, I have the following problem. I have a website and a blog in a subdirectory. Both of them are php. I have a .htaccess file in the root folder and another one in the blog folder. I dont' think is relevant, but the blog script is wordpress. I added a condition in the root .htaccess to skip the requests made for the blog, rewriteCon...

Is Using URL Rewritting Pivotal for Scaling a Larger App

I am currently working on a site which resembles a forum in its essential structure. I have decided not to opt for using one of the established PHP frameworks (I have played with Rails before), partially to learn, and also partially because I believe they hinder development in the long term. I wanted to know how important URL rewriting ...

Simple jquery ajax response on error

A couple of questions, first with this var string below, the 1 one works but I need to get the second one working, there is a snytax error because I am not sure how to write it var string = 'id='+ id ; var string = 'id='+ id 'USER=1'; Second; This ajax call below, it post to delete.php to delete a comment, it works but I would like to...

prevent direct access to a php include

I have a php script PayPal eStores/dl_paycart but it has PayPal eStores "settings.php" Security Bypass Vulnerability I would like to know if I can prevent direct access to a php include file. Would this help? defined( '_paycart' ) or die( 'Access to this directory is not permitted' ); Thank you ...

regular expressions and xpath query

Hello I have the following code <?php $doc = new DOMDocument; $doc->loadhtml('<html> <head> <title>bar , this is an example</title> </head> <body> <h1>latest news</h1> ...

CampaignMonitor (PHP) Finding if an email is subscribed

Using the CampaignMonitor API, I am able to subscribe, resubscribe and unsubscribe successfully, but I can't figure out how check if an email address is active, or unsubscribed. The end goal, is basically if subscribed, echo an unsubscribe link, if not subscribed echo a subscribe link. After digging around CMBase it appears that subscr...

PHP email regex still allowing 2point straight after eachother

In PHP, I use this regex for checking mails: $rexMail = "/^[a-z0-9\._]+@{1}[a-z0-9-_]+\.{1}[a-z]{2,4}\.?[a-z]{0,2}$/i"; In most cases, this will suffice. However, this mail address turns out to be valid for the regex: [email protected] That shouldn't be possible. While multiple points should be allowed before the @ sign, it s...

Make a multi-column table from a CSV file using PHP

Sorry if this is a bit long, but I want to be as detailed as possible. Basically, I'm trying to create a multi-column table from a CSV file using PHP. I would like the table cells to list vertically. For example, if I have a CSV file with the names: bill mike sarah steve kim dave Assuming I need 2 columns, I would like the table to...

How can I poll a PHP page using javascript?

Hello, I am sure there is a simple answer to this, but I am drawing a blank at the moment, any suggestions pointers would be great. I have a php page [ lets say counter.php] which when called [loaded/viewed] it connects to a db and increments a counter. I also have another page that has a selects box, I want to add a .js function on the...

Safe timeout value for codeigniter session class?

I am using codeigniter's session class to handle my PHP sessions. One of the session variables automatically created on every visit to the site is session_id: The user's unique Session ID (this is a statistically random string with very strong entropy, hashed with MD5 for portability, and regenerated (by default) every five minutes) ...

CodeIgniter: Development and Production Environment

Hello All. I am currently in the process of learning the CodeIgniter PHP framework. At the current moment, I am looking to have a DEV environment and a PRODUCTION environment. Coming from a purely C and JAVA background, I am used to having everything locally (with version control), but since I will have the PRODUCTION side on a website,...

How does codeigniter's form validation library handle xss filtering?

The codeigniter form validation library provides the option to 'prep' data from a form that is being validated. The following is a snippet from the documentation: $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean'); The xss_clean parameter at the end supposedly passes t...

Logging out after certain amount of time

What would the best way be to logout a user from a PHP application (so basically just perform a redirect) after X seconds of inactivity? For "inactivity" I'd count the time of the last page load, and if the current time is more than X seconds away, perform the redirect. Is this something that would need to be achieved with Javascript? ...

Whats wrong with this php code, keep getting Error no 2?

<?php session_start(); // After user logged in session_regenerate_id(); $_SESSION['logged_in'] = 1; $_SESSION['ip'] = $_SERVER['REMOTE_ADDR']; $_SESSION['agent'] = $_SERVER['HTTP_USER_AGENT']; // Session Checking function session_check(){ if(isset($_SESSION['logged_in']) && !empty($_SESSION['logged_in'])){ if(isset($_SES...

which platfom should I choose for a wiki like lexicon with moderation?

Hi, I need to build a lexicon with the following specifications: It has to be wiki-esque (versions, easy to contribute, term linking, etc.) Unlike a wiki, it has to have moderation (any registered user can contribute, but every contribution has to be approved by a moderator before publishing) Each term can have attachments (image & oth...

php print xml data returned from api call- failed

$response = sendRequest($curl, doCreateDB($domainid, $dbname, $dbtype)); $responseXml = parseResponse($response); function parseResponse($response_string) { $xml = new SimpleXMLElement($response_string); if (!is_a($xml, 'SimpleXMLElement')) throw new ApiRequestException("Cannot parse server response: {$response_string...