Ejemplo n.º 1
0
function main()
{
    if (!empty($_POST["type"])) {
        $type = $_POST["type"];
        $sender = $_SESSION["name"];
        if ($type == "load_profile_info") {
            load_profile_info($sender);
        } else {
            if ($type == "edit_firstname") {
                $new_firstname = $_POST["new_firstname"];
                edit_firstname_in_db($new_firstname, $sender);
            } else {
                if ($type == "edit_lastname") {
                    $new_lastname = $_POST["new_lastname"];
                    edit_lastname_in_db($new_lastname, $sender);
                } else {
                    if ($type == "edit_username") {
                        $new_username = $_POST["new_username"];
                        edit_username_in_db($new_username, $sender);
                    } else {
                        if ($type == "edit_city") {
                            $new_city = $_POST["new_city"];
                            edit_city_in_db($new_city, $sender);
                        } else {
                            if ($type == "edit_country") {
                                $new_country = $_POST["new_country"];
                                edit_country_in_db($new_country, $sender);
                            } else {
                                if ($type == "edit_color") {
                                    $new_color = $_POST["new_color"];
                                    change_settings($sender, $new_color);
                                } else {
                                    //redirect("index", "Oops! Post information wasn't passed.");
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Ejemplo n.º 2
0
function main()
{
    if (!empty($_POST["type"])) {
        $type = $_POST["type"];
        $sender = $_SESSION["name"];
        if ($type == "message_send") {
            $ciphered_message = $_POST["cipher"];
            $real_message = $_POST["message"];
            $friend = $_POST["friend"];
            send_friend($ciphered_message, $real_message, $friend, $sender);
        } else {
            if ($type == "message_load") {
                load_messages($sender);
            } else {
                if ($type == "inbox_load") {
                    load_inbox($sender);
                } else {
                    if ($type == "outbox_load") {
                        load_outbox($sender);
                    } else {
                        if ($type == "message_read") {
                            $ciphered_message = $_POST["cipher"];
                            $real_message = $_POST["message"];
                            $friend = $_POST["friend"];
                            //             mark_message($ciphered_message, $real_message, $friend, $sender);
                        } else {
                            if ($type == "show_friends") {
                                $sender = $_SESSION["name"];
                                show_friends($sender);
                            } else {
                                if ($type == "accept_friend_request") {
                                    $friend = $_POST["friend"];
                                    //             accept_friend_request($friend, $sender);
                                } else {
                                    if ($type == "make_friend_request") {
                                        $friend = $_POST["friend"];
                                        //             make_friend_request($friend, $sender);
                                    } else {
                                        if ($type == "settings_load") {
                                            load_settings($sender);
                                        } else {
                                            if ($type == "settings_change") {
                                                $new_color = $_POST["new_color"];
                                                change_settings($sender, $new_color);
                                            } else {
                                                if ($type == "add_friend") {
                                                    $new_friend = $_POST["new_friend"];
                                                    add_friend($sender, $new_friend);
                                                } else {
                                                    //redirect("index", "Oops! Post information wasn't passed.");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
<?php

require "../settings.php";
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = change_settings($_POST);
            break;
        default:
            $OUTPUT = show_settings();
    }
} else {
    $OUTPUT = show_settings();
}
require "../template.php";
function show_settings($err = "")
{
    db_connect();
    #assign teh vars ...
    $sel1 = "";
    $sel2 = "";
    #get trad disc setting
    $traddisc = getCSetting("SET_INV_TRADDISC");
    if ($traddisc == "include") {
        $sel1 = "checked='yes'";
    } else {
        $sel2 = "checked='yes'";
    }
    $display = "\n\t\t\t\t\t<h2>Change Cubit Settings</h2>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t\t\t\t{$err}\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th colspan='2'>Invoice Trade Discount Setting</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><input type='radio' name='traddisc' value='include' {$sel1}> Include Delivery Charge In Trade Discount</td>\n\t\t\t\t\t\t\t<td><input type='radio' name='traddisc' value='exclude' {$sel2}> Exclude Delivery Charge In Trade Discount</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Change Settings'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</form>\n\t\t\t\t\t</table>\n\t\t\t\t";
    return $display;
}