<?php

session_start();
include "include/config.php";
include "include/function.php";
chk_member_login();
if ($_REQUEST[update_profile] != "") {
    $bdate = $_REQUEST[year] . "-" . $_REQUEST[month] . "-" . $_REQUEST[day];
    if ($_REQUEST[email] == "") {
        $err = "Signup: Email should not be null.";
    } elseif (check_field_exists($_REQUEST[email], "email", "signup") == 1 && $_REQUEST[prevemail] != "{$_REQUEST['email']}") {
        $err = "Signup: This email already exist!";
    } elseif ($_REQUEST[password1] == "") {
        $err = "Signup: Password should not be null.";
    } elseif ($_REQUEST[password1] != $_REQUEST[password2]) {
        $err = "Signup: Retype does not match.";
    } elseif ($bdate != "yyyy-mm-dd") {
        if (!checkdate($_REQUEST[month], $_REQUEST[day], $_REQUEST[year])) {
            $err = "Invalid date format";
        }
    }
    if ($err == "") {
        $addition = "";
        $addition .= "fname='{$_REQUEST['fname']}',";
        $addition .= "lname='{$_REQUEST['lname']}',";
        if ($bdate != "yyy-mm-dd") {
            $addition .= "bdate='{$bdate}',";
        }
        if ($_REQUEST[gender] != "---") {
            $addition .= "gender='{$_REQUEST['gender']}',";
        }
<?php

session_start();
include "include/config.php";
include "include/function.php";
chk_member_login();
if ($_REQUEST['create_group'] != "") {
    if ($_REQUEST[group_name] == "") {
        $err = "Please Provide a group name.";
    } elseif ($_REQUEST[tags] == "") {
        $err = "Please Provide tag/s.";
    } elseif ($_REQUEST[description] == "") {
        $err = "Please provide description.";
    } elseif ($_REQUEST[short_name] == "" || check_field_exists($_REQUEST[short_name], "gurl", "group_own") == 1) {
        $err = "Please provide unique part of url.";
    } elseif (count($_REQUEST[chlist]) < 1 || count($_REQUEST[chlist]) > 3) {
        $err = "Upload: Please check (1 to 3) channel/s.";
    }
    if ($err == "") {
        $listch = implode("|", $_REQUEST[chlist]);
        $sql = "insert into group_own set\n                OID={$_SESSION['UID']},\n                gname='{$_REQUEST['group_name']}',\n                keyword='{$_REQUEST['tags']}',\n                gdescn='{$_REQUEST['description']}',\n                gurl='{$_REQUEST['short_name']}',\n                channel='0|{$listch}|0',\n                type='{$_REQUEST['group_type']}',\n                gupload='{$_REQUEST['video_upload_type']}',\n                gposting='{$_REQUEST['forum_upload_type']}',\n                gimage='{$_REQUEST['group_icon']}',\n                gcrtime='" . time() . "'";
        $conn->execute($sql);
        $id = mysql_insert_id();
        $sql = "insert into group_mem set\n                GID={$id},\n                MID={$_SESSION['UID']},\n                member_since = '" . date("Y-m-d") . "'\n                ";
        $conn->execute($sql);
        if (mysql_affected_rows() >= 1) {
            header("Location:{$config['baseurl']}/groups_home.php?urlkey={$_REQUEST['short_name']}");
        }
        exit;
    }
}
$_REQUEST['add'] = "";
while (list($k, $v) = each($_GET)) {
    if ($k != "next") {
        $_REQUEST['add'] .= "&{$k}={$v}";
    }
}
if ($_REQUEST[action_signup] != "") {
    if ($_REQUEST[email] == "") {
        $err = "Signup: Email should not be null.";
    } elseif (!check_email($_REQUEST[email])) {
        $err = "Signup: Invalid Email format!";
    } elseif (check_field_exists($_REQUEST[email], "email", "signup") == 1) {
        $err = "Signup: This email already exist!";
    } elseif ($_REQUEST[username] == "") {
        $err = "Signup: Username should not be null.";
    } elseif (check_field_exists($_REQUEST[username], "username", "signup") == 1) {
        $err = "Signup: This Username already exist!";
    } elseif ($_REQUEST[password1] == "") {
        $err = "Signup: Password should not be null.";
    } elseif ($_REQUEST[password1] != $_REQUEST[password1]) {
        $err = "Signup: Retype does not match.";
    } elseif ($config['enable_package'] == "yes" and $_REQUEST[pack_id] == "") {
        $err = "Signup: Please select a package";
    }
    if ($err == "") {
        $sql = "insert into signup set\n\t\t\t\t\t\temail='{$_REQUEST['email']}',\n\t\t\t\t\t\tusername='******'username']}',\n\t\t\t\t\t\tpwd='{$_REQUEST['password1']}',\n\t\t\t\t\t\taddtime='" . time() . "',\n\t\t\t\t\t\tlogintime='" . time() . "'";
        $conn->execute($sql);
        $userid = mysql_insert_id();
        $sql = "insert into verify set\n\t\t\t\t\t\tUID='{$userid}'";
        $conn->execute($sql);
        $sql = "insert subscriber set\n\t\t\t\t\t\tUID='{$userid}'";