/* ==================================================================
* File Name : box_pdgsv2.php
* Description : Pedigree Survey II
* Last Updated : Wednesday, October 24, 2007 01:09:22 AM
* Author : Toekang Web
* ==================================================================
*/
/* ----------------------------------------- *
* Tables, configuration and library we need *
* ----------------------------------------- */
$tbl_survey = "PDGSurvey2";
if(!isset($config)){ include("config/config.php"); }
if(!isset($lib_lib)){ include("libs/lib-wmlib.php"); }
$size = 30;
$sizetarea = $size+round($size/2,0);
$sizesarea = $size-round($size/2,0);
/* ---------------- *
* Begin the action *
* ---------------- */
session_start();
$output = "";
$title_to_display = "Isi dan Menangkan Bingkisan Menarik";
$L_RETURN = <<$T_RETURN
\n
EOF;
$prolog = <<Untuk lebih meningkatkan mutu layanan Pedigree® di Indonesia,
ikuti survey berhadiah dan menangkan 10 (sepuluh) paket bingkisan, berupa produk dan merchandise Pedigree® .
Isi dan lengkapilah formulir di bawah ini dengan baik dengan benar, survey ini akan berakhir pada tanggal 31 Juli 2006.
EOF;
$prov_key = array("0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16",
"17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33");
$prov_value = array("--- Pilih Propinsi ---","Nanggroe Aceh Darussalam","Sumatera Utara","Sumatera Barat","Riau","Jambi","Sumatera Selatan","Bengkulu",
"Lampung","Kep. Bangka Belitung","Kep. Riau","DKI Jakarta","Jawa Barat","Jawa Tengah","DI Yogyakarta","Jawa Timur",
"Banten","Bali","Nusa Tenggara Barat","Nusa Tenggara Timur","Kalimantan Barat","Kalimantan Tengah","Kalimantan Selatan",
"Kalimantan Timur","Sulawesi Utara","Sulawesi Tengah","Sulawesi Selatan","Sulawesi Tenggara","Gorontalo","Sulawesi Barat",
"Maluku","Maluku Utara","Papua","Irian Jaya Barat");
$layout_1 = <<
EOF;
$layout_2 = <<
EOF;
if(!isset($act)){
$prov_option = Combo_Box("Propinsi",$prov_key,$prov_value);
$usedogfood_option = <<
Ya
Tidak
EOF;
$budget_option = <<
< 100rb
100rb - 250rb
> 250rb - 500rb
> 500rb - 1jt
> 1jt
EOF;
$info_option = <<
Iklan TV
Iklan Majalah
Iklan Radio
Website
Kerabat / Keluarga
Dog Show
Pet Shop
Dokter Hewan
EOF;
$output = <<
function ChrCount(field,remaining){
var MaxChr = 255;
if (field.value.length > MaxChr){
field.value = field.value.substring(0, MaxChr);
}else{
remaining.value = MaxChr - field.value.length;
}
}
EOF;
}else{
if($act == "kirim"){
$get_exists = mysql_query("SELECT * FROM $tbl_survey WHERE $tbl_survey.PDGS_Email = '$Email' LIMIT 0,1", $db);
if(mysql_num_rows($get_exists) > 0){
$output .= "Maaf, sistem kami mencatat bahwa Anda sudah pernah mengisi survey ini!
";
}else{
$error = "";
if(!validasi($_POST['Email'])){
$error .= "E-mail harus diisi ";
}
if(!validasi($_POST['Email'],"email")){
$error .= "Cek format E-mail yang dimasukkan ";
}
if(!validasi($_POST['Kota'])){
$error .= "Kota harus diisi ";
}
if($Propinsi == "0"){
$error .= "Anda belum memilih Propinsi ";
}else{
$prov_desc = Combo_Box_Desc($prov_value,$Propinsi);
}
if($error != ""){
$output .= <<
$T_ERR_INV:
$error
$L_RETURN
EOF;
}else{
$usedogfood_desc = Combo_Box_Desc(array("Ya","Tidak"),$usedogfood);
$budget_desc = Combo_Box_Desc(array("< 100rb","100rb - 250rb","> 250rb - 500rb","> 500rb - 1jt","> 1jt"),$budget);
$info_desc = Combo_Box_Desc(array("Iklan TV","Iklan Majalah","Iklan Radio","Website","Kerabat / Keluarga","Dog Show","Pet Shop","Dokter Hewan"),$info);
$output .= <<
E-mail:
$Email
Kota:
$Kota
Propinsi:
$prov_desc
Jawaban Anda untuk pertanyaan #1:
$usedogfood_desc
Jawaban Anda untuk pertanyaan #2:
$budget_desc
Jawaban Anda untuk pertanyaan #3:
$info_desc
$L_RETURN
EOF;
}
}
}elseif($act == "ok"){
$error = "";
if(!empty($_SESSION['freecap_word_hash']) && !empty($_POST['word'])){
if($_SESSION['hash_func'](strtolower($_POST['word']))==$_SESSION['freecap_word_hash']){
$_SESSION['freecap_attempts'] = 0;
$_SESSION['freecap_word_hash'] = false;
}else{
$error .= "$T_ERR_INVCAPT ";
}
}else{
$error .= "$T_ERR_INVCAPT ";
}
if($error != ""){
$output .= <<
$T_ERR_INV:
$error
$L_RETURN
EOF;
}else{
$offset_time = offset_time();
$query = "INSERT INTO $tbl_survey (PDGS_Time,PDGS_Email,PDGS_City,PDGS_Provence,PDGS_Dogfood,PDGS_Budget,PDGS_Info)
VALUES ('$offset_time','$Email','$Kota','$Propinsi','$usedogfood','$budget','$info')";
$add = mysql_query($query,$db);
$output .= <<Terima kasih atas partisipasi Anda!
EOF;
}
}elseif($act == "doddy"){
header("Location: pdgsv/pdgsv2.php");
}
}
$output = $layout_1 . $output . $layout_2;
/* ------------------------------------ *
* Push what we got above on the screen *
* ------------------------------------ */
flush();
include("$base_themepath/$theme/header.php");
include("$base_themepath/$theme/body-inside-open.php");
if($title_to_display == ""){
$title_to_display = $site_title;
}
echo theme_opencenter_box($title_to_display) . $output . theme_closecenter_box();
include("$base_themepath/$theme/body-inside-close.php");
include("$base_themepath/$theme/footer.php");
?>