php

Button Element with Type Submit & PHP Challenges

Recently I change from <input type="button"> to <button> in my forms however the form being processed by PHP wouldn't then submit to the database. Am I missing something in my code? Basically all I have done is changed this: <input type="submit" name="submitAdd" value="Ask Question! " /> To this: <button type="submit" class="btn" n...

PHP: Using SVN subcommands and options in exec() causes "segmentation fault"?

There is something that drives me nuts these days since I cannot continue my work on a project. I've switched to another computer and can't get PHP and svn executable to work together nicely :) $output = ""; $value = ""; exec("/opt/subversion/bin/svn info --username something --password something --non-interactive <REPO_URL> 2>&1", ...

while loop in a while loop

Hello I have a while loop that goes through a table and I echo the results within it, I also have a while loop that looks at a image directory and I can output the paths to images. My problem is I want to output the image path in the other while loop where my html and image tag reside. I have tried putting one while loop inside the othe...

Is it a good idea to combine an Ajax/UI JS Framework (ext,jquery-ui) with an MVC PHP framework (zend, symfony)?

I realize this is a very generic question, but I guess I'm not really looking for a definitive answer. Being new to PHP frameworks I'm having a hard time getting my head around it. Javascript frameworks, especially with UI extensions, seem to have their sort-of MVC-like approach by separating your JS code from your design. It just seem...

[PHP] Translating IMAP body based on their encoding

Hi all, From the manual, I know that there are 6 different transfer encoding in IMAP. At this point, I've created this basic function: function translate_imap_body($body, $encoding) { switch($encoding) { case 0: return $body;break; case 1: return $body;break; case 2: return $body;break; case 3: return base64_decode($body);br...

PHP CASE statement not working with ZERO values.

I don't understand what's happening here. Logically, it doesn't make any sense to me. <?php $level = 0; switch ($level) { case $level > 80: $answer = 'high'; break; case $level > 60: $answer = 'moderate-to-high'; break; case $level > 40: $answer = 'moderate'; break; case $level > 20: $answer = 'low-to-moderate'; break; defau...

What PHP Blogging Software Should I Choose

I am thinking of starting a blog, which I would like integrated into my existing website. I come back empty handed from googling for a comparison of blogging software written in PHP. My requirements: Simple but not rudimentary (not a result of a 15 minute CodeIgniter tutorial) Quality source code (I'd like to be able to learn from it ...

Zend_Mail and =0D=0A=3D=3D=3D=3D=3D

I'm writing a help desk pipe handler to pipe incoming e-mails as helpdesk ticket replies. Some e-mails are coming in perfectly fine, others are coming in as a jumble of the text and =3D's all munged into one giant string. Does anyone have an idea on how to decode that into plain text. For reference, this is my mail parser function: pu...

Renaming files when downloading it

Hello. I want to rename file when user downloads it. Right now, I'm sending content-disposition and content-length headers and then send file to user with fpassthru PHP function. But there is 3 problems with this method: If I'm sending big (above 3-4Gb) files this way, then my PHP script runs too much time and may be killed by timeou...

Tracking the views of a given row

Hi there, I have a site where the users can view quite a large number of posts. Every time this is done I run a query similar to UPDATE table SET views=views+1 WHERE id = ?. However, there are a number of disadvantages to this approach: There is no way of tracking when the pageviews occur - they are simply incremented. Updating the ta...

Using Swift Mailer AntiFlood Plugin or Throttler Plugin with Symfony 1.3

What is the syntax for the using Swift Mailer Plugins in Symfony 1.3? Its not: $email = $this->getMailer()->compose(); $email->setSubject($subject); $email->setFrom($from); $email->setTo($to); $email->setBody($body, 'text/html'); $email->addPart($plain, 'text/plain'); $email->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30)); ...

Magento Fatal Error: Call to member function getSku() on a non-object

I have come across a bizarre error in the Magento shop I'm developing and despite my inquiries online, it appears no one else has ever seen this exact error under the same circumstances. Lemme 'splain. The full text of the error message is this: Fatal error: Call to a member function getSku() on a non-object in /path/on/server/app/code...

Script that will quit out every 5 minutes then renew itself where it left off

Hey all, I've got a UNIX question... I have a PHP script that I run in the terminal that parses a bunch of images and puts them in the database. This script has already been written Due to restrictions on my hosting (Bluehost) I cannot run a process for more than 5ish minutes. I'm wondering how to set it up so that I will quit out of t...

Multi Part Form with AJAX in php/codeigniter

I am trying to create a multi page listing form (using AJAX - jquery) for a real estate site. The basic premise is that a user should be able to create a listing in step 1 of the form. In step 2 of the form, the user should now be able to upload images/video. In step 3 of the form, the user would add any additional information related to...

Php exit function question

I have noticed a behavior in PHP that makes sense, but I am unsure how to get around it. I have a long script, something like this <?php if ( file_exists("custom_version_of_this_file.php") ) { require_once "custom_version_of_this_file.php"; exit; } // a bunch of code etc function x () { // does something } ?> Interestin...

How do I look for “ and ” in php using preg_match?

I've been using "/x{201C}/u" and "/x{201D}/u" to match them, but there's no result. Am I doing something wrong?? ...

PHP MYSQL Excel to xls ?

This my example code: $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->SetCellValue('A2', '1.0'); $objPHPExcel->getActiveSheet()->SetCellValue('B2', '0.0'); $objPHPExcel->getActiveSheet()->SetCellValue('C2', '1.2'); $objPHPExcel->getActiveSheet()->SetCellValue('D2', '100'); Iam getting in excel sheet is round off v...

To set custom error message in sfValidator?

How to add a custom error message in sfValidator, the form is $this->setWidgets(array( 'name' =>new sfWidgetFormInput(), 'country' =>new sfWidgetFormChoice(array('choices' => CountriesPeer::getAllCountries())), )); the validators $this->setValidators(array( 'name' =>new sfValidatorString(array('required'=>true)), 'country'...

Double plusses in regex

I have seen several regular expressions that have two plusses in a row. What exactly does this mean? One or more of one or more of the pattern. If the pattern matches in the first place, why would the second match be necessary? Examples: [a-zA-Z0-9_]++ [^/.,;?]++ ...

MYSQL server has gone away

Hello All, I am using WAMP server for my web application . Sometimes I see this General error: 2006 MySQL server has gone away' I am updating the MySQL database through PDO PHP. Any suggestions to avoid this ? ...