Example #1
0
                    $updateLine = mysqli_query($conn, "UPDATE story_line SET paragraph='{$story_line[$j]}',  images='{$converted[$j]}' WHERE p_id={$pid[$j]}");
                } else {
                    echo "<script>alert('The file you uploaded is not an image!')</script>";
                }
            } else {
                $sql = "UPDATE story_line SET paragraph='{$story_line[$j]}' WHERE p_id={$pid[$j]}";
                echo "<script>alert('" . $sql . "');</script>";
                $updateLine = mysqli_query($conn, $sql);
            }
        }
        // echo "<script>window.location='index.php';</script>";
    }
    $story_line_data = array_combine($_POST['addedStoryLine'], $_FILES['addedLineImage']['tmp_name']);
    $count = count($story_line_data);
    if ($count > 0) {
        insertNewLine($story_line_data, $conn);
    } else {
        // echo "did not call insertnewline()";
        echo "<script>window.location='index.php';</script>";
    }
}
function insertNewLine($story_line_data, $conn)
{
    if ($conn) {
        echo "yay";
    } else {
        echo "nay";
    }
    $id = $_GET['id'];
    foreach ($story_line_data as $paragraph => $lineImage) {
        if (!empty($lineImage)) {
Example #2
0
function file_writer_xl2tp_client($cn)
{
    global $dir_vpn_xl2tp_client;
    $is_error = 0;
    log_generator("Security VPN L2TP Client File Writing Start", __FILE__, __FUNCTION__, __LINE__, NULL);
    $dir = $dir_vpn_xl2tp_client;
    $select_qry = "SELECT user, \n\t\t\t\t\t\t  password, \n\t\t\t\t\t\t  ip\n\t\t\t\t   FROM tbl_vpn_l2tp_client";
    $l2tp_client_string = "";
    $after_line = "#START";
    $before_line = "#END";
    $rs = Sql_exec($cn, $select_qry);
    while ($dt = Sql_fetch_array($rs)) {
        if ($l2tp_client_string == "") {
            $l2tp_client_string = $dt['user'] . " * " . $dt['password'] . " " . $dt['ip'];
        } else {
            $l2tp_client_string .= "\n" . $dt['user'] . " * " . $dt['password'] . " " . $dt['ip'];
        }
    }
    /*Load all data END*/
    try {
        cleanLines($dir, $after_line, $before_line);
        insertNewLine($dir, $l2tp_client_string, $after_line, $before_line);
    } catch (Exception $o) {
        $is_error = 2;
    }
    log_generator("VPN L2TP Client Successfully Written", __FILE__, __FUNCTION__, __LINE__, NULL);
    return $is_error;
}