-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodigo.php
74 lines (71 loc) · 2.39 KB
/
codigo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
include "conexion.php";
session_start();
if (!isset($_SESSION['usuario'])){
echo "<script>window.location='index.php'</script>";
}
$n2 = mysql_query("select nombre,tipo from usuarios where id_user = '".$_SESSION["usuario"]."' ", $conexion) or die(mysql_error());
$n3 = mysql_fetch_assoc($n2);
$nombre = $n3['nombre'];
if($n3['tipo'] == 1){
$tipo = "Estudiante Regular";
}
if($n3['tipo'] == 2){
$tipo = "Profesor";
}
if($n3['tipo'] == 3){
$tipo = "Estudiante Becado";
}
if($n3['tipo'] == 0){
$id = 0;
$tipo = "ADMINISTRADOR";
}
$queEmp = "select * from codigos where user = '".$_SESSION["usuario"]."' ";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$rowEmp = mysql_fetch_assoc($resEmp);
if ( mysql_num_rows($resEmp) != 0){
$numero = $rowEmp['codigo'];
}else{
$numero = rand(1000,9999);
$q = "INSERT INTO `codigos`(`codigo`, `user`) VALUES ('$numero','".$_SESSION["usuario"]."')";
$resEmp = mysql_query($q, $conexion) or die(mysql_error());
}
?>
<html lang="es">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="http://getbootstrap.com/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<link href='https://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
<title>COMEDOR INSTITUCIONAL</title>
</head>
<body>
<div class="container">
<div class="card card-container">
<table class="table">
<tr>
<td>
<a href="cuenta.php" class="btn btn-primary">Modificar Cuenta</a>
</td>
<td>
<a href="aut_logout.php" class="btn btn-danger">Salir</a>
</td>
</tr>
</table>
<p id="profile-name" class="profile-name-card"><?php echo $nombre; ?></p>
<p id="profile-name" class="profile-name-card"><?php echo $tipo; ?></p>
<br>
<form class="form-signin">
<span id="reauth-email" class="reauth-email"></span>
<h1><center><?php echo $numero; ?></center></h1>
<br>
</form>
<center>
<a href="aut_logout.php" class="btn btn-warning">Digitar Código</a>
<br><br>*Código de identificacion unico.
</div>
</div>
</body>
</html>