php

replace entites in rawurlencode i.e. < > "

Hi I have the following code <a href="snippet:add?code=<?php echo rawurlencode($snippet->snippet_content); ?>Save snippet</a> where '$snippet = &lt;a rel=&quot;nofollow&quot; href=&quot;http://digg.com/submit?phase=2&amp;amp;url=&amp;lt;?php the_permalink(); ?&gt;&quot; title=&quot;Submit this post to Digg&quot;&gt;Digg this!&lt;/a...

What should be the right file permissions for program executables and logs files?

I have written a Linux system wide C++ program /usr/bin/PROG_X that uses a configuration file /etc/PROG_X.conf and log file /var/PROG_X.log. Now I need to call this program, after strong authentication, from the web using apache web server and php. Calling the program may involve changing configuration files and will change, of course, ...

Secuity considerations when including files

Hello I am preparing to setup a request routing system in php based on the $_GET array. For example, for the url ?r=login I'd use include myfiles/".$_GET['r'].".php"; Which would point automatically to myfiles/login.php I know I need to sanitise the get input, but I'm concerned as it is possible to maliciously redirect the include. Ca...

Code Igniter returning blank page when uploaded to a server

Hi, I just uploaded my codeigniter directory to my unix server and I am getting a blank page. The same directory is located in my desktop web server where it works just fine. Also, I uploaded a fresh copy of CodeIgniter directory to my unix webserver and that just works fine. Do any of you know what could be the problem? Thank You. ...

How to find GMT date/time by country name?

How can I find country name -> GMT date/time to that I can do like following: Example: $datetime = new GMT_search('America'); //output: 2010-01-01 00:00:00 $datetime = new GMT_search('India'); //output: 2010-01-01 ??:??:?? $datetime = new GMT_search('China'); //output: 2010-01-01 ??:??:?? I tried gmdate(), date_default_tim...

cassandra: Storing value?

Hi everybody, I wanted to make a tryout this weekend with Cassandra + PHP in my testing environment. So after a few hours of headache trying to install it, I finally succeeded and got it running. However, I've tried out the different PHP wrappers for cassandra, and I have totally failed to connect with anyone. SimpleCassie which I want...

symfony query question

In the modules actions, what is the best way to select records based on an index other than the primary key id? $this->city = Doctrine::getTable('City')->find(array($request->getParameter('city'))); This always returns a query with WHERE City.id= instead of WHERE City.city= Do I have to do something like $q = Doctrine_Query::create(...

Execution time in kohana 3

Hello, How to get execution time and etc. in simplest way in Kohana 3. ...

Another file permissions problem

I have a classifieds website, and when users post a new classified, they may chose to upload images. My php code takes the chosen image, uploads it to a image folder, and names it accordingly. The problem here is, I have to set the images folder to 777 in order for this to work. My question is, what should the permissions be set to? A...

looping through multiple arrays and inserting into SQL

Hi, I have a form that once submitted some of its result are stored in arrays, example: (The form has multiple lines with the same input names) <select name="product[]"> once submitted goes into $_GET['product'] if I do: // Product ID's foreach($_GET['product'] as $name => $prodvalue) { print "$name : $prodvalue<br>"; } the follo...

Is there a place where we can see PHP <=> C++ equilavent libraries/function for a php developer starting with C++?

Is there a place where we can see PHP <=> C++ equilavent libraries/function for a php developer starting with C++? As a PHP developer starting with C++, I often ask myself: what is the equivalent of such-and-such PHP function in C++? The advantage of php, is that we have a very nice site which documents about everything we might want t...

Zend PDO error - how can I debug it?

I have a weird problem using Zend Framework and Mysql. I generated a query: SELECT events.idUser, szForename, szLastname, readers.szName, idZoneFrom, events.dtTime FROM events, users, readers WHERE events.idUser = users.idUser AND events.idReader = readers.idReader AND dtTime >= '2010:02:15 0:00:00' AND dtTime < '2010:02:16 0:00:00' ORD...

Capistrano uploads the .git directory

I am using git with capistrano. I initialized my project inside my folder on my local machine as such: git init I then pushed the project the server directory I then called cap deploy The deploy works, except that it uploads the local .git folder structure, as well as my .gitignore and Capfile to a publicly accessible folder. Here's...

Conditional of a loop within a loop is not matching

I have two databases, each containing email addresses of users. I've written a script that has the sole purpose of seeing which email addresses exist in both databases. With that being said, please look at the following loops. Each loop contains hundreds of records (I've printed out the results from each as a verification). However,...

Append time to an HTML element attribute using PHP to force browsers not to cache a Silverlight application

How can I append current time using PHP to the value attribute of the first param element in the following html fragment? <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> <param id="sourcie" name="source" value="SClient.xap?**TIME**"/> <param name...

PHP - exit or return which is better?

Hello all, I would like to know in the following case which is a better solution: In the PHP script, if the fileSize is larger than 100 then I stop the script. <?php ... if ($fileSize > 100) // case I { $results['msg'] = 'fileSize is too big!'; echo json_encode($results); exit(); } ?> <?php ... if ($fileSize > 100) // case ...

Trying to get the path to a node with PHP & MySQL

Hello, I'm trying to build a breadcrumb here and I'm having some trouble doing it. The problem arises from the fact that I have to save category name (in two languages), slug and id. My categories table looks like this: CREATE TABLE `categories` ( `category_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `category_name` varchar(2...

Getting an undefined id exception when using Doctrine 2.0

Please see the code here: http://pastie.org/1092106 When I call the method createPost on Blog, I keep getting an exception, it reads as follows: At line 474 in lib/Doctrine/ORM/Persisters/BasicEntityPersister.php - Undefined index: id OH, and also... I regenerate $_SESSION['User'] on each page load, so the object isn't detached from ...

PHP class public parameter as two dimensional array, how?

Ok, so I have a class and I would like to be able to get any trackName (two dimensional array) after initializing an object in another php script. This is a part of the class that is relevant: class fetchData{ public $artistName; public $trackName; public function getArtistTracks(){ $i = 0; if( $tracks = getTracks() ){ ...

PHP Accessing a child's private properties in parent

Hi I have a parent object that I use for general CRUD in my applications - it has basic save & retrieve methods so I can don't have to reinclude them them in all my objects. Most of my child objects extend this base object. This has worked fine, but I'm finding a problem with retrieving a serialized child object. I use a "retrieve" meth...