Tag Archive: PHP


PHP Turn On Error Reporting

ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);

多款PHP开源网店程序的对比

from http://bbs.eblhost.cn/redirect.php?tid=174&goto=lastpost#lastpost

对于开源的系统最大的优点当然是免费,而且可以根据自己的需要选择插件,以适应自己的需要。但有一个前提,目前国内很多年谓开源的商城系统其实是要收费。其中都有一个条款就是大意是不能用于商业用途,作为电子商务软件不用于商业用途又能有什么用?真的用来学习编程吗?但国外的这几款开源的网店系统却真的是免费的,可以用于建设你的独立网店而无需付费。

以下是对多款开源网店的性能与各种参数进行一系列的对比,希望各位从中可以选出适合自己的网店系统。ECShop作为国内商城系统的代表也列入其中以作比较。(以下表格内容来源自网络收集)

从各软件特性分析

(中文语言、授权方式、系统功能、搜索引擎、模板、用户数量)

软件名称 Magento ECShop osCommerce Zen Cart Freeway
中文语言 支持繁体中文 支持 支持 支持 不支持
授权方式 OPL 协议 免费 GPL 协议 付费 GPL 协议免费 GPL 协议 免费 GPL 协议 免费
系统性能 速度中等 速度中等 速度中等 速度快 速度快
搜索引擎
模版 模板数量多

界面颜色丰富

模板数量多

界面颜色丰富

模块数量中等

界面颜色丰富

模块数量中等

界面颜色丰富

模板数量偏少

界面颜色较少

用户数量 国内中等

国外最多

国内最多

国外少

国内中等

国外较多

国内较少

国外最多

国内少

国外较多

从各软件功能分析

(购物车、商品管理、商品属性、订单处理、促销、支付接口、运输、报表统计、广告管理、CMS)

功能 magento Ecshop Oscommerce Zen cart Freeway
购物车 可不注册会员购买 必须注册会员才可购买 可不注册会员购买 可不注册会员购买 可不注册会员购买
商品管理 商品评论、

属性控制、

标签管理 、

商品库存、

商品图片、

制造厂商、商品评论、

特价商品、商品预告、

商品回收站、商品批量上传修改

生成商品代码、比商品自动上下架

标签管理、图片批量处理等、

制造厂商

商品评论

特价商品

商品预告

商品分类

商品分类、商品类型、价格管理

选项名称、选项内容、属性控制

下载管理、厂商管理、评论管理

特价商品、推荐管理、促销商品

即将上市商品、快速更新等、

商品类型、价格管理、

选项名称、厂商管理、

商品评论

商品属性 商品类型、属性分组,

商品排序

商品类型、属性分组

属性值的录入方式、可选值列表

商品排序

商品类型、

属性分组、

商品类型、属性分组,

属性值的录入方式、

可选值列表、商品排序

商品类型、

属性分类(如:厂商)

订单处理 订单列表、订单查询、

合并订单、添加订单、

订单列表、订单查询、

合并订单、订单打印

缺货登记、添加订单、

订单查询

缺货登记

添加订单等

订单查询、合并订单、

订单打印、添加订单、等

订单查询、订单打印、

添加订单、等

促销 优惠券、

商品价格优惠百分比、

固定金额优惠、

整个购物车固定金额优惠

夺宝奇兵、红包类型

商品包装、祝福贺卡、

团购活动、专题管理、

拍卖活动、优惠活动、等

按订购总额折扣优惠、

按具体产品订购量折扣优惠

优惠券、

优惠活动(特价商品)

免费赠品、批量优惠、

暂无
支付接口

(都添加插件,自选支付接口)

Paypal 贝宝、

支付宝、网银在线等多种支付方式

Paypal 贝宝、

网银在线、支付宝、

QQ 财富通等十多种支付网关

环迅 IPS 、收汇Ctopay

网银在线     、 NPS 支付

支付宝 等

支付宝、快钱、网银在线、

贝宝、 iePay 、 NPS 、

环讯 IPS 、电信支付、首信

iePay 、网银在线、

等多种支付方式

运输 快递( UPS )、

平邮、 EMS 、

上门取货、 EMS 、

平邮、运费到付、

邮政挂号印刷品

快递、平邮、

EMS 、等

快递、平邮、(联合邮政 UPS 、美国邮政 UPS 、) EMS 快递、平邮、 EMS 、等
报表

