php

Passing an array of data to a private function in CodeIgniter/PHP? [facepalm]

So I thought this should be easy, but, I'm n00bing out here and failing epicly (as they say on teh interwebz). So here's my code: function xy() { $array['var1'] = x; $array['var2'] = y; echo $this->_z; } function _z($array) { $xy = $x.$y; return $xy; } So, why doesn't that seemingly simple code work? I know with views you ...

.htaccess cross browser

Hi, Im trying to load a custom error document for a 404 error using a .htaccess file on a linux server, the page gets the current page URL then redirects to another site (which is retrieved from a db) based on an id it retrieved from the URL. The current error documents are stored here: /error_docs/ - i dont have permission to upload...

PHP - Redirect and send data via POST

I have an online gateway which requires an HTML form to be submitted with hidden fields. I need to do this via a PHP script without any HTML forms (I have the data for the hidden fields in a DB) To do this sending data via GET: header('Location: http://www.provider.com/process.jsp?id=12345&name=John'); And to do this sending data...

Changing background images like this

If you guys check out this webpage: http://www2.scandvision.se/oresund10/ How have they done this background fade in fade out? When i check the source this <img id="wrapper-background" src="images/body-background-0.jpg" alt="Background" /> and i think theres some kind of script maybe php or js, or both, that every 5 sec changes ...

How to flock() an image?

I am looking to flock() an image. Currently I am using the following $img = ImageCreateFromPng($img_path); flock($img,LOCK_EX); It seems that the GD library's file handle is not valid with flock. How can I access the image and flock the file? ...

echo POST array.. or other ideas?

Update: As seen in the Original Questions below, I am looking to echo an array. The problem is that when I send the Moneris gateway to return a POST array to my new file (cart.php) it gets a 500 Internal Server Error. This is the same error I received when it send to the script, which should have worked. Is there any reason that it wou...

Compare range of ip addresses with start and end ip address in MySQL

I have a MySQL table where I store IP ranges. It is setup in the way that I have the start address stored as a long, and the end address (and an id and some other data). Now I have users adding ranges by inputting a start and end ip address, and I would like to check if the new range is not already (partially) in the database. I know I ...

wamp server not working? or bad php code

I have this PHP code: <?php $username="root"; $password="******";// censored out $database="bazadedate"; mysql_connect("127.0.0.1",$username,$password); // i get unknown constant localhost if used instead of the loopback ip @mysql_select_db($database) or die( "Unable to select database"); ...

Zend Framework Response Filter to strip newlines and whitespaces between tags

I am wondering if there exists any filter/plugin which does the following to a zend framework response: Strip all unnecessary whitespaces from the HTML response Strip all newlines between tags which are not used (e.g. between ul -> li elements: IE6 design errors) Anyone know about something like that? thanks ...

need to store values from foreach loop into array

Need to store values from foreach loop into an array, need help doing that. Code below does not work, only stores the last value, tried $items .= ..., but that is not doing the trick either, any help will be appreciated. <?php foreach($group_membership as $i => $username) { $items = array($username); } print_r($items); ?> ...

PHP, is_array() generating an "Undefined property: stdClass::$crit " error

is_array($src2->crit) is generating an "Undefined property: stdClass::$crit" error. The line throwing the error is: if(is_array($src2->crit) && count($src->crit) > 0){ $src2->crit is initialized here. $src2->crit = array(); $src2->crit[0] = new dataSet(); $src2->crit[0]->tblName = $tbl2; $src2->crit[0]->colName = "ID"; $src2->crit...

the query is breaking. How to skip rows PHP

Hello all. I have a question probably lame but it made me stuck I have the a db query $query_Recordset10 = "SELECT * FROM products WHERE razdel='mix' AND ID='$ID+1' AND litraj='$litri' ORDER BY ID ASC"; $Recordset10 = mysql_query($query_Recordset10, $victor) or die(mysql_error()); $row_Recordset10 = mysql_fetch_array($Recordset10...

How to get the duration of the video uploaded ?

i'm using ffmpeg to convert videos to desired formats and to generate the thumbnails.. I want to find the total duration of the video to display in the main page along with the thumbnails.. Can i use ffmpeg to find the duration when its being uploaded and store them on the database.? Is storing the duration in db is necessary or else...

New line before header()

I'm working with a custom made Joomla script that generates an image from a blob in a database. However, when we moved it from an Apache server to an IIS server, the script is breaking. Upon investigation, it seems that now, there is a line break that is getting appended before the header function is being run (when I comment out the i...

Design pattern for creating an XML document from a database query that has a 1:many relationship

All, Sorry in advance for the ambiguous title. Here's what I'm trying to do... I'm working on an application that needs to query a database to get a list of items. That list of items will get formatted into an XML document that gets returned to the querying front-end. To simplify, let's say that the items are books. Each book has the...

Recommend a cURL wrapper class in Php

I need recommendations for an established and maintained cURL wrapper library/class to use with cURL in Php. It wouldn't hurt if there was some documentation with it, but its not a must have. Thanks ...

3rd party applications API / Framework Q for PHP user site

So we are defining out functional requirements for a user content site and would like to enable: 1) 3rd party developers to develop applications that users can use on their profile 2) Enable users to export content to other sites meaning share their photos on the net. So we were told we need to use APIs for this & it's merely changing d...

PHP: Copying file permissions with fileperms and ftp_chmod

The overall goal: Copy the permissions of files from the local filesystem when uploading them over FTP using PHP. The problem: While ftp_chmod appears to succeed, and according to the print statement in the code I'm setting the right permissions, it sets completely wrong permissions. The code: $perms = fileperms($src); if ($perms !==...

limiting user actions by months

hi my users upload photo and all uploads recorded in mysql with the date info. i want to limit uploads by the months. user may just upload 3 pics in a month. what is the best way to do this ? cheers ...

Separation of presentation and business logic in PHP

I am programming my first real PHP website and am wondering how to make my code more readable to myself. The reference book I am using is PHP and MySQL Web Development 4th ed. The aforementioned book gives three approaches to separating logic and content: include files function or class API template system I haven't chosen any of th...