php

Finding the path from the ROOT url

Hello, I have file say config.php which is stored in a user defined folder like /abc/def/config.php Now this file is included by another file like /test.php and this file is called in the browser. Now I want to find the path of the config.php from the root site. Usually we can use SCRIPT_FILENAME. But that is not possible because that...

Metadata for columns in SQLite v2.8 (PHP5)

How can I get metadata / constraints (primary key and "null allowed" in particular) for each column in a SQLite v2.8 table using PHP5 (like mysql_fetch_field for MySql)? sqlite_fetch_column_types (OO: $db->fetchColumnTypes) only gets column name and datatype: http://dk.php.net/manual/en/function.sqlite-fetch-column-types.php SQLITE_MAS...

php5 security - get/post parameters

What is most efficient method to making sure that get/post parameters won't provide any security vulnerability. I am familior of htmlentities for javascript code injection prevention and addslashes to prevent sql injection. so.. for now i'm using them both on each get/post parameter. are there any other functions i can use to prevent...

PHP db search engine, Is it better to use and existing API?

I've been recommended to work with an existing API like Sphider, but I'm having trouble understanding how to configure it and what the hell does retrieving values from DB have to do with page indexing (it's not a content pages website). I was thinking of building a simple search myself with MyISAM tables. Does my plan have any downsides...

Generated Doctrine models respect case, but generated Yaml does not

Just getting started with Doctrine ORM for PHP (v1.1.5) and ran into something unexpected. I am generating models from the db (MySQL 4) using: Doctrine::generateModelsFromDb($pathToModels); Then generating YAML from the models using: Doctrine::generateYamlFromModels($pathToSchema . '/schema.yml', $pathToModels); In the generated m...

PHP Output complete notification

I'm trying find a way to have PHP to indicate to the browser that all page output is complete. After the page is done we're running some statistics code that usually doesn't take to long but in case it does I don't want to have the users browser waiting for more data. This can't be done via JavaScript because it needs to work with mobil...

PHP/HTML: 500 Internal server error...?

The code provided in the link has problems. When trying to go to the real webpage, it gives me a 500 internal server error. What is wrong with the code? Anybody knows? http://www.gdscei.com/myphp.txt I am using iWebKit. (I know you cannot read the text, it's Dutch. But I am not seeing any problem with pure text.) ...

Check if host computer is online with PHP?

I've been having some issues with my Internet connection and I was wondering what is the fastest, error-less and most reliable way to check if the host computer is connected to the Internet. I'm looking for something like is_online() that returns true when online and false when not. ...

Setting Up a Default Server On Eclipse

A very simple question - in the Eclipse documenation it says, at various places, that there is a default server installed along with eclipse yet I can't find any further documentation or details. So is there a default server installed? ...

problem with simpleXMLElement

Here is my PHP code $xml= new SimpleXmlElement($rawxml); foreach($xml->children()->children() AS $key){ $id = $xml->{"id"}; $name = $xml->{"screen_name"}; $profimg = $xml->{"profile_image_url"}; echo "$id, $name, $profimg"; } $next = $xml->{"next_link"}; echo "index.php?".$next; Here is the structure of my xml <?xml version...

PHP - Default session handling vs. custom session handling

Hi all. I have never tried a custom session handler so far in PHP, and with me thinking of picking up a framework (either CodeIgniter or Kohana), I see that there is an option to use a pre-built custom session handler. What are the pros and cons of going to a system in which session data is stored in the DB? In what ways does a custom se...

CMS/Intranet file upload system

In my attempts to write a CMS or intranet system, I need the ability to upload files to a "workspace", which is permissions based. Now I can sort the permissions out, however, I am struggling a bit with the file upload itself. Basically, such as a VLE, let's say I am a manager. I want to upload a file for those in my department to see...

php paths that work on both local (mac) and remote server

Hi Guys, I'm testing a website on my local machine and I'm wondering what would be the best way to write paths to make sure they work when I upload the site to its final location. In general I'm a bit confused about paths, and in many cases I have to 'tweak' each path until it works, so wouldn't want to be forced to do the same on a p...

how to send / get files via web-services in php

is this possible ? what is the correct way to send files ? thanks ...

How to change background color of image to green?

Now it's black. function show(){ $word=array("a","b","c","d","e","f"); $name=$word[rand(0,5)]; $im=imagecreatetruecolor(62,20); $black=imagecolorallocate($im,rand(20,100),rand(20,100),rand(20,100)); $white=imagecolorallocate($im,255,255,255); imagettftext($im,14,1,15,17,$white,'simkai.ttf',$name); for($i=0;...

php session encryption

I'd like to have sessions data encrypted like they are in suhosin, is there any library out there providing that? ...

Should I use ImageMagick or GD2 with ImageAPI in drupal?

Why? What are the pros and cons of each? ...

What features should a robust, scalable, ... and expandable PHP Framework be composed of?

What are the features (e.g. cookie, session, template, database handling) should a ... robust scalable flexible OOP-compatible MVC expandable ... PHP Framework be composed of? and what other features would be great for any developer in a PHP framework? I've been looking a lot at frameworks such as CakePHP, Symphony, and so on.. thei...

Debugging 500 Internal Server Error on PHP running on IIS7 cluster

Recently my ISP switched our website to an IIS7.0 high availibility cluster. The website is running on PHP5.2.1 and I can only upload files (so no registry tweaks). I had tested the website before and everything seemed to be working, but now the checkout page fails with: 500 - Internal server error. There is a problem with the resource...

Drupal module to edit regular db tables

I have a few custom tables in my Drupal database that were created manually. Is there some Drupal module to allow viewing and editing records in custom tables? Tables are simple, no joins used. Or it's best to build some grid/record interfaces manually in custom module? ...