Location: PHPKode > projects > Warp.cms - php/mysql content management > warp_121/req_redir.php
<?php

// [downloads, resources, links, banners requester redir module v.1.2.1]
// xantis.warp.cms - version 1.2
// (c) 2002 xantis - all rights reserved
// this code is registered and protected by international copyrights laws


//####### Register Globals !

extract($HTTP_ENV_VARS);
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);

//#########################


$xnt_control_var = 'xnt2002warp.cms';
require("lib_adv.php");


//##################################################


function xrecqx_redir () {
//---------------------------------

//cfg vars
global 	$warp_request_process_txt, $xid, $xop, $y_warp_picts_dir, 
	$ywebsite_addr, $ysite_back_color, $arr_var_result, $wpsid,
	$yecomm_order_dwn_denied, $wordid, $PHP_AUTH_PW, $PHP_AUTH_USER ;

//get access
global	$y_warp_downloads_restrict_get, $y_warp_resources_restrict_get ;

//---------------------------------

//---------------------------------------------------------page header
if ( (($xop == 'xres') AND ($y_warp_resources_restrict_get == 'y')) OR (($xop == 'xdwn') AND ($y_warp_downloads_restrict_get == 'y')) OR ($xop == 'sdwn') ) {
	xheader ("$warp_request_process_txt", 'secure_x');
} //end if
else {
	xheader ("$warp_request_process_txt", '');
} //end else
xcenter_start ();
xnewline ();
//---------------------------------------------------------END page header


//external vars
$block_var = rawurldecode($xid);
$op_var = rawurldecode($xop);


//#################################### links

if ($xop == 'xlnk') {

	xmysql_write_data ("UPDATE links SET rank_h=rank_h+1 WHERE (id='$xid') ");
	xmysql_read_data ("SELECT url FROM links WHERE (id='$xid') ");
	$yfileurl = ''.$arr_var_result[0];

	xwriteflash_bg_var ("$ywebsite_addr"."util_req.swf",
		"&flash_form_logo=".rawurlencode("$ywebsite_addr"."$y_warp_picts_dir".'/redir_mini.jpg').
		"&xurl=".rawurlencode($yfileurl).
		"&"
	, '75', '50', "$ysite_back_color");

	xnewline ();

} //end if

//####################################


//#################################### banners

if ($xop == 'xbann') {

	xmysql_write_data ("UPDATE banners SET rank_v=rank_v+1 WHERE (id='$xid') ");
	xmysql_read_data ("SELECT link_url FROM banners WHERE (id='$xid') ");
	$yfileurl = ''.$arr_var_result[0];

	xwriteflash_bg_var ("$ywebsite_addr"."util_req.swf",
		"&flash_form_logo=".rawurlencode("$ywebsite_addr"."$y_warp_picts_dir".'/redir_mini.jpg').
		"&xurl=".rawurlencode($yfileurl).
		"&"
	, '75', '50', "$ysite_back_color");

	xnewline ();

} //end if

//####################################


//#################################### normal downloads

if ($xop == 'xdwn') {

	xmysql_write_data ("UPDATE downloads SET rank_d=rank_d+1 WHERE (id='$xid') ");
	xmysql_read_data ("SELECT file_url FROM downloads WHERE (id='$xid') ");
	$yfileurl = ''.$arr_var_result[0];

	xwriteflash_bg_var ("$ywebsite_addr"."util_req.swf",
		"&flash_form_logo=".rawurlencode("$ywebsite_addr"."$y_warp_picts_dir".'/save_mini.jpg').
		"&xurl=".rawurlencode($yfileurl).
		"&"
	, '75', '50', "$ysite_back_color");

	xnewline ();

} //end if

//####################################


//#################################### secure downloads

if ($xop == 'sdwn') {

	$WARP_B64_ENC_AUTH_PASSW = base64_encode($PHP_AUTH_PW);
	xmysql_read_data ("SELECT id FROM users WHERE ( (usr_name='$PHP_AUTH_USER') AND (usr_pass='$WARP_B64_ENC_AUTH_PASSW') ) ");
	$svxx_usr_idx = $arr_var_result[0];

	xmysql_read_data ("SELECT id FROM orders WHERE ( (ord_id='$wordid') AND (usr_id='$svxx_usr_idx') ) ");
	$hwx_ord_id = $arr_var_result[0];

	$hwx_err_level = 'ok';

	//check if order exists
	if (!empty($hwx_ord_id)) {
		xmysql_read_data ("SELECT id FROM prod_dwn_ac WHERE ( (ord_id='$wordid') AND (dwn_id='$xid') ) ");
		$hwx_dwn_id = $arr_var_result[0];
	} //end if
	else {
		$hwx_err_level = 'notok';
	} //end else

	//check dwn if dwn allowed
	if ( (empty($hwx_dwn_id)) AND (!empty($hwx_ord_id)) ) {
		xmysql_read_data ("SELECT file_url FROM prod_dwn WHERE (id='$xid') ");
		xmysql_write_data ("INSERT INTO prod_dwn_ac (ord_id, dwn_id) VALUES ('$wordid', '$xid') ");
		$yfileurl = ''.$arr_var_result[0];
	} //end if
	else {
		$hwx_err_level = 'notok';
	} //end else


	//if ok go
	if ($hwx_err_level == 'ok') {
		xwriteflash_bg_var ("$ywebsite_addr"."util_req.swf",
			"&flash_form_logo=".rawurlencode("$ywebsite_addr"."$y_warp_picts_dir".'/save_mini.jpg').
			"&xurl=".rawurlencode($yfileurl).
			"&"
		, '75', '50', "$ysite_back_color");
		xnewline ();
	} //end if
	else {
		xtext_small ("$yecomm_order_dwn_denied");
	} //end else

} //end if

//####################################


//#################################### resources

if ($xop == 'xres') {

	xmysql_write_data ("UPDATE resources SET rank_v=rank_v+1 WHERE (id='$xid') ");
	xmysql_read_data ("SELECT file_url FROM resources WHERE (id='$xid') ");
	$yfileurl = ''.$arr_var_result[0];

	xwriteflash_bg_var ("$ywebsite_addr"."util_req.swf",
		"&flash_form_logo=".rawurlencode("$ywebsite_addr"."$y_warp_picts_dir".'/docs_mini.jpg').
		"&xurl=".rawurlencode($yfileurl).
		"&"
	, '75', '50', "$ysite_back_color");

	xnewline ();

} //end if


//####################################


echo ( 
	"<script language=\"JavaScript\">\n".
	"window.focus('');\n".
	"</script>\n"
);



//---------------------------------------------------------page footer
xcenter_end ();
xfooter ();
//---------------------------------------------------------END page footer

} //END FUNCTION


//---------------------------------

xrecqx_redir ();

//---------------------------------

// end of php code
?>
Return current item: Warp.cms - php/mysql content management