( 统计 )

销售统计、

客户统计、

搜索引擎、

流量统计

评论统计

流量分析、客户统计、

销售统计、会员排行统计、

搜索引擎、销售排行统计、

搜索引擎、站外投放 JS

流量分析、客户统计

销售统计

客户购买排行榜

访问统计、销售统计、

订单统计、商品库存、

客户推荐、销售分析、

待付订单、现金统计、

访问统计、

订单统计、

客户统计、

销售统计

广告管理 广告列表、广告位置 显示广告,广告横幅 广告组别、广告排序、广告显示状态、
CMS

(内容管理系统)

支持 不支持 不支持 不支持 支持

Browser Capabilities Project

from http://browsers.garykeith.com/downloads.asp

Just a short note of php browser capabilities project to do browser detection

<?
session_start
();
$_SESSION['mySession'] = "hello";

header ("Location: xpage.php");
exit();
//This sentence do the magic
?>

[notice] child pid 4005 exit signal Segmentation fault (11)
If you read this from the httpd log, please check that whether you have the following running at the same time:

  1. Zend Optimizer
  2. apc
  3. eAccelerator

If yes, disable and only leave one running.

set_time_limit(0);

function _rand() {

$length=26;

$chars = “0123456789abcdefghijklmnopqrstuvwxyz”;

$max = strlen($chars) – 1;

mt_srand((double)microtime() * 1000000);

$string = ;

for($i = 0; $i < $length; $i++) {

$string .= $chars[mt_rand(0, $max)];

}

return $string;

}

$HTTP_SESSION=_rand();

echo $HTTP_SESSION;

$HTTP_Server=“www.baidu.com”;

$HTTP_URL=“/”;

$ch = curl_init();

curl_setopt ($ch,CURLOPT_URL,“http://”.$HTTP_Server.$HTTP_URL);

curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

curl_setopt($ch,CURLOPT_USERAGENT,“Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)”);

//curl_setopt($ch,CURLOPT_COOKIE,$HTTP_SESSION);

$res = curl_exec($ch);

curl_close ($ch);

print_r($res);

From http://www.php.net/manual/en/function.fread.php#84115

I couldn't get some of the previous resume scripts to work with Free Download Manager or Firefox. I did some clean up and modified the code a little.

Changes:
1. Added a Flag to specify if you want download to be resumable or not
2. Some error checking and data cleanup for invalid/multiple ranges based on http://tools.ietf.org/id/draft-ietf-http-range-retrieval-00.txt
3. Always calculate a $seek_end even though the range specification says it could be empty... eg: bytes 500-/1234
4. Removed some Cache headers that didn't seem to be needed. (add back if you have problems)
5. Only send partial content header if downloading a piece of the file (IE workaround)

<?php

function dl_file_resumable($file, $is_resume=TRUE)
{
//First, see if the file exists
if (!is_file($file))
{
die(
"<b>404 File not found!</b>");
}

//Gather relevent info about file
$size = filesize($file);
$fileinfo = pathinfo($file);

//workaround for IE filename bug with multiple periods / multiple dots in filename
//that adds square brackets to filename - eg. setup.abc.exe becomes setup[1].abc.exe
$filename = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ?
preg_replace('/\./', '%2e', $fileinfo['basename'], substr_count($fileinfo['basename'], '.') - 1) :
$fileinfo['basename'];

$file_extension = strtolower($path_info['extension']);

//This will set the Content-Type to the appropriate setting for the file
switch($file_extension)
{
case
'exe': $ctype='application/octet-stream'; break;
case
'zip': $ctype='application/zip'; break;
case
'mp3': $ctype='audio/mpeg'; break;
case
'mpg': $ctype='video/mpeg'; break;
case
'avi': $ctype='video/x-msvideo'; break;
default:
$ctype='application/force-download';
}

//check if http_range is sent by browser (or download manager)
if($is_resume && isset($_SERVER['HTTP_RANGE']))
{
list(
$size_unit, $range_orig) = explode('=', $_SERVER['HTTP_RANGE'], 2);

if ($size_unit == 'bytes')
{
//multiple ranges could be specified at the same time, but for simplicity only serve the first range
//http://tools.ietf.org/id/draft-ietf-http-range-retrieval-00.txt
list($range, $extra_ranges) = explode(',', $range_orig, 2);
}
else
{
$range = '';
}
}
else
{
$range = '';
}

//figure out download piece from range (if set)
list($seek_start, $seek_end) = explode('-', $range, 2);

//set start and end based on range (if set), else set defaults
//also check for invalid ranges.
$seek_end = (empty($seek_end)) ? ($size - 1) : min(abs(intval($seek_end)),($size - 1));
$seek_start = (empty($seek_start) || $seek_end < abs(intval($seek_start))) ? 0 : max(abs(intval($seek_start)),0);

//add headers if resumable
if ($is_resume)
{
//Only send partial content header if downloading a piece of the file (IE workaround)
if ($seek_start > 0 || $seek_end < ($size - 1))
{
header('HTTP/1.1 206 Partial Content');
}

header('Accept-Ranges: bytes');
header('Content-Range: bytes '.$seek_start.'-'.$seek_end.'/'.$size);
}

//headers for IE Bugs (is this necessary?)
//header("Cache-Control: cache, must-revalidate");
//header("Pragma: public");

header('Content-Type: ' . $ctype);
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Content-Length: '.($seek_end - $seek_start + 1));

//open the file
$fp = fopen($file, 'rb');
//seek to start of missing part
fseek($fp, $seek_start);

//start buffered download
while(!feof($fp))
{
//reset time limit for big files
set_time_limit(0);
print(
fread($fp, 1024*8));
flush();
ob_flush();
}

fclose($fp);
exit;
}

