php

Access and manipulate XML file using DOMDocument

Hey all, I am trying to use DOMDocument to access an XML file, find data that matches a certain criteria, and then drop the node containing it if it does. I then need to create a new XML file with the remaining data. Below is the function I am using, with $current_balances being the full path to the XML file that i wish to use. I am ...

Assign a number (between 1 and 9) to a md5 hash

Having a md5 hash like: md5("test") = "098f6bcd4621d373cade4e832627b4f6" How can I write a function to return a number between 1 and 9 every time I pass the md5 hash to it? The number must always be the same, i.e. myfunc("098f6bcd4621d373cade4e832627b4f6") should always return the same number. Thanks for your help. ...

Validating user input (search filters)

Hello, I'm building a search page and I'm a bit unsure on what I should in regard to sanitizing and validating user input. The search page has filters which are passed via querystrings. (some passed from inputs and others from links with checkbox/radio like behavior) What should I look out for in this situation? Can I be safe using ju...

php streaming or buffering mp3 file problem.

I built a mp3 playing website. I use a flash mp3 player to play the mp3 file.It can play, but it can not load the correct time and not stream and buffer the mp3 file located on my server. It can play the mp3 file correctly if the url is from other site, like Google music. I think the important problem is the header output of the mp3 f...

Smarty reading last x numbers of rows of an array

I need to read for example last 3 items of an array in smarty. Please advice. ...

php 5 constructor _construct does not work

Hi We have php 5.3.0 and I would like to use the constructor _construct. But somehow this constructor is not called when an instance of the class is made. And old constructor ( function ClassName() ) on the other hand works. Should not the new version (_construct) work with php 5.3.0 ? Another thing I would like to build an constructo...

Removing duplicates with array_unique

I created a image uploader which works by remote, so whenever a user enters a bunch of links, I want to prevent duplicate links being added so that the image isn't copied twice and is removed so it leaves the links to be unique without any duplicates. $break = explode("\n", $links); $count = count($break); $unique_images = array(); fo...

Retrieving textarea contents with PHP. Getting added backslashes

I am building a web application that is supposed to make it easier for users to generate correct XML for a given utility. As a simple test, I created a textarea that contains the generated XML. I then created a button (<input type="button">) with a jQuery handler that will send the contents of the text area to my PHP application, which...

jQuery and PHP session issue

In uploadify I have a problem passing variable into the php script. Here's the code: $(document).ready(function() { var counter = 0; $("#uploadify").uploadify({ 'uploader' : 'scripts/uploadify.swf', 'script' : 'scripts/uploadify.php?upload', 'scriptData' : {'PHPSESSID' : '<? echo sessi...

How to add a txt file and create a ZIP in php

Possible Duplicate: Open file, write to file, save file as a zip and stream to user for download I have a txt file in uploads folder where i need to add this file and create a ZIP on fly and prompt the user to download the Zip file which should contain the text file .How do i do this and moreover what are the headers needed ...

Using Template on PHP

hi, i create a template file for my site... it's like: <!-- template.php --> <?php function showheader() { ?> <head><body> <!-- some of style files and menus --> <div class="content"> <?php } ?> <?php function showfooter() { ?> </div></body></html> <?php } ?> i use this file as a template like this: <?php include_once("template.php"...

Codeigniter with Smarty causing an error

I'm using Smarty_parser.php and it works well when when I use the parser by itself or if I run the parser then a view call. For example: public function act() { @$this->load->library('smarty_parser'); $data = array('Someinfo'); $this->smarty_parser->parse('contentTmpls/act.tpl', $data); // Load Footer $this->load->vi...

How can I create a WinZip compatible AES-256 encrypted zip file from PHP on Linux?

I have to create a WinZip compatible zip file from a PHP application on a linux box, and it must use AES 256 encryption. I have found a few solutions for PHP on Windows, but they don't help me! A PHP package would be great, but if I need to, I can always have my PHP code run exec() or something to run a linux command line utility. Any s...

phpmailer can't add a reply to address

Hi, I am trying to add a reply to address to my php mailer and it just puts from "me" and replies to my address. Any ideas what I am doing wrong? I have added the $mail->AddReplyTo. I want it to reply to the sender of the web form. $name = $_POST['name']; $telephone = $_POST['telephone']; $email = $_POST['email']; $message = $_POST['...

Insert large amounts of text into MySQL database

Hi I have encountered a problem while inserting a large amounts of text into my MySql database. Can I please get any pointers (what column types to use & any other issues I need to know) as to how I can achieve this, the code works fine with small amounts. Thanks in advance. Clarification The text blocks have around 7,000 characters....

Propel as a Standalone Library

I want to use Propel as a Standalone Library just as Qcodo or Doctrine e.g. without using Pear or Phing. I want to run both the generator and runtime in a Phing Free and Pear Free Environment. Is that Possible ? ...

Is Zend ACL suitable for permissions for content by owner

I think Zend ACL is used to give permissions to user types (student, teacher). Can it be used to give permissions on per content basis. What I mean is this blog post was written by this user and they can edit it. Others can't edit it. Can Zend ACL work with this requirement? ...

Multibyte Safe Url Title Conversion in PHP

I'm trying to create a multibyte safe title => url string converter, however I've run into the problem of not knowing how to allow legal asian (and other) characters in the url when removing others. This is the function set at the moment. public static function convertAccentedCharacters($string) { $table ...

Displaying Data From Multiple MySQL Tables

I'm having a little problem displaying data from a database... I have two database tables: categories(cat_id, cat_name) menu_items(menu_id, menu_name, cat_id, menu_description, menu_price) I would like to display data as: Categorie 1 Name cat_id = 1, menu_name, menu_description, menu_price cat_id = 1, menu_name, menu_descripti...

xpath to get all elements

I am using simplexml to parse xml and I can get single node but not all nodes i want example $xmlObject = simplexml_load_file($xml_file); // load the xml file $cols = $xmlObject->RESULTSET->ROW->COL; foreach ( $cols as $COL) { echo $COL->DATA; } only gives me the first col of the first row, i tried $x...