Drupal PHP Yahoo Webhosting Register Globals #16

If you search google (with terms like ‘Drupal Yahoo Hosting’), you will see many people are having troubles to install Drupal under yahoo web-hosting. The issue is with the register_globals (php_ini) variable. They are too frustrated to give up either Drupal or Yahoo Web-hosting. Yahoo did not make the required changes for them (in php.ini). However, the solution (good or bad – you decide) is pretty simple.

Just open the file: /drupal-6.6/modules/system/system.install and change the following line:

$register_globals = trim(ini_get(‘register_globals’));
to
$register_globals = ”;

and you are done. (Drupal – 6.6). [I know – having register_globals to be on is not secure.]

From: http://sitestree.com/?p=5103
Categories:16
Tags:
Post Data:2009-12-16 14:58:23

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

PHP – Coding Style #16

Some web-resources describing PHP coding styles along with documenting styles are provided below.

From: http://sitestree.com/?p=5097
Categories:16
Tags:
Post Data:2006-10-25 10:24:50

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

PHP & MVC #16

From: http://sitestree.com/?p=5096
Categories:16
Tags:
Post Data:2006-08-24 17:42:23

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

How to Install Drupal Ecommerce #16

From: http://sitestree.com/?p=5094
Categories:16
Tags:
Post Data:2010-10-05 14:02:48

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Part 2: How to install PHP/MySQL Development Environment: Eclipse PDT #16

Part 2: How to install PHP/MySQL Development Environment: Eclipse PDT

  1. Video Tutorial on this Topic
  2. Tools required: PHP 5, MySQL 5, MySQL GUI, IIS/Apache, Eclipse PDT
  3. Download software and install them. Mostly unzipping or clicking on setup.exe
  4. Use Windows – add remove programs to install IIS
  5. Configure php.ini for PHP 5 to support MySQL
  6. Configure Eclipse PDT to support PHP. Eclipse PDT is the PHP development IDE
  7. Configure IIS/Apache to support PHP
  8. Configure IIS to setup web-sites pointing to your ongoing web-site projects
  9. Eclipse PDT
    • Create Project: File -> New -> Project -> PHP Project
    • Test a webpage: Click the web-page -> right click -> run as -> as PHP Script/as PHP Web Page
    • Debug a PHP web-page: Click the web-page -> right click -> Debug as -> as PHP Script

From: http://sitestree.com/?p=5083
Categories:16
Tags:
Post Data:2009-03-20 18:42:03

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Comparison among some popular PHP CMSs #16

From: http://sitestree.com/?p=5007
Categories:16
Tags:
Post Data:2009-09-04 15:17:53

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

A Sample PHP Class #16

A sample PHP class is provided below. How the class is used?

When the submit button from the interface (web-page) will be clicked the code in the form-action web-page will call the the create method (static) to create a Ticket data/row in the database table Ticket. The method call will look like Ticket::create(array with field=>value pair, as formed with form submitted data) and you will get an Ticket object created with the inserted row/data.

To update a Ticket, you can create the Ticket object (constructor will do it for you) as you will know the Ticket id at this time. Then use the appropriate set method to update the value in the database.

To search call the static search method with a list/array of field=>value pair.

$dbh (read-only) and $dbhWrite(read-write) are global variables that represent connections to the database.

