php

Problem with SMTP authentication in PHP using PHPMailer, with Pear Mail works

Hi, I´m having trouble sending a e-mail with the PHPMailer class, but it works with PEAR Mail::factory. I guess the problem is with the SMTP authentication, but I couldn´t find the problem. The code with problem is: <?php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail...

Should PHP session be created before login or after successful login

If PHP session is created before login, there will be one session file created for each request to login page. The problem is if user makes multiple requests to server through a script then those many session files will be created. If user wants to attack server,he can send abnormally huge number of requests creating so many session fil...

PHP data access design patterns to complement an ORM

I've currently got a site that depends on an Active Record pattern using the Doctrine ORM in PHP. I'm generally a fan of this approach - it's very straightforward and works well for managing for simple CRUD apps. But as this site grows, I think my need for more robust domain functionality will grow as well. I was wondering what other kin...

Is it possible to take a screenshot of all the visible items displayed on the monitor of a client machine from a sever?

Is it possible to take a screenshot of all the visible items displayed on the monitor of a client machine from a sever? ...

media conversion library/plugin preferably php

I am looking for an media conversion library that can convert and compress various media i.e both audio and video files to various formats. ...

Drupal Templating/Theming Resources or Advice?

I'm interested in creating a custom theme for a Drupal site I'm working on. I am new to Drupal, however I have a decent bit of experience in working with the underlying concepts that it seems are needed to build a theme (CSS, PHP, HTML). So, my question is - where do I start? Is there a canonical guide to creating Drupal themes? Resourc...

What is the best way to "clean" information to be stored in a SQL database?

Scenario: I have a blog that I want to make a post to. I have a form set up where I can write out a blog post and submit it to a seperate php page that then stores it in a database (after it confirms it is me posting) where it will be read from and displayed on the home page. How can I easily escape any quotes or anything that will inte...

PHP store date from loop in varible problem

<?php $sql = mysql_query("SELECT body FROM comments"); while ($r = mysql_fetch_assoc($sql)) { $body .= $r['body']; } ?> <?php echo $body ?><br /> Can someone explain why it prints out all comments without no space? It prints out all my entries but they are all together. And the <br /> only after the last comment? Thanks! ...

How to read the XSD datetime format in PHP ?

Is there a function, class, or extension in PHP that can handle the XSD datetime format? It's a standard XML date & time format, that looks like this: <date>2008-02-28T07:56:35.263</date> I know I can read it with a regular expression, if no solution is given, I'll default to that. Thanks! PS: Solved, look at the answers. ...

PHP Variable Passing not working in database call.

This works. function get_distinct_size_for_bracelets() { $sql = "SELECT DISTINCT size FROM mytable WHERE id = 27 AND type='plastic' ORDER BY size"; } This does not work and stops php dead with no error reporting. function get_distinct_size_for_bracelets($myvalue) { $sql = "SELECT DISTINCT size FROM mytable WHERE id = 27 AND ...

PHP Mail Client

I have a need to read the 'body' of the most recent email received using PHP (not interested in sender, etc...), but I am not at all sure how to do this. The mail server uses IMAP http://ryerson.ca/ccs/email/rmail/clients/ConfiguringMozillaThunderbird.pdf <--Uses the same server described here. (This is not for my personal mail, its to...

GD - rotating image doesn't work in IE and Opera

I've created a function that rotates defined image. It works perfect in firefox, but in IE and Opera nothing happens - the image is reloaded but not rotated. Does anybody know why? Here goes the code: function rotateImage($direction, $id, $angle) { $dir = opendir($direction); if ($img = imagecreatefromjpeg($_SESSION['files'][$id]['lar...

What does this php construct mean: $html->redirect("URL")?

I've seen this "-> " elsewhere used in php. One of the books I used to learn PHP has this in it, but it is never explained. What does it do, how does it work! The redirect bit I know, but what is happening with the $html variable and the redirect function? Thanks in advance! ...

Breaking away from MVC

Lately I've been trying to improve upon/move away from the standard MVC setup for web development, and I thought it was about time to throw my ideas at StackOverflow. The general flow is the same in that a bootstrapper creates the initial objects. The difference is that these are then kept in a ServiceManager. Then, instead of dispatch...

Custom error messages on doctrine validations

I need to modify default error messages of doctrine validations. How can I do this? thanks ...

Easy way to get day number of current quarter?

PHP provides ways to get the number of the current day of the month (date('j')) as well as the number of the current day of the year (date('z')). Is there a way to get the number of the current day of the current quarter? So right now, August 5, it is day 36 of the third quarter. If there is no standard way of calculating this, does an...

PHP Global Variables

I have a database class, which an instance is declared in the main index.php as $db = new Database(); Is there a way for the $db variable to be globally recognized in all other classes without having to declare global $db; in the constructor of each class? ...

managing curl output in php

How do i hide the output from curl in php? Or modify it? My code as it stands is the following; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_USERPWD, PSSWDINFO); $result= curl_exec ($ch); curl_close ($ch); The problem is that is spews out th...

find occurence of a set of words

Hi, I have a pattern with a small list of words that are illegal to use as nicknames set in a pattern variable like this: $pattern = webmaster|admin|webadmin|sysadmin Using preg_match, how can I achieve so that nicknames with these words are forbidden, but registering something like "admin2" or "thesysadmin" is allowed? This is the...

Emulate/Simulate iPhone Sprinboard behavior in a JS Webpage

Hey, I am looking for a smart way to emulate the iPhone Springboard behavior of changing icon possition. I just want to change few icons on ONE screen. It should be run in JS on a webpage. Any suggestions to start? Thank you very much ...