php

Determine Current Controller in Use for Kohana

What is the best way to determine which Controller class a Kohana application is presently using? Examples: http://sitesite.com/ - _defaultControllerName_ http://somesite.com/frontpage/articles - "frontpage" http://somesite.com/contact/ - "contact" ...

Need a Suggestion for a Good Class to use for Form display and validation (PHP)

Thanks in advance, I am looking for a good way to make forms in php. I don't want to have to create all the items in html and want it to look good, be easily validated, and in general be easy to work with. Suggestions. ...

Zend Framework PDF multiline problems

I have a problem, with Zend_PDF multiline, my problem is that I can't write the entire text to my pdf.My text looks like this: http://pastebin.com/f6413f664 But when I open my .pdf file, the text looks like this: http://screencast.com/t/1CBjvRodeZQd And here is my code: public function pdfAction() { $this->_helper->layout->disab...

[Zend Framework] Redirecting user back to originally desired URL after login

Example: User is not logged in User has items in their shopping cart User goes to /checkout User is redirected to the /login page User logs in successfully and should be redirected back to the /checkout page How does the login action know to redirect the user to checkout in this case? I want this to work in many different situation...

php_printer.dll & IIS

PHP 5.2.5 Microsoft IIS 6.0 Windows Server 2003 R2 I have just enabled php_printer.dll in my php.ini file, and it works correctly from the command line. However, running the same commands within a script running on IIS gives me a "call to undefined function printer_open() ...". My boss says we shouldn't have to restart IIS to get it t...

PHP Bulk Email - Dedicated IP Max?

Hi Is there any way i can send out about 3000+ emails from one php script request without overloading a dedicated IP... the max would be 500 per hour? If you dont get me.. here is detailed :) I can only send out 500 emails via the mail() function in PHP per hour via my dedicated IP, is there any way i could send out for example 3000 ro...

How can I send an email with attachments from a PHP form?

How can I send an email with attachments from a PHP form? ...

[PHP] Validate username as alphanumeric with underscores

On my registration page I need to validate the usernames as alphanumeric only, but also with optional underscores. I've come up with this: function validate_alphanumeric_underscore($str) { return preg_match('/^\w+$/',$str); } Which seems to work okay, but I'm not a regex expert! Does anyone spot any problem? ...

Subscriptions - How to handle large content and subscriptions amount?

Hello, I am sending notification to my users depending on what kind of subscription each user has. For example: User A subscribed to all news articles User B subscribed to all comments User C subscribed to everything that is new on the site I have a script running every 5 minutes (unless the script is still running) who does the fo...

Opinion Polling and PHP

Okay, so I want to make a polling site but it doesn't work like a typical poll. Here's how I would like mine to operate: User registers and is sent confirmation email Once they confirm they can log in From there they get to one giant poll with several topics but apposed to choosing one topic, they would have 20 or so "tokens" where the...

Function turns into an endless loop

I have a problem with a function I have written in php. As you can see the function uses itself to return an array of the values. public function getRepeat($day = "array") { if ($day == 'array') {//Return an array with the repeated days as values foreach (array(1,2,3,4,5,6,0) as $value) { if ($this->getRepeat($value)) {...

How can I replace a variable in a get query in PHP?

I have an URL http://test.com/test?xyz=27373&page=4&test=5 which I want to tranform by replacing the page=4 through page=XYZ how can I do that with preg_replace? ...

Uniquely identify one computer

I work for a university, and i'm implementing a PHP web app that needs to have different behavior when it is visited from one certain computer. The problem i am running into is that from the webserver, using $_SERVER['REMOTE_ADDR'] and gethostbyaddr(), i can only identify the router that a computer is going through, and not a specific c...

Admin Log-In Development

I am developing the ability for administrators to log in and I'm to the point of creating the admin log-in page, but I'm somewhat torn as to where the best place to put it. For details, this is part of an MVC framework, and the administration portion is in it's own folder - /admin; so administration is completely separate from the publi...

Generated html code is not click-able

Help me please i'm a newbie in ajax and framework jQuery , i make in jQuery a page , with different plugins a page , but when i receive html code from ajax ,and is not click-able , i used a function live() , but only helped on plugin delete , with edit plugin is not working , what can be the problem... This is script for editing <...

Can sqlite load individual tables from individual files?

I've heard that SQLite can do this (to avoid synchronicity issues in heavy traffic scenarios) is this true? If so how would I do this with PDO in PHP? ...

weird error in php and mysql

$result=mysql_query("SELECT * FROM playerlocations WHERE player<>'0'"); $returntext=""; while($row=mysql_fetch_array($result)) { if($returntext!=""){$returntext.="&";} $returntext.=$row['player']."#".$row['locations']; } the error message claims that $result isn't a valid result set. I tested it in phpmyadmin, and it worked. I don't ...

Given a background color, black or white text?

I'm trying to find a method for determining whether to use black or white text, given a background color (as a hex value). Has anyone dealt with this before? Is there an effective way to do this? In my case, I would be using PHP to implement the logic (though any experience with this in other languages is welcome). ...

How to speed up php simplexml

I have some code that utilizes simplexml to retrieve some data. I perform about 4 functions that each use simplexml, per entry in a database. So if i have 4 entries in the database, im running simplexml 16 times to load that content. Problem is that it takes about a quarter of a second or so to load each item, so as the page loads, it ...

PHP File Permissions... getting it "write"?

Hi there, I am trying to write an install script for a system I have been working on. The script copies some default files from one location to another, and creates various folders for them. I have this bit working a treat, but the only problem is that when I login via FTP, I can't edit, or delete the files that PHP has moved for me. ...