Exemple #1
0
function main_function($tls, $smtpserver, $username, $password, $port, $auth)
{
    $msgarray = array();
    try {
        $mail = mail_send($tls, $smtpserver, $username, $password, $port, $auth);
        if ($mail === true) {
            insert_into_db($tls, $smtpserver, $username, $password, $port, $auth);
            $constantresult = writeMailSettingsconstants($tls, $port, $username, $password, $smtpserver, $auth);
            if ($constantresult === true) {
                $msgarray['result'] = 'send';
            } else {
                $msgarray['error'] = 'Some error occured';
            }
        } else {
            $msgarray['error'] = $mail;
        }
    } catch (PDOException $ex) {
        $msgarray['error'] = 'Some error occured. ' . $ex->getMessage();
    }
    return $msgarray;
}
                }
            } else {
                $insert = "INSERT into Bids(user_id,sales_item_id,time_of_bid,amount) " . "VALUES('" . $seller_id . "'," . $item_id . ",'" . date("Y-m-d H:i:s") . "'," . $_POST['bid_amount'] . ")";
                if (insert_into_db($insert, $dbh, "New bid Made", "Failed to insert new bid")) {
                    header('Location: product.php?product_id=' . $item_id . '&was_bid=' . $_POST["bid_button_pressed"] . '&was_bin=' . $_POST["buy_it_now_pressed"]);
                }
            }
        }
    }
    if (isset($_POST["add_to_cart_pressed"])) {
        echo "in add_to_cart_pressed isset()";
        if ($_POST["add_to_cart_pressed"] == "true") {
            $insert = "INSERT into ShoppingCarts(user_id, item_id) " . " VALUES('" . $seller_id . "'," . $item_id . ")";
            echo "<br> " . $insert;
            // insert new record into sales
            if (insert_into_db($insert, $dbh, "<br><br><br><br>Added To Cart", "Failed to add to cart")) {
                header('Location: cart.php');
            }
        }
    } else {
        echo "error form submission type not found";
    }
    //echo $_POST["add_to_cart_pressed"];
    echo "request faild";
    //header('Location: shop.php');
}
function set_up_table_echo()
{
    echo '<div class="table_div">' . '<table class="table-striped table-bordered">' . '<thead>' . '<th>' . 'Attribute' . '</th>' . '<th>' . 'Value' . '</th>' . '</thead>' . '<tbody>';
}
function set_up_end_table_echo()
Exemple #3
0
<?php

require_once "functions/file_handling.php";
require_once "functions/img_resize.php";
require_once "functions/mysql_db_service.php";
require_once "functions/reviews.php";
if (isset($_POST['submit'])) {
    $file = $_FILES['file'];
    $err = is_valid_file($file);
    if (!$err) {
        $img_name = insert_into_db($file);
        change_location($file['tmp_name'], $img_name);
        img_resize("uploads/" . $img_name, "img_preview/" . $img_name, 200, 200);
    }
}
function select_images()
{
    $conn = connect();
    $arr = array();
    $query = mysql_query("SELECT name, time_seen FROM images ORDER BY time_seen DESC", $conn);
    while ($row = mysql_fetch_assoc($query)) {
        $arr[] = $row;
    }
    return $arr;
}
?>
<!DOCTYPE html>
<html>
<head>
	<title>Галерея</title>
	<meta charset="utf-8"/>