<?PHP

#####################################################################
##                                                                 ##
##                       Easy Banner Free                          ##
##                 http://www.phpwebscripts.com/                   ##
##                 e-mail: info@phpwebscripts.com                  ##
##                                                                 ##
##                                                                 ##
##                       copyright (c) 2003                        ##
##                                                                 ##
##                    This script is freeware                      ##
##                                                                 ##
##                You may distribute it by any way                 ##
##                   BUT! You may not modify it!                   ##
## Removing the link to PHPWebScripts.com is a copyright violation.##
##   Altering or removing any of the code that is responsible, in  ##
##   any way, for generating that link is strictly forbidden.      ##
##   Anyone violating the above policy will have their license     ##
##   terminated on the spot.  Do not remove that link - ever.      ##
##                                                                 ##
#####################################################################

include("./data/data.php"); include("./common.php"); if (!$HTTP_POST_VARS) { parsedata('./data/templates/member_login.html',$s); exit; }
$q = mysql_query("select userpass from ebfmembers where userid = '$HTTP_POST_VARS[userid]'");if(!$q) problem(sql_error()); $data = mysql_fetch_row($q); if (!$data[0]) problem ("This username does not exist.");if (trim($data[0]) != trim($HTTP_POST_VARS[userpass])) problem ("Wrong password. Please try again.");
if (!$HTTP_POST_VARS[action]) parsedata("./data/templates/member_action.html",$HTTP_POST_VARS);
switch ($HTTP_POST_VARS[action]) {
	case 'edited'		: edited($HTTP_POST_VARS);
	case 'html'			: html($HTTP_POST_VARS);
	case 'stats'		: stats($HTTP_POST_VARS);
	case 'edit'			: edit($HTTP_POST_VARS); }
function edit($form) { global $s; $q = mysql_query("select userid,userpass,email,siteurl,urlbanner from ebfmembers where userid = '$form[userid]'"); if(!$q) problem(sql_error()); $data = mysql_fetch_array($q);
$data[bwidth] = $s[bwidth]; $data[bheight] = $s[bheight]; $data[info] = $s[info]; $data[banner]="<img border=0 width=\"$s[bwidth]\" height=\"$s[bheight]\" src=\"$data[urlbanner]\">"; parsedata('./data/templates/member_edit.html',$data); exit; }
function edited($form) { global $s; if (!eregi("^[a-z0-9]{1,8}$",$form[newpass])) problem ("Wrong or too long password. Max of 8 characters.") ;
if (strlen($form[email]) > 70) problem ("Email address is too long. Max of 70 characters.") ; if (strlen($form[siteurl]) > 100) problem ("URL is too long. Max of 100 characters.") ; if (strlen($form[urlbanner]) > 100) problem ("Banner URL is too long. Max of 100 characters.") ; if (!eregi("^[a-z0-9_.\-]+@[a-z0-9_\-]+\.[a-z0-9.]+$",$form[email])) problem ("Wrong email address. Please try again.");
if (!eregi("http://*",$form[siteurl])) problem ("Wrong URL. Please try again."); eregi(".*gif$",$form[urlbanner],$hh); eregi(".*jpg$",$form[urlbanner],$hh); eregi(".*png$",$form[urlbanner],$hh); if (!$hh[0]) problem ("Wrong banner image format. Please try again.");
$q = mysql_query("update ebfmembers set userpass='$form[newpass]',email='$form[email]',siteurl='$form[siteurl]',urlbanner='$form[urlbanner]' where userid = '$form[userid]'"); if(!$q) problem(sql_error()); $s[info] = '<span class="text13blue"><b>Data has been saved</b><span><br><br>'; edit($form); }
function stats($form) { global $s; $q = mysql_query("select userid,meshows,earned,notused,weshow,userpass from ebfmembers where userid = '$form[userid]'"); if(!$q) problem(sql_error()); $data = mysql_fetch_array($q); parsedata('./data/templates/member_stats.html',$data); exit; }
function html($form) { global $s; $form[workfile]="$s[phpdirectory]/work.php?ID=$form[userid]"; $form[width]=$s[bwidth]; $form[height]=$s[bheight]; $form[html] = parsehtml('./data/templates/html.txt',$form); parsedata('./data/templates/member_html.html',$form); exit; }

?>