//represents a customer submitted Ticketclass Ticket{  public $parentTicket;   private $dbh_;  //member variables, named after the column names of the databse table - Ticket  private $id_;   private $type;  private $subject_;  private $timestampCreated_; private $timestampUpdated_; private $status_;   private $parentTicketId_;   private $categoryId_;   private $categoryName_; private $internalNotifylist_;   private $externalNotifyList_;   private $customerId_;   private $customerName_; private $creatorId_;    private $creatorName_;  private $ownerId_;  private $assignedTo_;   //constructor, creates a Ticket object with the table row with id = $id public function  __construct($id)   {       global $dbh;        $this->dbh_ = $dbh;      $this->refreshValues($id);   }   public function refreshValues($id)  {       $query="Select Ticket.*, TicketCategory.name  from Ticket left join TicketCategory on Ticket.categoryId = TicketCategory.id             where Ticket.id=$id";       if ($result=$this->dbh_->query($query))           if($result->num_rows==1)         {               $row=$result->fetch_object();                $this->id_ = $id;                $this->type_=$row->type;              $this->subject_ = $row->subject;              $this->timestampCreated_ = $row->timestampCreated;                $this->timestampUpdated_ = $row->timestampUpdated;                $this->status_ = $row->status;                $this->parentTicketId_ = $row->parentTicketId;                if($this->parentTicketId_>0)                  $this->parentTicket=$row->parentTicketId; //new Ticket($this->parentTicketId_);                else $this->parentTicketId=0;                $this->categoryId_ = $row->categoryId;                $this->categoryName_ = $row->name;                $this->internalNotifyList_ = $row->internalNotifyList;                $this->externalNotifyList_ =$row->externalNotifyList;             $this->customerId_ = $row->customerId;                $this->creatorId_ = $row->creatorId;              $this->ownerId_ =$row->ownerId;               $this->assignedTo_ =$row->assignedTo;             return true;            }           else                return false;   }   //methods to retrieve/set data/member variables //retrieve id   public function getId() {       if($this->id_>0) return $this->id_;        else return false;  }   //set id    public function setId($id)  {       if (is_numeric($id))        {           if ($this->setField('id',$id)) return true;          else return false;      }       else return false;  }   public function getCustomerId() {       if($this->id_>0) return $this->customerId_;        else return false;  }   public function setCustomerId($customerId)  {       if (is_numeric($customerId))        {           if ($this->setField('customerId',$customerId))               return true;            else return false;      }       else return false;  }    //used by methods to set member variables  private function setField($field, $value)   {       $dbhWrite=getDbhWrite();        $query="update Ticket set $field='".$dbhWrite->escape_string($value)."' where id=$this->id_";     $result = $dbhWrite->query($query);      if ($result==true)      {           if($dbhWrite->affected_rows==1)          {               $this->setTimestampUpdated();                $this->refreshValues($this->id_);             return true;            }           else return false;      }       else return false;  }    //used to create an entry into the Ticket table (database).    //After insertion this row is used to form a Table object and returned to the caller    static public function create($fields)  {       $dbhWrite=getDbhWrite();        $timestamp = time();        $parentTicketId='null';     $customerId='null';     $ownerId='null';        $assignedTo='null';     $categoryId='null';     $type='null';       foreach($fields as $field => $value)     {           switch($field)          {               case "type":                    if(self::isPermittedType($value)) $type=$value;                 else return false;                  break;              case "status":                  if(self::isPermittedStatus($value)) $status=$value;                 else return false;                  break;              case "subject":                 if (is_string($value))                      $subject=$dbhWrite->escape_string($value);                   else                        return false;                   break;              case "parentTicketId":                  if(is_numeric($value))                      $parentTicketId=$value;                 break;              case "categoryId":                  if(is_numeric($value))                      $categoryId=$value;                 break;              case "customerId":                  if(is_numeric($value)) $customerId=$value;                  else return false;                  break;              case "creatorId":                   if(is_numeric($value))                      $creatorId=$value;                  else return false;                  break;              case "ownerId":                 if(is_numeric($value))                      $ownerId=$value;                    break;              case "assignedTo":                  if(is_numeric($value))                      $assignedTo=$value;                 break;          }       }       $insertStr = "insert into Ticket (type,subject, timestampCreated, timestampUpdated, status, parentTicketId, categoryId, customerId, creatorId, ownerId, assignedTo) values ($type, '$subject', $timestamp, $timestamp, $status, $parentTicketId, $categoryId, $customerId, $creatorId,$ownerId,$assignedTo)";       $result = $dbhWrite->query($insertStr);      if ($result == true)        {           if ($dbhWrite->affected_rows==1)         {               $ticket=new Ticket($dbhWrite->insert_id);                return $ticket;         }           else return false;      }       else return false;  }   //searches the entire ticket table based on supplied field=>value pairs  static public function searchFields($fields,$orderBy='id')  {       global $dbh;        $query="select * from Ticket where ";       foreach($fields as $field => $value)     {           if($value[0]=="!") //checking for not equal condition           {               $value=substr($value,1);                $query.="`".$dbh->escape_string($field)."`!='".$dbh->escape_string($value)."' and ";          }           else                $query.="`".$dbh->escape_string($field)."`='".$dbh->escape_string($value)."' and ";       }       $query=substr($query,0,-5);     $query.=" order by ".$dbh->escape_string($orderBy);      $result = $dbh->query($query);       if ($result)        {           if ($dbh->affected_rows>0)            {               $tickets = array();             $tickets = Ticket::processResult($result);              return $tickets;            }           else return false;      }       else return false;  }    //used by searchFields method. Converts a set of retrieved data rows into array of objects.    static private function processResult($result)  {       if($result->num_rows >= 1)        {           $tickets=array();           while($row=$result->fetch_object())          {               $tickets[] = new Ticket($row->id);           }           return $tickets;        }       else return false;  }}

From: http://sitestree.com/?p=4808
Categories:16
Tags:
Post Data:2009-10-22 12:58:33

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

PHP Security: Coding that Maintains Security #16

Php Security

PHP can be included as a module to the web-server, or executed as a separate executable binary. In either case, it can access files, execute commands, open network connections in the server. Further, PHP can be used to write scripts with all the power of the shell users. Hence, anything running on that server may face security problems. Though, careful coding will reduce the risks to a great extent[php.net].

