if(isset($_POST['yahoo_app_id']) && $_POST['yahoo_app_id']=="") {
          $error[]="Please enter Yahoo Application ID";
      }
      if(isset($_POST['insta_app_id']) && $_POST['insta_app_id']=="") {
          $error[]="Please enter Instagram Application ID";
      }*/
    if (isset($_POST['email']) && $_POST['email'] == "") {
        $error[] = "Please enter email.";
    }
    if (isset($_POST['pass']) && $_POST['pass'] == "") {
        $error[] = "Please enter password.";
    }
    if (count($error) <= 0) {
        $sel_cs = "INSERT INTO `cs_sites` SET \r\n                firstname='" . $_POST['firstname'] . "',\r\n                lastname='" . $_POST['lastname'] . "',\r\n                site_url='" . $_POST['site_url'] . "', \r\n                site_admin='" . $_POST['site_admin'] . "',\r\n                fb_app_id='" . $_POST['fb_app_id'] . "',\r\n                twitter_app_id='" . $_POST['twitter_app_id'] . "',\r\n                linkedin_app_id='" . $_POST['linkedin_app_id'] . "',\r\n                gplus_app_id='" . $_POST['gplus_app_id'] . "',\r\n                yahoo_app_id='" . $_POST['yahoo_app_id'] . "',\r\n                admin_email='" . $_POST['email'] . "',\r\n                admin_password='******'pass']) . "'";
        re_db_query($sel_cs);
        $last_id = re_db_insert_id();
        if ($_FILES['admin_img']['name'] != "") {
            $filename = basename($_FILES['admin_img']['name']);
            $ext = strtolower(getEXT($filename));
            $orgfilename = "cs_admin_" . $last_id . "." . $ext;
            $uploaddir = DIR_FS . "img/cs_admin/" . $orgfilename;
            move_uploaded_file($_FILES['admin_img']['tmp_name'], $uploaddir);
            $u_update = "update cs_sites set admin_img='" . $orgfilename . "' where id='" . $last_id . "'";
            re_db_query($u_update);
        }
        header("location:login.php?msg=reg");
        exit;
    }
}
?>
<!DOCTYPE html>
Exemple #2
0
/**
 * Function callback to insert data in database.
 * @param unknown_type $tb
 * @param unknown_type $data
 * @return number
 */
function re_db_insert($tb, $data)
{
    if (is_array($data) && count($data) > 0) {
        $tbinfo = re_db_query("SHOW FIELDS FROM `{$tb}`");
        while ($res = mysql_fetch_array($tbinfo)) {
            $tbfieldtype[$res['Field']] = $res['Type'];
        }
        foreach ($data as $k => $v) {
            if (strpos($tbfieldtype[$k], "double") === false) {
                $fields[] = "`" . $k . "`";
                if (!is_numeric($v)) {
                    $values[] = "'" . re_db_input($v) . "'";
                } else {
                    $values[] = "'" . $v . "'";
                }
            } else {
                if (is_numeric($v)) {
                    $fields[] = "`" . $k . "`";
                    $values[] = $v;
                }
            }
        }
        $query .= "INSERT INTO `" . $tb . "`\r\n    (" . implode(",", $fields) . ")\r\n    VALUES\r\n    (" . implode(",", $values) . ")";
        re_db_query($query);
        return re_db_insert_id();
    }
}