function parse($location, $url, $username, $password, $dbname, $tableprefix)
{
    // Find the file
    $readsql = fopen($location, "r");
    if ($readsql) {
        while (($line = fgets($readsql)) !== false) {
            // Adding a check if the line contains a # in front, meaning comment.
            if (substr($line, 0, 1) !== "#") {
                // process the line read.
                executesql($line, $url, $username, $password, $dbname, $tableprefix);
            }
        }
        fclose($readsql);
    } else {
        fclose($readsql);
        // error opening the file.
        return false;
    }
    return true;
}
Exemple #2
0
<?php

ob_start();
session_start();
$codeDB = 56565;
$_SESSION['seCureCon54684s2s'] = $codeDB;
include "../check-authentication-or-session.php";
include "../config_cA_soft_9564.php";
include "../function_common_58462554.php";
if (isset($_GET['deleteuser'])) {
    $offerid = $_GET['deleteuser'];
    $sql = "DELETE FROM userids845 WHERE Pid5='{$offerid}'";
    executesql($sql, $link);
    header("location:listusers.php");
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Email Marketing</title>

    <!-- Bootstrap core CSS -->

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="fonts/css/font-awesome.min.css" rel="stylesheet">
Exemple #3
0
function importexporttbl()
{
    global $prdbdata;
    global $prauth;
    global $ADM;
    global $pr;
    global $sd;
    global $tbl;
    global $write;
    //if (($write==cmsg("A_IMPEXP"))OR($write==cmsg("A_IE_DEST"))OR($write==cmsg("A_IE_SRC"))OR($write==cmsg("A_IE_START"))) { echo "";} else  { return;} // недоперенесено куда надо.
    global $sd17;
    global $addmode;
    global $send;
    global $views;
    global $tbl1;
    global $tbl2;
    global $totalbas;
    global $filbas, $codekey, $usecomma2x;
    if ($codekey == 7) {
        demo();
    }
    if ($prauth[$ADM][10] < 2) {
        lprint("ACCDEN");
        exit;
    }
    if ($prauth[$ADM][2] == false) {
        lprint("ACCDEN");
        exit;
    }
    //не разрешает администрировать не имея этого права - защита от альтернативного входа ($prauth[$ADM][10]<2)
    if ($prauth[$ADM][16] == 0) {
        echo cmsg(CONV_NOTE) . "<br>";
    }
    ?>
 <form action=w.php method=post><?php 
    hidekey("vID", $vID);
    hidekey("colfind", $colfind);
    hidekey("tbl1", $tbl1);
    hidekey("tbl2", $tbl2);
    hidekey("ietbl", 1);
    // colfind - пока не подключен будет развертыватся
    for ($a = 0; $prdbdata[$a] == true; $a++) {
        $k = count($prdbdata);
        $l = $k + 1;
        $filbas = $prdbdata[$a][0];
        $bas[$a] = $prdbdata[$a][1];
    }
    // $k= count($db) - вычисление кол-ва столбцов
    // c7 0 - select  c7 1 - start
    $pr16 = $pr[16];
    echo cmsg("A_CONV_SRC") . "<select name = tbl1 size = " . $pr[2] . ">";
    for ($a = 0; $a < $totalbas; $a++) {
        echo "<option value={$a} " . ("selected" and $a == $tbl1) . ">" . $bas[$a] . "</option>";
        //		if ($a!==$tbl) echo "<option value=$a >".$bas[$a]."</option>";
        //		if ($a===$tbl) {echo "<option value=$a ".(("selected") and ($a==$tbl)).">".$bas[$a]."</option>";}
    }
    //PART OF ID tbl
    $filbas = $prdbdata[$tbl1][0];
    $namebas = $prdbdata[$tbl1][1];
    $needscr = $prdbdata[$tbl1][2];
    $scrdir = $filbas . "scr";
    $formatscr = $prdbdata[$tbl1][3];
    $category = $prdbdata[$tbl1][4];
    $tablemysqlselect = $prdbdata[$tbl1][5];
    if ($tablemysqlselect === "") {
        $tablemysqlselect = 0;
    }
    //reset to default
    $hostmysqlselect = $prdbdata[$tbl1][6];
    if ($hostmysqlselect === "") {
        $hostmysqlselect = 0;
    }
    //reset to default
    $categorymode = $prdbdata[$tbl1][7];
    $scrcolumn = $prdbdata[$tbl1][8];
    $tblmysqlselect = $prdbdata[$tbl1][9];
    $md1column = $prdbdata[$tbl1][10];
    if ($md1column === "") {
        $md1column = 1;
    }
    //reset to default
    $md2column = $prdbdata[$tbl1][11];
    if ($md2column === "") {
        $md2column = 0;
    }
    //reset to default
    $dbtype = $prdbdata[$tbl1][12];
    $writeright = $prdbdata[$tbl1][13];
    $needrights = $prdbdata[$tbl1][14];
    $virtualid = $prdbdata[$tbl1][15];
    $reserved16 = $prdbdata[$tbl1][16];
    $reserved17 = $prdbdata[$tbl1][17];
    //найден код требуемой базы
    $filbas = $prdbdata[$tbl1][0];
    if (isset($colfind)) {
        $colfind = $md2column;
    }
    submitkey("write", "A_CONV_SRC_CHG");
    ?>
 </form>
<form action=w.php method=post>
<?php 
    hidekey("vID", $vID);
    hidekey("colfind", $colfind);
    hidekey("tbl1", $tbl1);
    hidekey("tbl2", $tbl2);
    hidekey("ietbl", 1);
    // colfind - пока не подключен будет развертыватся
    for ($a = 0; $prdbdata[$a] == true; $a++) {
        $k = count($prdbdata);
        $l = $k + 1;
        $filbas = $prdbdata[$a][0];
        $bas[$a] = $prdbdata[$a][1];
    }
    // $k= count($db) - вычисление кол-ва столбцов// c7 0 - select  c7 1 - start
    $pr16 = $pr[16];
    echo cmsg("A_CONV_DEST") . " <select name = tbl2 size = " . $pr[2] . ">";
    for ($a = 0; $a < $totalbas; $a++) {
        echo "<option value={$a} " . ("selected" and $a == $tbl2) . ">" . $bas[$a] . "</option>";
        //		if ($a!==$tbl) echo "<option value=$a >".$bas[$a]."</option>";
        //		if ($a===$tbl) {echo "<option value=$a ".(("selected") and ($a==$tbl)).">".$bas[$a]."</option>";}
    }
    //PART OF ID tbl
    $filbas2 = $prdbdata[$tbl2][0];
    $namebas2 = $prdbdata[$tbl2][1];
    $needscr2 = $prdbdata[$tbl2][2];
    $scrdir2 = $filbas2 . "scr";
    $formatscr2 = $prdbdata[$tbl2][3];
    $category2 = $prdbdata[$tbl2][4];
    $tablemysqlselect2 = $prdbdata[$tbl2][5];
    if ($tablemysqlselect2 === "") {
        $tablemysqlselect = 0;
    }
    //reset to default
    $hostmysqlselect2 = $prdbdata[$tbl2][6];
    if ($hostmysqlselect2 === "") {
        $hostmysqlselect = 0;
    }
    //reset to default
    $categorypr4 = $prdbdata[$tbl2][7];
    $scrcolumn2 = $prdbdata[$tbl2][8];
    $tblmysqlselect2 = $prdbdata[$tbl2][9];
    $md1column2 = $prdbdata[$tbl2][10];
    if ($md1column2 === "") {
        $md1column2 = 1;
    }
    //reset to default
    $md2column2 = $prdbdata[$tbl2][11];
    if ($md2column2 === "") {
        $md2column2 = 0;
    }
    //reset to default
    $dbtype2 = $prdbdata[$tbl2][12];
    $writeright2 = $prdbdata[$tbl2][13];
    $needrights2 = $prdbdata[$tbl2][14];
    $virtualid2 = $prdbdata[$tbl2][15];
    $reserved162 = $prdbdata[$tbl2][16];
    $reserved172 = $prdbdata[$tbl2][17];
    //найден код требуемой базы
    // procs from standart csv<-->sql converter
    $separator = stripslashes($separator);
    $separator = stripcslashes($separator);
    if (!$separator) {
        $separator = "¦";
    }
    // separator s changed - work
    if ($usecomma2x) {
        $separator = ";";
        echo "Forced using ; as separator , plevel writing declined.<br>";
    }
    $version = "dbs ed";
    $path_to_temp = "";
    function char2array($string)
    {
        $len = strlen($string);
        for ($j = 0; $j < $len; $j++) {
            $char[$j] = substr($string, $j, 1);
        }
        return $char;
    }
    function sqlify_line($line, $splitseparator, $separator, $ncols)
    {
        $line = chop($line);
        $line_chunks = split($splitseparator, $line);
        if ($ncols != sizeof($line_chunks)) {
            print "<br># ошибка, несоответствие колонок и данных<br>";
        }
        for ($i = 0; $i < count($line_chunks); $i++) {
            $s = trim($line_chunks[$i]);
            if ($s[0] == $s[strlen($s) - 1] && ($s[0] == "'" || $s[0] == '"')) {
                $s = substr($s, 1, strlen($s) - 2);
            }
            $line_chunks[$i] = addslashes($s);
            //rejected  <font color="#000BA">  </red>
        }
        for ($i = 0; $i < count($line_chunks); $i++) {
            if ($i == count($line_chunks) - 1) {
                $comma = "";
            } else {
                $comma = ", ";
            }
            // $separator.
            $final_line .= "'{$line_chunks[$i]}'{$comma}";
        }
        return $final_line;
    }
    function field_fix($line)
    {
        $line = eregi_replace("[[:space:]]+", "", $line);
        $letterarray = char2array($line);
        for ($i = 0; $i < count($letterarray); $i++) {
            if (eregi("^[_a-z0-9-]+", $letterarray[$i])) {
                $fieldname .= $letterarray[$i];
            }
        }
        return $fieldname;
    }
    //end procs standart csv<-->sql converter
    if (isset($colfind2)) {
        $colfind2 = $md2column2;
    }
    submitkey("write", "A_CONV_DEST_CHG");
    ?>
</form>  <?php 
    echo cmsg("A_CONV_TOEXEC") . ":<br>" . cmsg("A_CONV_SRC") . $namebas . " (" . $tbl1 . ") -->" . cmsg("A_CONV_DEST") . " " . $namebas2 . " (" . $tbl2 . ")<br>";
    if ($dbtype == $dbtype2) {
        echo "<red>" . cmsg("A_ONESTRUCT") . "</red><br>";
    }
    if ($dbtype == "fdb" and $dbtype2 == "mysql") {
        echo " CSV->->SQL.<br>";
    }
    if ($dbtype == "mysql" and $dbtype2 == "fdb") {
        echo " SQL->->CSV.<br>";
    }
    if ($write === cmsg("A_CONV_START")) {
        if ($prauth[$ADM][10] < 2) {
            lprint("ACCDEN");
            exit;
        }
        set_time_limit(0);
        //процесс
        //  2235 to 22355   serega   3377 removed to 2235
        if ($dbtype == $dbtype2) {
            lprint("A_ONESTRUCT");
            exit;
        }
        //start decoding SCP to CSV
        if ($dbtype == 2 and $dbtype2 == "fdb") {
            $filbas = "_data/" . $prdbdata[$tbl1][0];
            echo "<font color=red>Работа над данным режимом не закончена.</red><br>" . $filbas;
            iniparse($filbas, 21);
        }
        //end of decoding SCP to CSV
        //  CSV to SQL
        if ($dbtype == "fdb" and $dbtype2 == "mysql") {
            $filbas = $prdbdata[$tbl1][0];
            // где то ВСЕГДА теряет $filbas пришлось так сделать
            $csv_file_name = $filbas;
            $csv_file = $filbas;
            //reconfig
            if (!$filbas) {
                echo "Filebas = {$filbas} !!!!!!";
                exit;
            }
            $db_host = $hostmysqlselect2;
            $user_nm = $sd[14];
            //хм а почему Access denied for user '1'@'localhost' (using password: YES) in /media/D/Work/KERNEL/dj/site/dbscore.lib on line 1172
            $password = $sd[17];
            $DATABASE = $tblmysqlselect2;
            echo "DEBUG DATABASE dest={$DATABASE}";
            $table = $tablemysqlselect2;
            echo "DEBUG Table dest={$table}";
            //        echo "filbas=$filbas ; db_host=$db_host ; user_nm=$user_nm ; passwor=$password db=$DATABASE tab=$table";данные идут верные
            //echo "!DATABASE ".$DATABASE."!table".$table."!pas".$password;
            $separator = '¦';
            //changed
            if ($usecomma2x) {
                $separator = ";";
                echo "Forced using ; as separator , plevel writing declined.<br>";
            }
            $splitseparator = $separator;
            $table_nm = split("\\.", $csv_file_name);
            $table_name = strtolower($table_nm[0]);
            // ne ustr
            $table_name = $tablemysqlselect2;
            $out_header = "# source: {$tblmysqlselect} -- {$tablemysqlselect}<br># dest : {$tblmysqlselect2} -- {$tablemysqlselect2} ";
            if ($send) {
                header("Content-disposition: filename={$table}.csv");
                header("Content-type: application/octetstream");
                header("Pragma: no-cache");
                header("Expires: 0");
                $client = getenv("HTTP_USER_AGENT");
                if (ereg('[^(]*\\((.*)\\)[^)]*', $client, $regs)) {
                    $os = $regs[1];
                    if (eregi("Win", $os)) {
                        $crlf = "\r\n";
                    }
                }
            }
            if ($csv_file != "none") {
                $location = $path_to_temp . mktime() . ".csv";
                copy("_data/" . $csv_file, $location) or die("Failed to copy");
                //unlink($csv_file);
                $file_content = file($location);
                $fields = explode($splitseparator, $file_content[0]);
                for ($i = 0; $i < count($fields); $i++) {
                    $fields[$i] = field_fix($fields[$i]);
                }
                $table_create = "";
                //added drop db
                //  $table_create .= "DROP DATABASE IF EXISTS `".$DATABASE."` ;\n";
                //$connect = dbs_connect ($prdbdata[$tbl2][6], $prdbdata[$tbl2][13] , $sd[17],$dbtype2); // fail? $sd[14]
                if (!$dbtype2) {
                    $dbtype2 = "mysql";
                }
                echo "Connected: " . $prdbdata[$tbl2][6] . " by user {$sd['14']} <br>";
                $connect = dbs_connect($prdbdata[$tbl2][6], $sd[14], $sd[17], $dbtype2);
                // fail? $sd[14]
                $query = "";
                if ($addmode) {
                    $query = "CREATE DATABASE `" . $DATABASE . "` ;\n";
                    dbs_query($query, $connect, $dbtype2);
                    $query = "DROP TABLE IF EXISTS `{$table_name}` ;\n";
                    dbs_query($query, $connect, $dbtype2);
                    $query = "";
                }
                $table_create .= "CREATE TABLE `{$table_name}` (\n";
                if ($unique) {
                    $table_create .= "   id smallint(6) DEFAULT '0' not null auto_increment,\n";
                }
                $numfields = count($fields);
                for ($i = 0; $i < $numfields; $i++) {
                    if ($i == $numfields - 1) {
                        $comma = "";
                    } else {
                        $comma = ",";
                    }
                    //$comma = $separator;
                    $table_create .= "   `{$fields[$i]}` CHAR(225) not null{$comma}\n";
                    // text?
                    $field_names .= "{$fields[$i]}{$comma} ";
                }
                if ($unique) {
                    $table_create .= "   PRIMARY KEY (id),\n   UNIQUE ID (id)\n";
                }
                $table_create .= ")ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED ;\n\n";
                //test added engine to ; without ;
                if (!$addmode) {
                    $table_create = "";
                }
                // addmode
                if (!$send) {
                    echo "</center><p align=\"left\"><pre>";
                }
                if ($views) {
                    echo $out_header;
                }
                //      if ($views) {  echo $table_create; };
                $query = $table_create;
                if ($unique) {
                    $unique_field = "id, ";
                }
                for ($i = 1; $i < count($file_content); $i++) {
                    $partquery .= "\n INSERT INTO {$table_name} ({$unique_field}" . trim($field_names) . ") VALUES (";
                    if ($views) {
                        echo "";
                    }
                    if ($unique_field) {
                        $uniqq = "'{$i}', ";
                    }
                    $partquery .= $uniqq . sqlify_line($file_content[$i], $splitseparator, $separator, $numfields) . "); \n";
                    if ($views) {
                        echo "";
                    }
                }
                $query .= $partquery;
                // окончательный запрос тут!
                //if ($views) { echo $partquery;}
                // 	simple execute
                //mysql_select_db ($prdbdata[$tbl2][9], $connect);
                dbs_selectdb($prdbdata[$tbl2][9], $connect, $dbtype2);
                //	executesql ($query,$connect,"",1);  bad use only this command
                $find;
                $ax = array();
                // почему то вариант с разделением на строки куда лучше работает
                $ax = explode(";", $query);
                for ($ab = 0; $ab < count($ax) - 1; $ab++) {
                    if ($views) {
                        echo "<ii><bb>to execute ::: <br>" . $ax[$ab] . ";<br>--- query {$ab} ---</ii></bb></bb><br>";
                    }
                    $find = $find + executesql($ax[$ab] . ";", $connect, "", 2);
                    if ($views) {
                        echo "<br>--------<br>";
                    }
                }
                //	echo "6=".$prdbdata[$tbl2][6]." 13=".$prdbdata[$tbl2][13]." 17=".$sd[17]." selected db=".$prdbdata[$tbl2][9]."<br>";
                //	$result = dbs_query ($query,$connect,$dbtype);($query, $connect);
                //	if ($result<1) { echo " Процедура импорта не удалась.  <br>$result<br>"; };
                //	$myrow =dbs_fetch_row ($a,$dbtype);
                if (!$send) {
                    echo "</pre><p>";
                }
            } else {
                echo "Необходим CSV для конверсии";
            }
            echo "Процедура закончена, выполнено {$find} операций.";
            @unlink($location);
            exit;
        }
        // END CSV TO SQL
        // SQL TO CSV
        if ($dbtype == "mysql" and $dbtype2 == "fdb") {
            //	echo "Преобразование SQL в CSV.";
            $separator = "¦";
            if ($usecomma2x) {
                $separator = ";";
                echo "Forced using ; as separator , plevel writing declined.<br>";
            }
            $csv_file_name = $namebas2;
            //reconfig
            $db_host = $hostmysqlselect;
            $user_nm = $sd[14];
            $password = $sd[17];
            $DATABASE = $tblmysqlselect;
            $table = $tablemysqlselect;
            //процедура очень давно не проверялась,  ее надо вынести в w.php  и как следует проштудировать
            $connect = dbs_connect($db_host, $user_nm, $password, $dbtype) or die("Unable to connect to SQL server");
            @dbs_selectdb($DATABASE, $connect, $dbtype) or die("Unable to select DATABASE");
            $sqlcont = "select * from {$table}";
            $result = dbs_query($sqlcont, $connect, $dbtype);
            echo dbserr();
            function make_csv_happy($string, $separator)
            {
                $string = trim($string);
                if (eregi("\$separator", $string)) {
                    $string = ereg_replace("\"", "\"\"", $string);
                    $string = "\"" . $string . "\"";
                }
                $string = ereg_replace(10, "", $string);
                $string = ereg_replace("\r", "", $string);
                return $string;
            }
            if (mysql_fieldname($result, 0) == "id") {
                $first_field = "iD";
            }
            while ($col < mysql_numfields($result)) {
                $fname = mysql_fieldname($result, $col);
                if ($col < mysql_numfields($result) - 1) {
                    $comma = $separator;
                } else {
                    $comma = "";
                }
                if ($col == 0 && $first_field) {
                    $names .= $first_field . $comma;
                    $plevels .= "0" . $comma;
                } else {
                    $names .= make_csv_happy(strtoupper($fname), $separator) . $comma;
                    $plevels .= "0" . $comma;
                }
                $col++;
            }
            $final = $names . "\n";
            if ($separator == "¦") {
                echo "Generating dbs 4.x compactible header...<br>";
                $final .= $plevels . "\n";
                //plevel generic  сделать выбор разделителя для сохранения - dbs 4.x 2.x (;)
            }
            while ($row < mysql_numrows($result)) {
                $col = 0;
                $line = "";
                while ($col < mysql_numfields($result)) {
                    $fname = mysql_fieldname($result, $col);
                    if ($col < mysql_numfields($result) - 1) {
                        $comma = $separator;
                    } else {
                        $comma = "";
                    }
                    $line .= make_csv_happy(mysql_result($result, $row, $fname), $separator) . $comma;
                    $col++;
                }
                $final .= $line . "\n";
                $row++;
            }
            if ($send) {
                header("Content-disposition: filename={$table}.csv");
                header("Content-type: application/octetstream");
                header("Pragma: no-cache");
                header("Expires: 0");
                $client = getenv("HTTP_USER_AGENT");
                if (ereg('[^(]*\\((.*)\\)[^)]*', $client, $regs)) {
                    $os = $regs[1];
                    if (eregi("Win", $os)) {
                        $crlf = "\r\n";
                    }
                }
            } else {
                echo "</center><p align=\"left\"><pre>";
            }
            // 		end SQL TO CSV
            if ($views) {
                echo $final;
            }
            if ($addmode) {
                @($f = fopen("_data/" . $filbas2, "w")) or die("Не могу подсоединится к базе.");
                @fwrite($f, $final) or die("Невозможно произвести запись");
                @fclose($f);
            } else {
                @($f = fopen("_data/" . $filbas2, "a+")) or die("Не могу подсоединится к базе.");
                @fwrite($f, $final) or die("Невозможно произвести запись");
                @fclose($f);
            }
            if (!$send) {
                echo "</pre></p>";
            }
        }
        echo "Задача поставлена, подождите пожалуйста до окончания процесса и не переключайте страницу.\t";
        exit;
    }
    ?>
<form action=w.php method=post>
<?php 
    hidekey("db_host", 0);
    hidekey("user_nm", 0);
    hidekey("password", 0);
    hidekey("DATABASE", 0);
    hidekey("table", 0);
    hidekey("tbl1", $tbl1);
    hidekey("tbl2", $tbl2);
    hidekey("ietbl", 1);
    ?>

<?php 
    checkbox($views, "views");
    echo cmsg("WF_LOG") . "<br>";
    checkbox($unique, "unique");
    echo cmsg("A_CONV_SETUID") . "<br>";
    checkbox($usecomma2x, "usecomma2x");
    echo cmsg("USECOMMA2X") . "<br>";
    checkbox($addmode, "addmode");
    echo cmsg("A_CONV_SETREWR") . "<br>";
    hidekey("separator", ";");
    submitkey("write", "A_CONV_START");
    echo "</form>";
}
Exemple #4
0
     echo "<B>显示记录</B><BR>";
     showmainbutton();

     if (($ext_filter==1) && (ltrim(rtrim($common_condition))<>'') && (ltrim(rtrim($common_sort))<>'')){
        $common_sqlstr="select $common_fields from $common_tbname WHERE $common_condition ORDER BY $common_sort limit $common_starpage,$common_perpage";
     }
     else if (($ext_filter==1) && (ltrim(rtrim($common_condition))<>'')){
        $common_sqlstr="select $common_fields from $common_tbname WHERE $common_condition limit $common_starpage,$common_perpage";
     }
     else if (($ext_filter==1) && (ltrim(rtrim($common_sort))<>'')){
        $common_sqlstr="select $common_fields from $common_tbname ORDER BY $common_sort limit $common_starpage,$common_perpage";
     }
     else{
         $common_sqlstr="select * from  $common_tbname limit $common_starpage,$common_perpage";
     }
     $result=executesql($common_sqlstr);
     $num=mysql_num_fields($result);
  
     echo "<TABLE width=100% BORDER='1' class=table2>";
     echo "<TR  BGCOLOR=#808000>";
     echo "<TD>&nbsp;</TD>";
     //字段显示并翻译为中文
     for ($i=0;$i<$num;$i++) {
         $value=mysql_field_name($result,$i);
         if (!preg_match("/_data_/i",$value)) {
         	$value=getchsname($value,$common_chsfield);
         	echo "<TD align='center'><B>$value</B></TD>";
         }
     }
     echo "</TR>";
     //显示记录内容
Exemple #5
0
                    executesql($sqltr, $link);
                } else {
                    if ($emailid == "00000000" && $isp == "testemail" && $listname == "testemail" && $type == 'r') {
                        $clik1++;
                        $sqltr = "UPDATE offers SET clicks={$clik1} WHERE offerid='{$offerid}'";
                        executesql($sqltr, $link);
                        header("location:{$finallink}");
                    } else {
                        if ($emailid == "00000000" && $isp == "testemail" && $listname == "testemail" && $type == 'o') {
                            header("location:{$finallink}");
                        } else {
                            if ($emailid == "00000000" && $isp == "testemail" && $listname == "testemail" && $type == 'u') {
                                header("location:{$finallink}");
                            } else {
                                if ($emailid == "00000000" && $isp == "testemail" && $listname == "testemail" && $type == 'i') {
                                    $opens1++;
                                    $sqltr = "UPDATE offers SET opens={$opens1} WHERE offerid='{$offerid}'";
                                    executesql($sqltr, $link);
                                    header("location:{$finallink}");
                                } else {
                                    echo "invalid Parameters";
                                    exit(0);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}