/***************************************************************************
* Dolphin Smart Community Builder
* -----------------
* begin : Mon Mar 23 2006
* copyright : (C) 2006 BoonEx Group
* website : http://www.boonex.com/
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Creative Commons Attribution 3.0 License for more details.
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once( '../inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
$logged['admin'] = member_auth( 1 );
$ADMIN = $logged['admin'];
/*-----------------------member as affiliates----------------------------*/
if ( !$demo_mode && $_POST['mem_form_submit'] == "Delete")
{
$i = 0;
while( list( $key, $val ) = each( $_POST ) )
{
if ( (int)$key && $val == "on" )
{
$res = db_res("DELETE FROM members_as_aff WHERE ID='$key'");
if (!$res)
{
$err = 1;
break;
}
++$i;
}
}
if ($err)
$status_text = "Membership rule was NOT successfully deleted.";
else
$status_text = "$i membership rules was successfully deleted.";
}
if ( !$demo_mode && $_POST['AddMem'] )
{
$maa_num_of_mem = process_db_input( $_POST['num_of_mem'] );
$maa_num_of_days = process_db_input( $_POST['num_of_days'] );
$maa_mid = process_db_input( $_POST['MID'] );
$res = db_res("INSERT INTO members_as_aff (`num_of_mem`, `num_of_days`, `MID`) VALUES ('$maa_num_of_mem', '$maa_num_of_days', '$maa_mid')");
if (!$res)
{
$err = 1;
break;
}
if ($err)
$status_text = "Membership rule was NOT successfully added.";
else
$status_text = "Membership rule was successfully added.";
}
if ( !$demo_mode && (int)$_GET['editmem'] )
{
$iEditmem = (int)$_GET['editmem'];
$editmem_arr = db_arr( "SELECT * FROM members_as_aff WHERE ID='$iEditmem';" );
}
if ( $_POST['EditMemS'] )
{
$maa_num_of_mem = process_db_input( $_POST['num_of_mem'] );
$maa_num_of_days = process_db_input( $_POST['num_of_days'] );
$maa_mid = process_db_input( $_POST['MID'] );
$res = db_res("UPDATE members_as_aff SET `num_of_mem`='$maa_num_of_mem',`num_of_days`='$maa_num_of_days',`MID`='$maa_mid' WHERE ID = '$maa_mid'");
if ( $res )
$status_text = "Membership rule was successfully updated.";
else
$status_text = "Membership rule was NOT successfully updated.";
}
/*-----------------------member as affiliates----------------------------*/
// - delete transaction ----------------
if ( !$demo_mode && $_POST[prf_form_submit] == "Delete")
{
$i = 0;
while( list( $key, $val ) = each( $_POST ) )
{
if ( (int)$key && $val == "on" )
{
$res = db_res("DELETE FROM aff WHERE ID='$key'");
if (!$res)
{
$err = 1;
break;
}
++$i;
}
}
if ($err)
$status_text = "Partners was NOT successfully deleteed.";
else
$status_text = "$i partners was successfully deleted.";
}
// - add transaction ------------------
if ( !$demo_mode && $_POST[AddDiscount] )
{
$aff_name = process_db_input( $_POST['Name'] );
$aff_email = process_db_input( $_POST['email'] );
$aff_password = process_db_input( $_POST['Password'] );
$aff_percent = process_db_input( $_POST['Percent'] );
$aff_status = process_db_input( $_POST['Status'] );
$res = db_res("INSERT INTO `aff` (`Name`,`email`,`Password`,`Percent`,`Status`) VALUES ('$aff_name', '$aff_email', md5( '$aff_password' ), '$aff_percent', '$aff_status')");
if (!$res)
{
$err = 1;
break;
}
if ($err)
$status_text = "Partner was NOT successfully added.";
else
$status_text = "Partner was successfully added.";
}
// - edit transaction ------------------
if ( !$demo_mode && (int)$_GET[editdis] )
{
$editdis_arr = db_arr( "SELECT `ID`, `Name`, `email`, `Password`, `Percent`, `seed`, DATE_FORMAT(`RegDate`, '$date_format' ) AS RegDate, `Status`, `www1`, `www2` FROM aff WHERE ID='".$_GET[editdis]."'" );
}
if ( $_POST[EditDiscount] )
{
if( !strlen( $_POST['Password'] ) )
$sPassword = "";
else
$sPassword = "`Password`=md5( '$_POST[Password]' ),";
$res = db_res("UPDATE aff SET `Name`='$_POST[Name]',`email`='$_POST[email]'," . $sPassword . "`Percent`='$_POST[Percent]',`Status`='$_POST[Status]' WHERE ID=$_POST[ID]");
if ( $res )
$status_text = "Partner was successfully updated.";
else
$status_text = "Partner was NOT successfully updated.";
}
// - GET variables --------------
$page = (int)$_GET['page'];
$p_per_page = (int)$_GET['p_per_page'];
$profiles = (int)$_GET['profiles'];
$sex = (int)$_GET['sex'];
$featured = $_GET['featured'];
if ( !$page )
$page = 1;
if ( !$p_per_page )
$p_per_page = 30;
// ------------------------------
$p_num = db_arr( "SELECT COUNT(*) FROM aff" );
$p_num = $p_num[0];
$pages_num = ceil( $p_num / $p_per_page );
$real_first_p = (int)($page - 1) * $p_per_page;
$page_first_p = $real_first_p + 1;
$result = db_res( "SELECT ID, Name, email, Password, Percent, www1, www2, Status, DATE_FORMAT(`RegDate`, '$date_format' ) AS RegDate, COUNT(idProfile) AS m_count FROM aff LEFT JOIN aff_members ON (ID=idAff) GROUP BY ID $part_addon ORDER BY ID ASC LIMIT $real_first_p, $p_per_page" );
$page_p_num = mysql_num_rows( $result );
$memberships_arr = getMemberships();
$_page['header'] = "Partners List";
$_page['header_text'] = "Partners List";
TopCodeAdmin();
?>
if ( strlen($status_text) )
echo "
Member | Number of members engaged | Current membership status |
= $profaff_arr['NickName'] ?> | = $profaff_arr['aff_num'] ?> |