?>

From http://www.phpbb.com/community/viewtopic.php?f=64&t=993475

Scenario:

I have one existing system with a “user” table. The key elements of this table:

UserID > Auto increment primary key
Email > varchar with unique constraint; this also acts as the login for the “website”
Password > varchar
IsActive > integer for storing user’s “active” status (null or 1)

I also have a fresh phpbb3 installation into which i need to integrate the website users.

I also have to create a list of categories and forums that match the structure of my main websites main categories and sub-categories – a 1 to 1 match. I will discuss this if necessary.

Additional task: I have to integrate the website’s interface elements into the phpbb theme. I used simple approach. I will probably not discuss it as there are very easy solutions already available.

Mapping:

Have to create mapping between the users inside the two tables. These will be referred as:

user (website users)
- and -
phpbb_user (phpbb users)

The question, how should I map website users onto phpbb users? There are many ways to do this. I chose the simplest one to implement. Map user.UserID to phpbb_users.user_id. This way a user can always be looked up into phpbb users and vice versa.

There is one problem however. PHPBB3 fresh installation creates about 50 users by default. These include the super administrator, anonymous and search bots. That means user_id 1 to 50 are unavailable.

I could have created 50 fake users in the user table so that any further website users can be mapped properly. However, I already had about 250+ users by the time integration was supposed to be made. So I chose to map by adding a constant – 1000. So:

Website user #1 becomes phpbb user #1001
Website user #2 becomes phpbb user #1002

and so on.

This way I don’t have to run any lookup queries when I have for find phpbb user given website user id and vice versa.

Drawback:

The process creates clones of website users inside phpbb. It should not go the other way round. So, before integration you should disable phpbb “registration”. You can do this from the phpbb admin section. When you do this, no new user can “register” him/herself. The registration should be done on the main website. Later in the discussion i will provide the hack for creating the user.

Next step is to write functions that ease the task of importing the users. While we are on it, it is also desirable to create another function that synchronizes information of existing users. For example, if someone changes his/her email address on the main website, we should have the mechanism that copies the change into the corresponding phpbb user record. These the fields I am interested in:

Email, Password, IsActive

There may be other fields too but in my scenario, there aren’t any. I am not storing persons age, date of birth, aim/icq information, location, work information etc. I’ll leave it on phpbb user control panel to allow user to edit phpbb related information.

Besides creating new users, the function must place the newly created user in registered users group. I also hacked into phpbb code to find out there are a few other things that are done when a user is created. Usually the default group settings are copied into the the user record.

Note: The way I am implementing the integration it is *not necessary* to create a clone of user into phpbb immediately upon registration although this is a good idea.

Next step is to write functions that ease the task of importing the users. While we are on it, it is also desirable to create another function that synchronizes information of existing users. For example, if someone changes his/her email address on the main website, we should have the mechanism that copies the change into the corresponding phpbb user record. These the fields I am interested in:

