Exemplo n.º 1
0
            } else {
                $email = $_POST['email'];
                $pass = $_POST['pass'];
                $est = validUser($email, $pass);
                if (is_array($est)) {
                    $_SESSION['id_user'] = $est['ID'];
                    $_SESSION['nombre_user'] = $est['NAME'];
                    $_SESSION['autentificador'] = $est['AUTENT'];
                    header('Location: ' . $_SERVER['REQUEST_URI']);
                } else {
                    $_SESSION['msg'] = "Correo y contraseña no coinciden...";
                    header('Location: ' . $_SERVER['REQUEST_URI']);
                }
            }
        } else {
            echo formLogin();
        }
        echo '</div>';
    }
} else {
    setTime();
}
?>
			
				</div>
			</div>
		<footer>B1D4 Copyright © All Rights Reserved 2015</footer>
		<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
		<script type="text/javascript" src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"></script>
		<script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js"></script>
Exemplo n.º 2
0
        }
        break;
    case "register":
        $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
        break;
    case "save-register":
        $link = linkDatabase() or die("Connection error!");
        $ok = create_new_user($link, $nickname, $firstname, $lastname, $email, $password);
        if (!$ok) {
            $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
        } else {
            header("Location: http://www.threescript.com");
        }
        break;
    default:
        $form_login = formLogin();
        break;
}
function linkDatabase_()
{
    $link = mysql_connect("localhost", "user_name", "user_password");
    mysql_select_db('db_name', $link);
    return $link;
}
function formField($field_title, $field_type, $field_id, $field_name, $field_value)
{
    $str = "<div class='pr form-field'>";
    $str .= "<div class='pr fl form-field-label-div'>{$field_title}</div>";
    $str .= "<div class='pr fl form-field-input-div'>\n      <input id='{$field_id}' type='{$field_type}' name='{$field_name}' \n      value='{$field_value}' placeholder='{$field_title}' class='form-field-input'/></div>";
    $str .= "</div>";
    return $str;
Exemplo n.º 3
0
function setTime()
{
    if (!isset($_SESSION['id_user']) || empty($_SESSION['id_user'])) {
        echo "Existe un problema en tu secion, por favor vuelve a iniciar<br/>";
        echo formLogin();
    } else {
        $nombre = $_SESSION['nombre_user'];
        $idUser = $_SESSION['id_user'];
        //Asignar tiempo
        echo '<div id="contentUser">';
        echo '<div id="asignAlarmas">';
        echo '<div class="columnaUser">';
        echo "Asigna un tiempo!<br/>";
        if (isset($_POST['asignarTiempo'])) {
            if (!empty($_POST['fecha']) && !empty($_POST['userName']) && $_POST['userName'] != 0) {
                $userHacia = $_POST['userName'];
                $fecha = $_POST['fecha'];
                //Validando si es amigo
                if (isAmigos($idUser, $userHacia)) {
                    $query = "INSERT INTO `tiempos` (`user_id`,`tiempo`,`user_id_asignador`) VALUES (" . $userHacia . ",'" . $fecha . "'," . $idUser . ");";
                    $result = mysql_query($query) or die(mysql_error());
                    $_SESSION['msg'] = "Alarma Agregada!";
                    header('Location: ' . $_SERVER['HTTP_REFERER']);
                } else {
                    $_SESSION['msg'] = "El(ella) no es tu amigo(a)...";
                    header('Location: ' . $_SERVER['HTTP_REFERER']);
                }
            } else {
                $_SESSION['msg'] = "Debe selecionar una fecha y un usuario!";
                header('Location: ' . $_SERVER['HTTP_REFERER']);
            }
        }
        echo formularioAsignacion();
        if (isset($_POST['addFriend'])) {
            if (!empty($_POST['email']) && !empty($_POST['autentifiador'])) {
                $email = $_POST['email'];
                $autentificador = $_POST['autentifiador'];
                $query = "SELECT `id` FROM `user` WHERE email = '" . $email . "' AND autentification = '" . $autentificador . "'";
                $result = mysql_query($query) or die(mysql_error());
                if (mysql_num_rows($result) != 0) {
                    $userFriend = mysql_fetch_object($result);
                    $query = "INSERT INTO `friend_list` (`user_id`,`user_friend_id`) VALUES (" . $idUser . "," . $userFriend->id . ");";
                    $result = mysql_query($query) or die(mysql_error());
                    $_SESSION['msg'] = "Amigo agregado!";
                    header('Location: ' . $_SERVER['HTTP_REFERER']);
                } else {
                    $_SESSION['msg'] = "Email y autentificador no concuerdan";
                    header('Location: ' . $_SERVER['HTTP_REFERER']);
                }
            } else {
                $_SESSION['msg'] = "Email y autentificador son requeridos!";
                header('Location: ' . $_SERVER['HTTP_REFERER']);
            }
        }
        echo "Registra a un amigo!<br/>";
        echo formRegistFriend();
        echo '</div>';
        echo '</div>';
        //Desactivar alarma...
        echo '<div id="listaAlarmas">';
        echo '<div class="columnaUser">';
        if (isset($_POST['destAlarma'])) {
            $complet = true;
            foreach ($_POST as $key => $val) {
                if (is_numeric(substr($key, 0))) {
                    $complet = disableAlarm($key, $idUser);
                }
            }
            if (!$complet) {
                $_SESSION['msg'] = "Algunas alarmas no se an podido desactivar";
            } else {
                $_SESSION['msg'] = "Alarma Desactivada!";
            }
            header('Location: ' . $_SERVER['HTTP_REFERER']);
        }
        echo formularioAlarmas($idUser);
        echo '</div>';
        echo '</div>';
        echo '</div>';
    }
}