php

What characters to strip from messages?

I'm quite surprised I haven't been able to find out what characters I need to strip from a message in order to keep my application safe. I've got a php app, and most of the inputs are numerical, but I'm adding the ability for users to attache messages, so I need to cleanse the message and strip any characters that could be a threat. ...

Wordpress: install multiple plugins from one zip

I've noticed that if I take a plugin, let's call it "wordpress on steroids", and I place other plugins (the raw files) into the "wordpress on steroids" folder, providing that there are no files with the same name, I can effectively upload multiple plugins with one single install. However, there are problems with this approach... 1) Alr...

PHP RSS Parser (Magpie) Deep elements

Im using Magpie RSS Parser (http://magpierss.sourceforge.net) Here is the vardump: array(11) { ["dc"]=> array(1) { ["creator"]=> string(9) "Microsoft" } ["title"]=> string(16) "The Type We Want" ["description"]=> string(245) "After a slow evolution, the landscape for custom type on the web has been changing quickl...

how to display mysql data with group by once every type in php

I have a result set like this : Platform Set Total WinY1-23 OT 12 WinY1-23 TT 22 WinY1-23 OR 13 WinY1-23 OY 142 Total_WS OT 12 Total_WS TT 12 Total_WS OR 13 Basically this is a query with group by Platform, Set. I want to be able to display each Set and its total within each Platform. Hope this m...

using ajax to create an authentication app but no return is being put.

when i click post the post response that i am getting from firefox is: (when i enter k for username) password username k Source: username=k&password= the print received from the php wont display in the #errorshow div here is my code (html) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt...

php strings don't like mutiple variable insertions?

I'm using php 5.2 with oracle 11.1. This code: $query = oci_parse($conn, "SELECT * FROM COMMENTS WHERE PINID=$pinID and COMMENTID=$commentID"); results in this error: <b>Warning</b>: oci_execute() [<a href='function.oci-execute'>function.oci-execute</a>]: ORA-00904: &quot;COMMENTS&quot;: invalid identifier in <b>C:\IODwww\hello.php...

Obscuring database id's

I have a table with a primary key that is auto increment. I want to have an image associated with the primary key but I don't want the primary key to be revealed. Would naming the images something like: $filename = md5($primarykey + $secret_string) . '.jpg'; be a good solution? I am worried that there could be a collision and a file ...

PHP Warning: socket_recvfrom(): Unsupported socket type 774909488

Code Snippet: $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP) or die("Could not create socket\n"); $recvsock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n"); socket_bind($recvsock, "192.168.3.149", "49217") or die ("Could not bind"); socket_listen($recvsock); socket_sendto(...

eclipse xdebug session never completes

I am trying to get xdebug working with eclipse (3.5) / php (on xampp windows 7). I have verified xdebug is enabled in php - I have the fancy output and my phpinfo shows all the xdebug stuff. I have remote debug on, and typed in the lan ip address on my eclipse machine. When I tell eclipse to debug, it launches the browser and passes t...

How do I format a number as decimal to store it in mysql?

I want to store a price for an item in decimal in MySQL. How would I have to format the price in order to store in in the db? ...

PDO::PARAM for dates?

Hi, does exist some PDO::PARAM_??? which can be used for dates or timestamps? $sql = "UPDATE my_table SET current_date = :date WHERE id = 43"; $statement = $pdo->prepare ($sql); $statement->bindParam (":date", strtotime (date ("Y-m-d H:i:s")), PDO::PARAM_STR); $statement->execute (); ...

PHP filter library or class

I need a filter function for a project I'm working on. I am thinking about using HTML purifier. However I concerned about it performance. Does any of you guys used or using HTML purifier. Or do you suggest another library or class with similar functionality. The most important issues are: utf-8 support xss security ...

Listing files alphabetically (both files and folders)

How would I list all the files and folders in a folder alphabetically with PHP. I used the following for the files a.txt, b.txt, c, d.txt. Where c is a folder. The problem is that c is displayed last instead of after b.txt because it is a folder. I'd also like to be able to check if each is either a file or folder. <?php $dir = open...

output files from a second directory in same php function

I have the following code to output images from directory im/, how can I tweak this to also output images from another diectory called out/ (for example)? As to echo another img tag under the current one? <?php $imgDir = "im/"; $images = scandir($imgDir); $ignore = array( ".", ".." ); natsort($images); foreac...

MySQLi Catchable Fatal Error

I'm using prepared statements and MySQLi, and am currently getting this error. PHP Catchable fatal error: Object of class mysqli_stmt could not be converted to string in /Users/me/path/to/project/ModelBase/City.php on line 31 The code it's coming from (full function): function select($query, $limit) { $query = "%".$query."%"...

How to merge two class in PHP?

So that the final class have all member variables/methods in both class Is there an easy way to go? ...

Database Design - Application Integration with Other Systems

I'm currently integrating external applications in my app ex SalesForce.com. My question pertains to properly designing tables for data capturing custom fields. So for SalesForce all companies have an Organization ID but then they can also have custom fields for capturing data. I've looked at two options for handling this. Let them cr...

Looking for a script (php) for linking inside website

Hi, I'm looking for some kind of php, javascript some sort of cloud script, but really like a cloud script. It's more like some links after a page content. There are a few for cms's like joomla wordpress etc, but I have a css div based website without cms and can't find nothing like the example beneath. I'm not asking to write a script...

Is it possible to change the value of a cookie and leave the expiration date the same in PHP?

Say I have a PHP script that creates a cookie that expires 10 days from now. Is there any way to use PHP to update the value and maintain the same expiration date? For example, say my cookie is created today with a value of "foo" and expires on 3/13/10. Two days from now, I want to change the value to "bar". Can I still have the cookie...

PHP - Using XML for a config file(s) are elements better than attributes or opposite?

I'm using XML for a config file in PHP (Using SimpleXML), in creating the config file what is more of a standard. Having all values in elements or using the attributes? Elements Example: <database> <user>test-user</user> <pass>test-pass</pass> </database> Attribute Example: <database user="test-user" pass="test-pass"></databa...