Email, Password, IsActive

There may be other fields too but in my scenario, there aren’t any. I am not storing persons age, date of birth, aim/icq information, location, work information etc. I’ll leave it on phpbb user control panel to allow user to edit phpbb related information.

Besides creating new users, the function must place the newly created user in registered users group. I also hacked into phpbb code to find out there are a few other things that are done when a user is created. Usually the default group settings are copied into the the user record.

Note: The way I am implementing the integration it is *not necessary* to create a clone of user into phpbb immediately upon registration although this is a good idea.

function phpbb_synchronize_user( $UserID, $Email, $Password, $IsActive )
{
global $cn1;
$message = array( );
$librium_default_group_id = 2;
static $phpbb_config;
static $group_config;
if ( is_array( $phpbb_config ) == false )
{
$phpbb_config = array( );
$query = "SELECT config_name, config_value FROM phpbb_config";
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
while ( $myrow = mysql_fetch_assoc( $ident ) )
{
$phpbb_config[ $myrow[ "config_name" ] ] = $myrow[ "config_value" ];
}
}
if ( is_array( $group_config ) == false )
{
$query = sprintf( "SELECT group_id, group_colour, group_rank, group_avatar, group_avatar_type, group_avatar_width, group_avatar_height FROM phpbb_groups WHERE group_id = %d", $librium_default_group_id );
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
$group_config = mysql_fetch_assoc( $ident );
}
$bbuser_newid = $UserID + 1000;
$bbuser_email = strtolower( $Email );
$bbuser_passw = $Password;
$bbuser_class = $IsActive ? 0 : 1;
$bbuser_login = $bbuser_email;
$bbuser_login = explode( "@", $bbuser_login );
$bbuser_login = $bbuser_login[ 0 ];
$bbuser_login = preg_replace( "/[^a-z0-9]/i", "", $bbuser_login );
$bbuser_login = $bbuser_login . $bbuser_newid;
$query = sprintf( "SELECT username, username_clean, user_type FROM phpbb_users WHERE user_id = %d", $bbuser_newid );
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
$myrow = mysql_fetch_assoc( $ident );
if ( $myrow === false )
{
$dataarray = array( );
$dataarray[ "user_id" ] = $bbuser_newid;
$dataarray[ "user_email" ] = $bbuser_email;
$dataarray[ "user_email_hash" ] = crc32( $bbuser_email ) . strlen( $bbuser_email );
$dataarray[ "user_password" ] = md5( $bbuser_passw );
$dataarray[ "username" ] = $bbuser_login;
$dataarray[ "username_clean" ] = $bbuser_login;
$dataarray[ "group_id" ] = $librium_default_group_id;
$dataarray[ "user_type" ] = $bbuser_class;
$dataarray[ "user_colour" ] = $group_config[ "group_colour" ];
$dataarray[ "user_rank" ] = $group_config[ "group_rank" ];
$dataarray[ "user_avatar" ] = $group_config[ "group_avatar" ];
$dataarray[ "user_avatar_type" ] = $group_config[ "group_avatar_type" ];
$dataarray[ "user_avatar_width" ] = $group_config[ "group_avatar_width" ];
$dataarray[ "user_avatar_height" ] = $group_config[ "group_avatar_height" ];
$dataarray[ "user_lang" ] = $phpbb_config[ "default_lang" ];
$dataarray[ "user_timezone" ] = $phpbb_config[ "board_timezone" ];
$dataarray[ "user_dst" ] = $phpbb_config[ "board_dst" ];
$dataarray[ "user_dateformat" ] = $phpbb_config[ "default_dateformat" ];
$dataarray[ "user_style" ] = $phpbb_config[ "default_style" ];
$dataarray[ "user_actkey" ] = "";
$dataarray[ "user_allow_massemail" ] = 1;
$dataarray[ "user_allow_pm" ] = 1;
$dataarray[ "user_allow_viewemail" ] = 1;
$dataarray[ "user_allow_viewonline" ] = 1;
$dataarray[ "user_emailtime" ] = 0;
$dataarray[ "user_full_folder" ] = -3;
$dataarray[ "user_inactive_reason" ] = $bbuser_class ? 3 : 0;
$dataarray[ "user_inactive_time" ] = $bbuser_class ? time( ) : 0;
$dataarray[ "user_interests" ] = "";
$dataarray[ "user_ip" ] = "";
$dataarray[ "user_last_privmsg" ] = 0;
$dataarray[ "user_lastmark" ] = time( );
$dataarray[ "user_lastpage" ] = "";
$dataarray[ "user_lastpost_time" ] = 0;
$dataarray[ "user_lastvisit" ] = 0;
$dataarray[ "user_message_rules" ] = 0;
$dataarray[ "user_new_privmsg" ] = 0;
$dataarray[ "user_notify" ] = 0;
$dataarray[ "user_notify_pm" ] = 1;
$dataarray[ "user_notify_type" ] = 0;
$dataarray[ "user_occ" ] = "";
$dataarray[ "user_options" ] = 895;
$dataarray[ "user_pass_convert" ] = 0;
$dataarray[ "user_permissions" ] = "";
$dataarray[ "user_posts" ] = 0;
$dataarray[ "user_sig" ] = "";
$dataarray[ "user_sig_bbcode_bitfield" ] = "";
$dataarray[ "user_sig_bbcode_uid" ] = "";
$dataarray[ "user_unread_privmsg" ] = 0;
$dataarray[ "user_regdate" ] = time( );
$dataarray[ "user_passchg" ] = time( );
$dataarray[ "user_form_salt" ] = substr( md5( microtime( ) ), 4, 16 );
$query = "";
foreach ( $dataarray as $column => $value )
{
if ( $query == "" )
{
$query .= "INSERT phpbb_users SET ";
}
else
{
$query .= ", ";
}
$query .= sprintf( "%s = '%s'", $column, addslashes( $value ) );
}
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
$message[ ] = sprintf( "Created user <b>%s</b>", rtext( $bbuser_login ) );
$query = sprintf( "
INSERT INTO phpbb_user_group
( group_id, user_id, group_leader, user_pending )
VALUES
( %d, %d, 0, 0 )
", $librium_default_group_id, $bbuser_newid
);
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
$message[ ] = "&rsaquo; Assigned user to registered users group";
}
else
{
$dataarray = array( );
$dataarray[ "user_email" ] = $bbuser_email;
$dataarray[ "user_email_hash" ] = crc32( $bbuser_email ) . strlen( $bbuser_email );
$dataarray[ "user_password" ] = md5( $bbuser_passw );
if ( $myrow[ "username" ] == "" || $myrow[ "username_clean" ] == "" )
{
$dataarray[ "username" ] = $bbuser_login;
$dataarray[ "username_clean" ] = $bbuser_login;
}
if ( $myrow[ "user_type" ] != $bbuser_class )
{
$dataarray[ "user_type" ] = $bbuser_class;
$dataarray[ "user_inactive_reason" ] = $bbuser_class ? 3 : 0;
$dataarray[ "user_inactive_time" ] = $bbuser_class ? time( ) : 0;
}
$query = "";
foreach ( $dataarray as $column => $value )
{
if ( $query == "" )
{
$query .= "UPDATE phpbb_users SET ";
}
else
{
$query .= ", ";
}
$query .= sprintf( "%s = '%s'", $column, addslashes( $value ) );
}
$query .= sprintf( " WHERE user_id = %d", $bbuser_newid );
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
if ( mysql_affected_rows( $cn1 ) )
{
$message[ ] = sprintf( "Updated user <b>%s</b>", rtext( $bbuser_login ) );
}
}
return implode( "<br>\n", $message );
}

