php

Securing a PHP file manager from its users

Hello everyone, I'm developing a photo sharing web site using the CodeIgniter PHP framework. The idea is that people could upload their photos, manage them (through some sort of file browser which allows them to create subfolders, drag files around, etc) and edit them (some basic things like resizing, rotating and cropping to start with,...

connecting to quickbooks database via odbc with php?

[edit] We're collecting credit application data from users on a web form. I have not tied my web form directly into QB. I have no idea what the QB table structure is for this collection of data - nor of how it displays it to the user because I've never actually worked directly with QB. Others in my office do however. I would still ...

dynamic rows and columns inside a foreach loop

I'm trying, but I'm stucked with the logic... so, I have this: $max_items=10; echo '<table>'; echo '<tr>'; foreach ($feed->get_items(0, $max_items) as $item): echo '<td>'; echo $some_value; echo '</td>'; endforeach; echo '</tr>'; echo '</table>'; I want to show the results like this: [1][2] [3][4] [5][6] [7][8] [9][10] I ha...

redirect to another page

< type="button" value="PRINT" onClick="window.open('print.php?id=&sec=&subj=&type=viewrec2&Year=&faci= ','mywindow','width=800,height=800,left=0,top=100,screenX=0,screenY=100')"> when i click this button im being redirected into a new window. the problem is that on the main page where this button is located i want it also to redirect i...

Using scandir() to find folders in a directory (PHP)

I am using this peice of code.. $target = 'extracted/' . $name[0]; $scan = scandir($target); To scan the directory of a folder which is used for zip uploads. I want to be able to find all the folders inside my $target folder so i can delete them and there contents, leaving only the files in the $target directory. Once i have retur...

PHP to ActionScript code converter

Does anyone know of a PHP to ActionScript code converter? ...

Where should I put this method in an MVC architecture?

I am writing an application using CakePHP and I am unsure as to where I should be putting my generateMapUrl function. function generateMapUrl($id = null) { if ( !$id ) { $this->Session->setFlash('Invalid Property Id'); } $this->read(null, $id); $url = "http://maps.google.com/maps?oi=map&amp;amp;q="; $url .= ...

Is using namespaces to partition a project bad practice?

I have recently learnt about namespaces in PHP, and was wondering, would it be bad practice to do this? <?php namespace String; // string helper functions function match($string1, $string2) { $string1 = trim($string1); $string2 = trim($string2); if (strcasecmp($string1, $string2) == 0) // are equal { ...

Building a large form, need advice

I have to build a large form for users to fill out in order to apply for graduate study at the college I work for. There will be a large amount of information to collect (multiple addresses, personal information, business information, past school information, experience, etc...) and I want to know the best way to handle all this. I'm goi...

How to know for sure if FastCGI is being used to run php scripts

Hello, I have a hosted site and I'm having trouble configuring Joomla (running Joomla + php + mySQL on IIS7 + win server 2008). I have a similar configuration running on a local machine (Joomla + php + mySQL on IIS7 + vista x64), so I was at least able to follow instructions showed in various tutorials on how to set this up. This sympt...

PHP file uploads being "hijacked" by partial uploads

I have a site that is receiving 30-40k photo uploads a day and I've been seeing an issue pop up with more frequency now. This issue is this: Our upload script receives (via $_FILES['name']['tmp_name']) a file (photo) that was NOT uploaded by the user & the majority of the time the file received is a "partial" upload. Of course at first...

Rounded corners on images using PHP?

Does anyone know how to make a image have rounded corners using a PHP script? ...

What is the best open source application written in PHP to reference for 'good code'?

So I've read Drupal, Joomla, Magento, Wordpress all have bad PHP code... which is a shame because I was referring to them to see 'what they did' so I could hopefully get some insight. I assumed popular software meant it would have decent coding. So, what is the best PHP open source application to study? ...

How to use global caching in php?

ello all im new to php and server scripting ( coming from the java/cpp background ) my question is , if i like to be able to build some kind of single tone cache that will hold me data in memory in all the web application life , something that when i start the web server it will start main cache that will server the web application not ...

mySQL query for selecting children

Hello, I am not sure if this is possible in mySQL. Here are my tables:- Categories table - id - name - parent_id (which points to Categories.id) I use the above table to map all the categories and sub-categories. Products table - id - name - category_id The category_id in the Products table points to the sub-category id in which it ...

Why is specifying a defined constant inside a class constant throwing an error?

Here is part of my code define('DIR_APP', 'app/'); class Questions { const QUESTIONS_FILE = DIR_APP . 'questions.xml'; } Seems when I take the define()'d constant out of my class constant declaration, it works fine. But when I add it it throws this error: Parse error: syntax error, unexpected '.', expecting ','...

Can PHP and mssql library select more than 256 characters from a varchar column?

Is there a work around (other than changing the column type to a textfield) for SELECTing a large varchar field using PHP and mssql library? For instance a varchar(500). Does PHP really restrict the number of characters to 255? Is there a way to pull back more than that? ...

Whats the best way to manage QUERY_STRING in php?

One of my sites has some very complicated sorting functions, on top of a pagination, and the various variables add up to a pretty complex URL, which is a huge pain to manage. Is there a way to manage the QUERY_STRING efficiently? By this I mean... if the url is index.php?catid=3&sort=date&year=2009&page=2 and I wish to have the user ju...

Using PHPUnit in Zend Framework version 0.7

We have an application developed using Zend Framework preview version 0.7. Now I would like to write unit test its controllers / logic files. The logic mostly deals with the database and for database I am using my own wrapper. Did anybody try unit testing an application on top of Zend Framework version 0.7 ? ...

file_get_contents: failed to open stream: Host is down

Hello, I am running php5 on my mac osx 10.5. If I write a simple php script: <?php file_get_contents('http://www.google.com'); ?> And run it in the command line, I get the following error: "Warning: file_get_contents(http://www.google.com): failed to open stream: Host is down" I'm not sure if I'm missing some setting in php.ini or ...