php

Securing user-data - for use in method calls, SQL and file calls

I am using $_GET, $_POST and $_COOKIE variables in method calls, SQL queries and file calls - and it is necessary to escape / rewrite this user-data for better security (avoid injection attacks and the like). How would you recommend this is done? Some ideas from built-in escape function ... to get the juices flowing: Add backslashes t...

can't get Nusoap server working with cakephp

I am trying to get nusoap server working with cakephp, the problem I am assuming is that the code is within a class (controller) and nusoap is trying to execute 'function()' instead of '$this->function()'. Does anybody know of a simple workaround for this, i don't like modifying 3rd party classes... ...

How to know if MySQLnd is the active driver?

Maybe it's an obvious question, but I want to be sure. How can i know if it MySQLnd is the active driver? I'm runing PHP 5.3 and MySQL 5.1.37. In phpinfo() mysqlnd is listed but only with this I can't be sure if I'm using MySQLnd or the old driver... Extract of phpinfo() output mysql MySQL Support enabled Active Persistent Links ...

Validate before post

Dear Professors! I have this little code (part of my regsitration code) : <?php if (@$_POST['Submit'] == 'Register'){ if (strcmp(md5($_POST['user_code']),$_SESSION['ckey'])) { die("Invalid code entered. Please enter the correct code as shown in the Image"); } } ?> <form name="form1" id="signupForm" metho...

Why would a loaded PHP extension fail on class instantiation?

I have some code which is resizing images, using either Imagick or GD, depending what's available on the server. I'm testing for availability of each using the extension_loaded() function. if (extension_loaded('imagick')) { $image = new Imagick(); ... } I have one user reporting that they are receiving: Fatal error: Class...

Determine the file size before dowloading data through HTTP

Is this possible to do? I'm currently coding in PHP using cURL library but this rather applies to HTTP as a whole. The most obvious way sounded like throwing a HEAD request to the data URL and read its Content-Length header, but the problem is that some servers including apache 2.0 does not send Content-Length against HEAD requests and ...

jQuery: Using PHP/Ajax, insert record and create JS variable from PHP page

I have jQuery Ajax request that sends data to a PHP page that then insert a record into MySQL. With my current setup, this all works fine. However, as part of the PHP script, i use mysql_insert_id() to retreive the ID of the last record. I need the Ajax Success function to return this ID value as a javascript variable. PHP Code if ($_...

Splitting strings and joining the duplicates

I'm trying to create a select box drop down with a twist, Basically this is an Ajax form that when an item is selected from the list it'll add it into a text field. However I also want to add a few extra selections in here. the string I'm getting is made up of COMPANY_SITE_DEPARTMENT and for example SDGCC_NEWTOWN_INBOUND. Using PHP I ...

Pass Data In Memory from PHP to a .Net Program

How to pass data in memory from PHP to a .Net program? I will use Process to call the php.exe, and pass in the script name (*.php) and the arguments. The issue now is how do I pass back the data, from the PHP to the .Net? Specifically, I am looking at the manner in which PHP can pass out the data so that .Net can intercept it. The .Net...

What is the fastest way to do image rotation in PHP without using GD's imagerotate?

I do not have the ability to use PHP's GD imagerotate() function, so I need to find another solution. I used the rotateImage() method found in the comments of the imagerotate() PHP help page, but it is very slow on large images. I am horrible at image math, and am having a hard time formulating the correct Google search to get me pointe...

PHP outputs a normal question mark instead of ‘ or ’

Hi, I'm currently parsing an RSS feed and subparsing the html in the description field in order to create a custom XML structure. In the description field there are ‘ and ’ signs and PHP outputs them as regular question marks. How come? I've tried different encodings like UTF-8 and iso-8859-1 but nothing works.. This is the xml I'm p...

What is the best way to auto generate getters and setters for a class in php?

I regularly create a class that has a few private variables. When an instance of this class is set, it should be possible to fill all variables of the class with getters and setters. Is there an easy way to do this without having to type all these setters and getters for each variable on creation of the class? now i have to type this f...

Upload File Size Limit: Symfony Admin Generator Module

I have form created by the admin generator in the backend of a website. It allows the upload of a video to the site. It works fine but strangely, the upload fails for files of 10mb or over. However, I have not set any file limits in my form. Are there Symfony/PHP/Apache/web browser settings regarding this type of behaviour that I can l...

Layout being rendered twice

I seem to have a problem with my layout displaying twice. I was wondering if this was caused by something in my front controller plugin (see below) which utilises Zend Layout only for a particular module and not in the main application. Any answers will be much appreciated. Thanks class My_Controller_Plugin_AdoptLayout extends Zend_Cont...

How to Implement Paging through JQuery in PHP?

I am developing a site in which i need the search result should be displayed 10 by 10. For that the result should be displayed through JQuery. Please Help. Any Code snippets or references will be highly appreciated. ...

PHP optional function arguments with array. How to code / Better way to code?

I'm sure there is a better to this. Any help will be greatly appreciated. I want to pass an array to a php function that contains the argument and all the arguments are optional. I'm using code ignitor and am by no means an expert. Below is what i have been using so far: function addLinkPost($postDetailArray) { if (isset($postDetail...

How to fetch records from mysql database and display 10 results per page using Jquery Pager Plugin. Please Help

I came to know the Jquery Pager Plugin is nice. But in the demo of that plugin they used only some texts to display in the paging. But I need to display the database recordsets results in paging. I need help Any help will be appreciated ...

How to generate seo friendly url's with php?

Hi, I want to make http://mysite.com/id255/ to http://mysite.com/gora-beach-inn/. My php looks like: $result = mysql_query(" SELECT id, header FROM Article "); while($data = mysql_fetch_assoc($result)){ mysql_query(" UPDATE Article SET seo = '".MakeSeo($data['header'])."' WHERE datum = '".$data['datum']."...

Joomla site on LAMP server behind proxy cannot access HTTP resource stream

Setup: 1. Joomla 1.5 website on a LAMP server (CentOS 5.2/Apache 2.2/PHP 5.2.9/mysql 5) 2. Joomla module for currency conversion added. Module uses google finance to convert currency 3. LAMP stack resides in the intranet behind a proxy. The server environment variables for http_proxy, yum.conf proxy have been setup, and kernel successful...

Magento adding left column in home page

Hi In my magento project left side of the Home page is empty, i want to place an image in left side and also in the middle portion, what are the steps to place these two in my project? Thanks in advance ...