Function description:

Input:

$UserID user id of the user (user = user of the website) whose clone is to be created or whose information is to be updated
$Email is the email address of the user
$Password is the email address of the user
$IsActive is the flag that states whether the user is active or not (1 or NULL)

Local variables:

global $cn1 is a valid, open mysql connection identifier. Its you job to do handle it. Replace with your mysql connection identifier.

$message is An array that will contain strings of information/debug info/whatever

$phpbb_config will contain information from phpbb_config table that will be used later.
$group_config will contain information from phpbb_groups table for group #2 – registered users. This information will be used later.

The above two are made static so that they are faster to fetch if you call the function in a loop (10,000 times for example)

$bbuser_newid contains the id that will be assigned to the new user. As discussed, I wont allow phpbb to generate user ids. Instead I’ll use my own to keep things simple. I just add 1000 to the $UserID.
$bbuser_email same as $Email except transformed – trimmed and lowercased
$bbuser_passw same as $Password
$bbuser_class more like a flag for checking if the user is active or not
$bbuser_login is a “generated” phpbb login name. The steps to create this “generated login” are up to you. I just extract the first part of email address, shave it clean and append the $bbuser_newid to make sure it is unique

Rest of the function is pretty simple. You check for the presence of a phpbb user based on the user id of the website user.

