php

Best practice for error handling in codeigniter / php apps

Hi everyone, We're working with a new codeigniter based application that are cross referencing different PHP functions forwards and backwards from various libraries, models and such. We're running PHP5 on the server and we try to find a good way for managing errors and status reports that arises from the usage of our functions. While ...

Flex service in debug

Hello everybody, I am trying to learn the new services method in flex 4. but i can´t get it work. A test oparation near the service in flash builder 4 works. But when i run the code i get NetConnection.Call.Failed: HTTP: Failed. Does somebody knows what the problem can be? Tom CODE: PHP <?php class AuthService { public funct...

Average Rating script

I have asked this once before but i didnt get a very clear answer. I need to know how to make a rating script for a site. I have a form that submits a rating out of ten to mysql. How would you get the average rating to be displayed from the mysql column using php? One person suggested having two tables; one for all the ratings, and one...

PHP PDO bindValue() weird problem

<?php try { $db = new PDO("mysql:host=localhost;dbname=DBNAME", "USER", "PASSWD"); $stmt = $db->prepare("SELECT id, name FROM testdb ORDER BY time DESC LIMIT :index, 10"); $stmt->bindValue(":index", $_GET['index'], PDO::PARAM_INT); $stmt->execute(); while( $r = $stmt->fetch(PDO::FETCH_ASSOC) ) { echo var...

how are association, aggregation and composition written?

i have read some posts about the differences between these 3 relationships and i think i get the point. i just wonder, are all these written the same when coding? question 1: all 3 are just a value of the object type in a instance variable? class A { public $b = '' public function __construct($object) { $this->b = $o...

Is this the correct syntax for 'array_unique()' in PHP?

I want to get rid of duplicates in my array but I'm still printing duplicates with this: $getuser = ltrim($top10['url'], " users/" ); //trim url to get user id $array[$i++] = $getuser; $dirty = $array; $clean = array_unique($dirty); print_r($clean)."<br />"; Input print_r($array) Array ( [0] => 33 [1] => 3 [2] => 29 [3] => 3104 ...

Show composition/aggregation/association relations between objects in Visual Paradigm UML diagrams?

I have Netbeans installed with Visual Paradigm plugin. I have converted my php code into UML diagrams (modeling -> instant reverse). I can see relations (drawn lines) between superclass and subclasses. However, i cannot see relations between objects inside objects (composition/aggregation/association)? The code looks like: class Threa...

frameworks for coding a php library?

there are plenty of frameworks for coding MVC web applications. this time im going to code a library (think of Doctrine or Solr) with a bunch of class files. u just include a bootstrap or a class file and you are ready to use my classes. i have never tried to code a library before and intend to code one for learning purpose so that i c...

Regular expression help

in twitter when you write @moustafa will change to <a href='user/moustafa'>@moustafa</a> now i want make the same thing when write @moustafa + space its change @moustafa only ...

Drupal timezone information

In my drupal installation I can get the offset from UTC in seconds to the timezone I specified in the admin panel using variable_get('date_default_timezone', 0) However, now that we have daylight-saving-time, the time I get is always off by one hour. Is there a way to retrieve the actual timezone string from Drupal, as "Europe/Berlin...

Hide Referer (PHP, or HTML, or JS Doesn't matter)

Hi, I'm using something like this mysite.com/out.php?url=outurl.com I'm just using a simple redirect, but I'm just wondering how I can hide the referrer. Thanks! edit: I ended up doing a double meta refresh ...

I want the actual file name that is returned by a PHP script

I am writing a python script that downloads a file given by a URL. Unfortuneatly the URL is in the form of a PHP script i.e. www.website.com/generatefilename.php?file=5233 If you visit the link in a browser, you are prompted to download the actual file and extension. I need to send this link to the downloader, but I can't send the downl...

page sends file to curl i want to get download link insted

there is a page that i need to post a password to it and then i get a file to download. the post goes to the same page address its loads again and pop up the download manager (download starts automatically). now i want to do the same but in curl, i posted the data to the url and then its sends me the file back but i don't want my script ...

Hex web colours

Hi I am displaying a colour as a hex value in php . Is it possible to vary the shade of colour by subtracting a number from the hex value ? What I want to do it display vivid web safe colour but if selected I want to dull or lighten the colour. I know I can just use two shades of colour but I could hundred of potential colours . to be ...

PHP Sessions data lost when changing directory?

I've got a simple login system using PHP sessions, but just recently it seems that if you visit pages not in a certain directory (/login/) you will always be flagged as not logged in, even when you are. It seems that my session data is being lost when I change directories (say, to /login/user/). I don't think I've touched the code myse...

Patterns for dynamic CMS components (event driven?)

Sorry my title is not great, this is my first real punt at moving 100% to OO as I've been procedural for more years than I can remember. I'm finding it hard to understand if what I'm trying to do is possible. Depending on people's thoughts on the 2 following points, I'll go down that route. The CMS I'm putting together is quote small, h...

Does CakePHP have built-in functions to check for MySQL injections?

Does CakePHP check inputs to see if they are valid and not injections? If not, how would I go about implementing functions to check inputs? Most of Cake's processes are done behind the scenes, so I'm unsure of where I would do that. ...

MySQL order by error in PHP

Hi, I'm making a simple cms system for a site I'm making for non-tech users to edit... So far so good but when I try and run this code I keep getting: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''pages' ORDER BY 'pages'.'pageOrder' ASC LIMIT 0 ,...

PHP to Mesh 2 PDF'S Together or not?

I have an already pre-designed PDF, and I would like to fill the PDF with some database information. So I'm curious if I should save the PDF into JPG's and render them out with the data on top of the image and re-create a PDF. Or is there a way to use the PDF already, and print data into the PDF that is already made? I am trying to fi...

PHP / SquidGuard / SSH2_EXEC : file creation error

Hello and thanks to read me. I've got a problem with the creation of a squidGuard.conf file. I'm using php in order to create a conf file. This one is well created and his content is right. But when squid try to use it, it find an error. The problem is the fact that there is no error. If i open the file with VI, delete an empty line a...