Common security risks in PHP[Abdul Basit, php.net]

Most common are :

  • 1-Invalidated Input Errors
  • 2-Access Control Flaws
  • 3-Session ID Protection
  • 4-Cross Site Scripting (XSS) Attacks
  • 5-SQL Injection Vulnerabilities
  • 6-Error Reporting
  • 7-Data Handling Errors
  • 8-PHP configuration settings

PHP Security when installed as a CGI Binary[php.net]

  • Do not place any interpreters into the cgi-bin directory
  • Even If PHP is installed as a standalone binary (and in cgi-bin directory), PHP can prevent attacks that may arise from such setting.
  • Accessing system files: http://my.host/cgi-bin/php?/etc/passwd — using such URLs can be risky, the part after ? may be treated as command line arguments to the interpreter, and hence, in some cases pose risks
  • Accessing any web document on server: http://my.host/cgi-bin/php/secret/doc.html — this way can also be risky

PHP compile time options such as –enable-force-cgi-redirect and runtime configuration directives doc_root and user_dir can be used to prevent such risks.

From: http://sitestree.com/?p=4742
Categories:16
Tags:
Post Data:2008-07-09 01:21:35

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Zend Developer Studio Overview #16

If you are familiar with Eclipse development IDE, then you can learn Zend Developer Studio pretty easily. If you are familiar with programming concepts in general and especially in PHP, then you may need 1-3 days to be good at Zend Developer Studio. You really don’t need 20 years of experience to be able to work effectively with Zend Developer Studio. First, know what are the topics to learn, then learn one by one. It will be mostly common sense.

Concepts to learn in Zend Developer Studio

  • View: Any sub-window to give you information on a topic (application development). Two types: PHP, Explorer view, Outline View
  • Perspective: A collection of similar views to accomplish a specific task
  • Outline View: Tree view of an entity. open/selected entity
  • Working Sets: Collection of files or open projects that you can bind together and give a name
  • Code Editor: Learn the code editor, try to use code completion features, navigation features
  • Learn to create project:
  • Learn different ways and features of creating projects such as:
    • Projects Wizard
    • Zend Framework Project
    • Multiproject Support
    • Setting Up Working Sets
    • Importing Projects
    • Exporting Projects
    • Creating New Files
    • Using Link with Editor
    • Accessing Remote Files
  • Learn to write code under MVC model in Zend framework
  • Learn to use Zend libraries
  • Learn to use classes provided by Zend for MVC type of project development
  • You may want to learn – how to use Zend provided features to access google data, and Zend features for emailing
  • Learn Zend_PDF for PDF file creation and handling, Zend_Service for web-service based application development, Zend_Gdata for google services, Zend_Mail for mailing, Zend_Controller for MVC application development, Zend_Db for database operations, Zend_Acl for access control
  • Learn Zend Framework project structure, folder structure, and how to modify settings [database settings for example]
  • Learn how to update eclipse/zend features from the menu options. Learn how to install new eclipse/zend components.
  • Learn how to install third party plug-ins to eclipse
  • Learn how to install libraries
  • Zend studio also has an interface where you can easily design your web-pages. You have to change your perspective to this editor view (PHP/HTML WYSIWYG).
  • Learn to use a version control software with Zend studio. You may want to use CVSNT (client for CVS). You also need a Version Control Server.
  • You will get version control options under Window->preferences menu option.
  • You can set configuration for files, how they will be handled under version control
  • You also need to learn debugging. How to set debugging parameters (window->preferences). Learn how to debug locally and remotely.
  • Learn how to use debug perspective. How to use different debugging concepts such as step into, step over, run to cursor, breakpoint, watch variables and similar
  • Learn Code Analyzer, Refactoring, and SQL Integration

From: http://sitestree.com/?p=4708
Categories:16
Tags:
Post Data:2008-03-03 20:32:04

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Zend Tools for PHP Web-Application Development #16

“Zend Technologies is the leading provider of products and services for developing, deploying and managing business-critical PHP applications. The mission of Zend Technologies is to enable PHP as a world-class language for large-scale enterprise development solutions. [www.zend.com]”

  • PHP Application Server: Solutions for Business Critical PHP: http://www.zend.com/en/products/platform/
  • Zend Developer Studio for RIA: http://www.zend.com/en/products/studio/: http://www.zend.com/en/products/studio/
  • Production ready PHP: The PHP Stack for Serious Professionals: Stable and Extended PHP: http://www.zend.com/en/products/core/
  • Zend Guard: PHP encryption product: http://www.zend.com/en/products/guard/
  • Zend Optimizer: Zend Optimizer The Free Runtime for Zend Guard

From: http://sitestree.com/?p=4707
Categories:16
Tags:
Post Data:2010-01-03 06:03:51

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>