If not found then

  • prepare a phpbb user record (most of the process is copied from phpbb native function) and inert
  • assign this new user to registered users group

otherwise

  • update phpbb user email address, password, username (only in rare cases) and active status

How to use the function:

IMPORTING USER

Loop over all of your users and call the function:

$message = array( );
$query = "SELECT UserID, Email, Password, IsActive FROM user";
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
while ( $myrow = mysql_fetch_assoc( $ident ) )
{
$result = phpbb_synchronize_user( $myrow[ "UserID" ], $myrow[ "Email" ], $myrow[ "Password" ], $myrow[ "IsActive" ] );
if ( $result )
{
$message[ ] = $result;
}
}

UPON USER REGISTRATION

Call the function once, pass the ID of the newly inserted user and additional fields that you just stored in the database:

mysql_query( "INSERT INTO user YADA YADA", $cn1 ) or die( mysql_error( $cn1 ) );
$result = phpbb_synchronize_user( mysql_insert_id( $cn1 ), $_POST[ "Email" ], $_POST[ "Password" ], 1 );

UPON USER PROFILE UPDATE

Call the function once, pass the ID logged in user and additional fields that you just stored in the database:

mysql_query( "UPDATE user YADA YADA WHERE UserID = {$_SESSION["UserID"]}", $cn1 ) or die( mysql_error( $cn1 ) );
$result = phpbb_synchronize_user( $_SESSION[ "UserID" ], $_POST[ "Email" ], $_POST[ "Password" ], 1 );

Finally, Login:

I hacked into phpbb code and invented this solution for seamless login:

  • make sure user is logged in
  • synchronize information before phpbb login (optional… use it if you do not call the synchronize function frequently)
  • use phpbb functions to start a phpbb session

it kind of goes like this:

#
# since we are not storing phpbb username in the website user table
# we need to look it up
#

$query = sprintf(
“SELECT username FROM phpbb_users WHERE user_id = %d + 1000″,
$_SESSION[ "UserID" ]
);
$ident = mysql_query( $query, $cn1 ) or die( mysql_error( $cn1 ) );
$myrow = mysql_fetch_assoc( $ident );

if ( $myrow === false )
{
die( “PHPBB USER NOT FOUND” );
}

#
# phpbb init
#

define( “IN_PHPBB”, true );

$phpbb_root_path = “./bb/”;
$phpEx = substr( strrchr( __FILE__, “.” ), 1 );

require( $phpbb_root_path . “common.” . $phpEx );
require( $phpbb_root_path . “includes/functions_user.” . $phpEx );
require( $phpbb_root_path . “includes/functions_module.” . $phpEx );

$user->session_begin();

#
# hack that i used from phpbb code
#

$result = $auth->login( $myrow[ "username" ], $_SESSION[ "Password" ] );

if ( $result[ "status" ] == LOGIN_SUCCESS )
{
if ( defined( “IN_CHECK_BAN” ) && $result[ "user_row" ][ "user_type" ] != USER_FOUNDER )
{
return;
}
$successurl = $_GET[ "successurl" ];
if ( $successurl == “” )
{
$successurl = “/bb/”;
}
$successurl = reapply_sid( $successurl );
$successurl = str_replace( “&amp;”, “&”, $successurl );
header( “Location: $successurl” );
exit( 0 );
}
else
{
die( $result[ "error_msg" ] );
}

Uploading Issue in PHP: Max Size

From PHP manual

post_max_size integer
Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size . When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action=”edit.php?processed=1″>, and then checking if $_GET['processed'] is set.

Note: PHP allows shortcuts for bit values, including K (kilo), M (mega) and G (giga). PHP will do the conversions automatically if you use any of these. Be careful not to exceed the 32 bit signed integer limit (if you’re using 32bit versions) as it will cause your script to fail.

Powered by WordPress. Theme: Motion by 85ideas.