php

Replacement for PHP's __autoload function?

I have read about dynamically loading your class files when needed in a function like this: function __autoload($className) { include("classes/$className.class.php"); } $obj = new DB(); Which will automatically load DB.class.php when you make a new instance of that class, but I also read in a few articles that it is bad to use thi...

please help turn a simple Python2 code to PHP

Hi guys, Sorry to bother again, but I really need help transforming this Python2 code into PHP. net, cid, lac = 25002, 9164, 4000 import urllib a = '000E00000000000000000000000000001B0000000000000000000000030000' b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8) c = hex(divmod(net,100)[1])[2:].zfill(8) + hex(divmod(net,100)[0])[2:].zfi...

Help Reading Binary Image Data from SQL Server into PHP

I cannot seem to figure out a way to read binary data from SQL server into PHP. I am working on a project where I need to be able to store the image directly in the SQL table, not on the file system. Currently, I have been using a query like this one: INSERT INTO myTable(Document) SELECT * FROM OPENROWSET(BULK N'C:\image.jpg',...

How to define an n-m relation in doctrine?

If got a table "Article" and a table "Tags". Articles can have multiple tags and tags can hang to multiple articles. The class BaseArticle looks like this: abstract class BaseArticle extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('article'); $this->hasColumn('article_id', 'integer', 8, arra...

Kohana input & validation libraries - overlap?

I'm familiarizing myself with Kohana. I've been reading up on the Input library, which automatically pre-filters GET and POST data for me, and the Validation libary, which helps with form filtering and validation. Should I use both together? The examples given in the Validation library documentation use the unfiltered $_POST array ins...

mcrypt decoding errors

Hi, I have a few issues with the following php functions (part of a bigger class). //encode public function acc_pw_enc($text, $key) { $text_num = str_split($text, 8); $text_num = 8 - strlen($text_num[count($text_num)-1]); for ($i=0; $i < $text_num; $i++) { $text = $text . chr($text_num); } $cipher ...

checkUnique function?

Hey, so I have created a function to check the DB for unique entries, but when I call the function it doesn't seem to work and gives me a fatal error any ideas from the function or do you wish to see the sign up page calling it. Thanks :) //Check for unique entries function checkUnique($table, $field, $compared) { ...

Best CMS for doing private site with Charting

I'm really new to website development and for a project I need: No public pages. All private. Login+Password (Users, Admins) Being able to upload XML-files from Android device Parse this XML into something I can plot. Easy charting. Admin users being able to read all sub-users uploads. Doesn't have to look good. No blog-post. Strictly...

WordPress to Static .html solution

I'm looking for a solution that will enable me to use WordPress for site/content management but will export static .html files rather than dynamic database driven files. I've used wp-super cache and it is a step in this direction, however, the speed gains were not quite what I'd like. Any ideas? ...

jQuery wait for ajax call to be over before continuing

Hi all, I have a problem with a jQuery ajax call. I need to wait for the call to be finished in order to return a value. However, the script seems to jump ahead and not wait for the call to be over. my function then returns "undefined". I have tried to use the .ajax() method and set the value of async to false, but this would not work ...

Fatal error on a non-object

Hey, so I have created a function to check the DB for unique entries, but when I call the function it doesn't seem to work and gives me a fatal error any ideas ? Thanks :) //Check for unique entries function checkUnique($table, $field, $compared) { $query = $mysqli->query('SELECT '.$mysqli->real_escape_string($f...

PHP 6.0 - Roadmap?

With the recent announcement that PHP 6 development has been halted, I'm confused as to what the PHP 5.x and 6.x road map includes. The current version of PHP is 5.3.2. There were quite a few significant features to come in PHP 6.0, such as: APC include for automatic bytecode caching Unicode support etc.. Question: What is the new ...

Custom cases of product in Magento?

Setting a Magento store for a winery. They well bottles of wine, but you can only order bottles in cases of wine. There are 12 bottles of wine in a case, and you can make a custom case. So user could pick 4 Chardonnay, 6 Merlot and 2 Shiraz to make a case of 12. But they could not just choose 4 Chardonnay and 6 Merlot. Orders have to b...

What HTTP headers do I need to stream an ASF file?

I have a simple PHP script that will either serve up a streaming ASF file or not, depending on whether you're logged in and have access to the file. It basically does this: <?php header('Content-Type: video/x-ms-asf'); header('Content-Disposition: inline; filename="file.asf"'); readfile('file.asf'); ?> This already works fine in Fir...

Is it possible to add custom fields to a Drupal taxonomy term?

I'd like to add a date field to a drupal taxonomy term, alongside the default "title" and "description" Is there some technique/php/module that lets me do this? Is it possible to do with CCK?? I need to be able to display the new field in the same view presenting the content nodes referencing the term. At the moment, I've added a date...

CodeIgniter - accessing $config variable in view

Pretty often I need to access config variables in views. I know I can pass them from controller to load->view(). But it seems excessive to do it explicitly. Is there some way or trick to access $config variable from CI views without disturbing controllers with spare code? ...

Compare to values of two arrays in PHP

Hi i want to compare all the values of 2 arrays and end up with a true or false . I am using the code below and would of thought that the result would be false . but that is not the case , when the last line runs I would expect a display something like Array ( [0] => 0 ) but I get no display so assume that php is happy that there is no...

Recursing data into a 2 dimensional array in PHP 5

I'm getting bamboozled by "for each" loops and two dimensional arrays, and I'm a php newb so please bear with me (and ignore any variables with the word "image" - it's all about the mp3s, I just didn't change it from the xml tutorial) I found a php function on the net that list files in a directory, the output of which is: Array ( [0...

Generate an image / thumbnail of a webpage using X/Gui-less linux

There exists numerous solutions on generating a thumbnail or an image preview of a webpage. Some of these solutions are webs-based like websnapshots, windows libraries such as PHP's imagegrabscreen (only works on windows), and KDE's wkhtml. Many more do exist. However, I'm looking for a GUI-less solution. Something I can create an API a...

how to get 12 for joel test working in a small team of 3-4 on php website?

Hi, I read this and I was inspired. I am asking for specific help to achieve a 12 for my current project. I am working in a team of 3-4 on a php project that is based on cakephp. I only have a dedicated server running on linux which i intend to have the website live on and i have a plan with assembla where i am using its svn repositor...