Pārlūkot izejas kodu

Admin page files

PabloPuig1 1 gadu atpakaļ
vecāks
revīzija
2b2abdb7ff
28 mainītis faili ar 953 papildinājumiem un 409 dzēšanām
  1. 0
    87
      App.js
  2. Binārs
      LogoSidename.png
  3. 57
    0
      TPMG.php
  4. 0
    69
      about.js
  5. 93
    0
      about.php
  6. Binārs
      adaptive-icon.png
  7. 35
    0
      addEvent.php
  8. 33
    0
      addUser.php
  9. 28
    0
      deleteEvent.php
  10. 28
    0
      deleteUser.php
  11. 0
    17
      donar.js
  12. 0
    16
      drawer.js
  13. 211
    0
      eventsTable.php
  14. 81
    0
      eventslist.php
  15. Binārs
      favicon.png
  16. 0
    17
      gallery.js
  17. 0
    44
      header.js
  18. 0
    37
      homeStack.js
  19. Binārs
      icon.png
  20. 80
    0
      joinslist.php
  21. 37
    0
      loginUserAdd.php
  22. Binārs
      logo.png
  23. 0
    39
      package.json
  24. 0
    17
      solicitar.js
  25. 0
    66
      sorting.py
  26. Binārs
      splash.png
  27. 190
    0
      usersTable.php
  28. 80
    0
      userslist.php

+ 0
- 87
App.js Parādīt failu

@@ -1,87 +0,0 @@
1
-import * as React from 'react';
2
-import { Button, View, Image} from 'react-native';
3
-import { createDrawerNavigator } from '@react-navigation/drawer';
4
-import { NavigationContainer } from '@react-navigation/native';
5
-import About from './screens/about';
6
-import Gallery from './screens/gallery';
7
-import Calendario from './screens/calendar';
8
-import Donate from './screens/donar';
9
-import Solicitar from './screens/solicitar';
10
-import Account from './screens/account';
11
-import Header from './shared/header';
12
-
13
-const screens = {
14
-  About: {
15
-      screen: About,
16
-      navigationOptions: ({navigation}) => {
17
-          return {
18
-              headerTitle: () => <Header navigation={navigation}/>,
19
-          }
20
-      }
21
-  },
22
-}
23
-
24
-function HomeScreen({ navigation }) {
25
-  return (
26
-    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
27
-      <Button
28
-        onPress={() => navigation.navigate('Notifications')}
29
-        title="Go to notifications"
30
-      />
31
-    </View>
32
-  );
33
-}
34
-
35
-function NotificationsScreen({ navigation }) {
36
-  return (
37
-    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
38
-      <Button onPress={() => navigation.goBack()} title="Go back home" />
39
-    </View>
40
-  );
41
-}
42
-
43
-
44
-
45
-const Drawer = createDrawerNavigator();
46
-
47
-export default function App() {
48
-  return (
49
-    <NavigationContainer >
50
-      <Drawer.Navigator initialRouteName="Home">
51
-        <Drawer.Screen name="Sobre nosotros" component={About} options={({navigation}) => {
52
-          return {
53
-              headerTitle: () => <Header navigation={navigation}/>,
54
-          }
55
-        }}/>
56
-        <Drawer.Screen name="Calendario" component={Calendario} options={({navigation}) => {
57
-          return {
58
-              headerTitle: () => <Header navigation={navigation}/>,
59
-          }
60
-        }}/>
61
-        <Drawer.Screen name="Galeria" component={Gallery} options={({navigation}) => {
62
-          return {
63
-              headerTitle: () => <Header navigation={navigation}/>,
64
-          }
65
-        }}/>
66
-        <Drawer.Screen name="Donar" component={Donate} options={({navigation}) => {
67
-          return {
68
-              headerTitle: () => <Header navigation={navigation}/>,
69
-          }
70
-        }}/>
71
-        <Drawer.Screen name="Solicitar ayuda" component={Solicitar} 
72
-        options={({navigation}) => {
73
-          return {
74
-              headerTitle: () => <Header navigation={navigation}/>,
75
-          }
76
-        }}/>
77
-
78
-        <Drawer.Screen name="Mi cuenta" component={Account} 
79
-        options={({navigation}) => {
80
-          return {
81
-              headerTitle: () => <Header navigation={navigation}/>,
82
-          }
83
-        }}/>    
84
-      </Drawer.Navigator>
85
-    </NavigationContainer>
86
-  );
87
-}

Binārs
LogoSidename.png Parādīt failu


+ 57
- 0
TPMG.php Parādīt failu

@@ -0,0 +1,57 @@
1
+<!-- Home Page for TPMG -->
2
+
3
+<!-- http://https://ada.uprrp.edu/~pablo.puig1/TPMG/TPMG.php -->
4
+
5
+<body style="background-color:#6cd1f4">
6
+
7
+<!--Navigation Bar-->
8
+
9
+<!doctype html>
10
+<html lang="en">
11
+  <head>
12
+    <meta charset="utf-8">
13
+    <meta name="viewport" content="width=device-width, initial-scale=1">
14
+    <title>TPMG admin</title>
15
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
16
+  </head>
17
+    <body>
18
+    <nav class="navbar navbar-expand-lg bg-light">
19
+        <div class="container-fluid">
20
+          <!-- <a class="navbar-brand" href="/">TPMG</a> -->
21
+          <img src="LogoSidename.png" alt="logo" width="200"/>
22
+          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
23
+            <span class="navbar-toggler-icon"></span>
24
+          </button>
25
+          <div class="collapse navbar-collapse" id="navbarSupportedContent">
26
+            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
27
+              <li class="nav-item">
28
+                <a href="TPMG.php" class="nav-link active" aria-current="page">Home</a>
29
+              </li>
30
+              <li class="nav-item">
31
+                <a href="usersTable.php" class="nav-link">Users</a>
32
+              </li>
33
+              <li class="nav-item">
34
+                <a href="eventsTable.php" class="nav-link">Events</a>
35
+              </li>
36
+              <li class="nav-item">
37
+                <a href="about.php" class="nav-link">About</a>
38
+              </li>
39
+            </ul>          
40
+          </div>
41
+        </div>
42
+    </nav>
43
+
44
+<!--Text for the HOME PAGE-->
45
+<br>
46
+<h2>Write text here:</h2>
47
+</br>
48
+
49
+<br/>
50
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
51
+        <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
52
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
53
+    </body>
54
+</html>
55
+
56
+
57
+

+ 0
- 69
about.js Parādīt failu

@@ -1,69 +0,0 @@
1
-import * as React from 'react';
2
-import { StyleSheet, ScrollView, Text } from 'react-native';
3
-
4
-export default function About() {
5
-    return (
6
-        <ScrollView style={styles.container}>
7
-         <Text style={styles.title}>HISTORIA</Text>
8
-         <Text style={styles.paragraph}>Techos Pa' Mi Gente surgio en el año 2017, luego del huracan Maria. 
9
-         Fue una busqueda por inspirar y apoyar a las comunidades. Que despues de varios meses instalando 
10
-         toldos casi a diario, nuestros voluntarios llegaron a la conclusión de que había que realizar demasiado 
11
-         trabajo de carpintería para instalar un toldo correctamente, pues el daño era muy extenso. Por lo que, 
12
-         se tomó la decisión de comenzar a reparar techos de manera permanente. Para esto, se está siguiendo la: 
13
-         Guía de construcción para casas resistentes a huracanes, creada por el CIAPR Y FEMA luego del huracán Hugo, 
14
-         con actualizaciones en términos de nuevas tecnologías y materiales. Hasta el dia de hoy Techos Pa' Mi Gente 
15
-         se ha converitdo en una organizacion motivada a actuar una base solida de apoyo y compromiso con  las familias 
16
-         afectadas  por desastres naturales.</Text>
17
-         <Text style={styles.title}>MISIÓN, VISIÓN Y VALORES</Text>
18
-         <Text style={styles.subtitle}>Misión</Text>
19
-         <Text style={styles.subtitle}>Techos Pa' Mi Gente</Text>
20
-         <Text style={styles.paragraph}>(TPMG Corp.) es una organización sin fines de lucro dedicada a la construcción 
21
-         de techos dignos y rehabilitación de viviendas en comunidades afectadas por desastres naturales. Contribuye a mejorar 
22
-         la calidad de vida de los individuos que componen estas comunidades. Promueve la autogestión y brinda capacitación en 
23
-         destrezas básicas de construcción para fomentar la resiliencia. </Text>
24
-         <Text style={styles.subtitle}>Visión</Text>
25
-         <Text style={styles.paragraph}>  (TPMG Corp.) como organización del tercer sector aspira a ejercer liderazgo en la 
26
-         construcción de techo dignos, rehabilitación de viviendas y ser promotores de la autogestión, caracterizados por la 
27
-         excelencia en los servicios y la autosuficiencia fiscal.  Se propone a ser uno de los principales  proveedores de 
28
-         recursos para la capacitación y adiestramientos del capital humano que está comprometido con la recuperación a largo 
29
-         plazo ante desastres naturales.</Text>
30
-         <Text style={styles.subtitle}>Valores</Text>
31
-         <Text style={styles.paragraph}>-La solidaridad es nuestro eje. Las necesidades de nuestros compueblanos también son nuestras. </Text>
32
-         <Text style={styles.subtitle}>Empatía</Text>
33
-         <Text style={styles.paragraph}>-Somos sensibles con el prójimo. Fomentamos una cultura de identificamos con el dolor de los 
34
-         más necesitados.</Text>
35
-         <Text style={styles.subtitle}>Transparencia</Text>
36
-         <Text style={styles.paragraph}>-Honradez en nuestros  deberes. Trato honesto y veraz en nuestras operaciones.</Text>
37
-         <Text style={styles.subtitle}>Cuidado al voluntario</Text>
38
-         <Text style={styles.paragraph}>-Los voluntarios son nuestras principales herramientas. Un buen cuidado de nuestros voluntarios 
39
-         significa un trabajo eficiente y eficaz en pro de nuestros beneficiarios.</Text>
40
-         <Text style={styles.subtitle}>Diversidad</Text>
41
-         <Text style={styles.paragraph}>- Somos una entidad abierta sin discrimen de ninguna manera por razón de edad, raza, color, sexo, 
42
-         nacimiento, condición  de veteranos, ideología  politica o religiosa, origen o condición social, orientación sexual o identidad 
43
-         de género, diversidad funcional; ni por ser víctima de violencia doméstica o agresión sexual. En la diversidad está  la inclusión 
44
-         y TPMG es una organización inclusiva.</Text>
45
-        </ScrollView>
46
-    )
47
-}
48
-
49
-const styles = StyleSheet.create({
50
-    container: {
51
-        padding: 24
52
-    },
53
-    title: {
54
-        fontWeight: 'bold',
55
-        fontFamily: "AvenirNext-Bold",
56
-        fontSize: 50
57
-    },
58
-    subtitle: {
59
-        fontWeight: 'bold',
60
-        fontFamily: "Avenir-Black",
61
-        fontSize: 15 
62
-    },
63
-    paragraph: {
64
-        fontWeight: 'normal',
65
-        fontFamily: "Avenir-Black",
66
-        fontSize: 15,
67
-        textAlign: 'justify'
68
-    }
69
-});

+ 93
- 0
about.php Parādīt failu

@@ -0,0 +1,93 @@
1
+<!-- About Page for TPMG -->
2
+
3
+<!-- http://18.212.213.107/~pablo.puig1/about.php -->
4
+
5
+<!-- <html>
6
+<head>
7
+<title>TPMG admin</title>
8
+<div class="header">
9
+  <img src="LogoSideName.png" alt="logo" width="500"/>
10
+</div> -->
11
+
12
+<!--Settings for the page and tables-->
13
+
14
+<!-- <style>
15
+    ul {
16
+        list-style-type: none;
17
+        margin: 0;
18
+        padding: 0;
19
+        overflow: hidden;
20
+    }
21
+
22
+    li {
23
+    float: left;
24
+    }
25
+
26
+    li a {
27
+    display: block;
28
+    padding: 8px;
29
+    }
30
+
31
+    table, th, td {
32
+        border: 1px solid black;
33
+    }
34
+    
35
+    th, td {
36
+        padding: 1px;
37
+    }
38
+</style>
39
+</head> -->
40
+
41
+<!--Page background color-->
42
+
43
+<body style="background-color:#6cd1f4">
44
+
45
+<!--Navigation Bar-->
46
+
47
+<!doctype html>
48
+<html lang="en">
49
+  <head>
50
+    <meta charset="utf-8">
51
+    <meta name="viewport" content="width=device-width, initial-scale=1">
52
+    <title>TPMG admin</title>
53
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
54
+  </head>
55
+    <body>
56
+    <nav class="navbar navbar-expand-lg bg-light">
57
+        <div class="container-fluid">
58
+          <!-- <a class="navbar-brand" href="/">TPMG</a> -->
59
+          <img src="LogoSidename.png" alt="logo" width="200"/>
60
+          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
61
+            <span class="navbar-toggler-icon"></span>
62
+          </button>
63
+          <div class="collapse navbar-collapse" id="navbarSupportedContent">
64
+            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
65
+              <li class="nav-item">
66
+                <a href="TPMG.php" class="nav-link active" aria-current="page">Home</a>
67
+              </li>
68
+              <li class="nav-item">
69
+                <a href="usersTable.php" class="nav-link">Users</a>
70
+              </li>
71
+              <li class="nav-item">
72
+                <a href="eventsTable.php" class="nav-link">Events</a>
73
+              </li>
74
+              <li class="nav-item">
75
+                <a href="about.php" class="nav-link">About</a>
76
+              </li>
77
+            </ul>          
78
+          </div>
79
+        </div>
80
+    </nav>
81
+
82
+<!--Text for the HOME PAGE-->
83
+<br>
84
+<h2>About:</h2>
85
+</br>
86
+
87
+<br/>
88
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
89
+        <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
90
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
91
+    </body>
92
+</html>
93
+

Binārs
adaptive-icon.png Parādīt failu


+ 35
- 0
addEvent.php Parādīt failu

@@ -0,0 +1,35 @@
1
+<?PHP
2
+
3
+//---------------
4
+// Connection to server and database
5
+//---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+?>
20
+
21
+<?PHP
22
+$name = $_POST['name'];
23
+$Sdate = $_POST['Sdate'];
24
+$Edate = $_POST['Edate'];
25
+$Pcount = $_POST['Pcount'];
26
+$Plimit = $_POST['Plimit'];
27
+$Desc = $_POST['Desc'];
28
+
29
+$queryAddUser = "INSERT INTO events (name, start_date, end_date, participant_count, participant_limit, description) VALUES ('$name', '$Sdate', '$Edate', '$Pcount', '$Plimit', '$Desc')";
30
+mysqli_query($connection, $queryAddUser);
31
+// $stmtAdd = mysqli_prepare($connection, $queryAddUser);
32
+// mysqli_stmt_execute($stmtAdd);
33
+header("Location: eventsTable.php");
34
+exit();
35
+?>

+ 33
- 0
addUser.php Parādīt failu

@@ -0,0 +1,33 @@
1
+<?PHP
2
+
3
+//---------------
4
+// Connection to server and database
5
+//---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+?>
20
+
21
+<?PHP
22
+$name = $_POST['username'];
23
+$acc_type = $_POST['ACC'];
24
+$email = $_POST['email'];
25
+$phone_num = $_POST['phone'];
26
+
27
+$queryAddUser = "INSERT INTO users (name, acc_type, email, phone_num) VALUES ('$name', '$acc_type', '$email', '$phone_num')";
28
+mysqli_query($connection, $queryAddUser);
29
+// $stmtAdd = mysqli_prepare($connection, $queryAddUser);
30
+// mysqli_stmt_execute($stmtAdd);
31
+header("Location: usersTable.php");
32
+exit();
33
+?>

+ 28
- 0
deleteEvent.php Parādīt failu

@@ -0,0 +1,28 @@
1
+<?PHP
2
+
3
+//---------------
4
+// Connection to server and database
5
+//---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+?>
20
+
21
+<?PHP
22
+$EID = $_POST['EID'];
23
+
24
+$queryDeleteUser = "DELETE FROM events WHERE EID = $EID";
25
+mysqli_query($connection, $queryDeleteUser);
26
+header("Location: eventsTable.php");
27
+exit();
28
+?>

+ 28
- 0
deleteUser.php Parādīt failu

@@ -0,0 +1,28 @@
1
+<?PHP
2
+
3
+//---------------
4
+// Connection to server and database
5
+//---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+?>
20
+
21
+<?PHP
22
+$UID = $_POST['UID'];
23
+
24
+$queryDeleteUser = "DELETE FROM users WHERE UID = $UID";
25
+mysqli_query($connection, $queryDeleteUser);
26
+header("Location: usersTable.php");
27
+exit();
28
+?>

+ 0
- 17
donar.js Parādīt failu

@@ -1,17 +0,0 @@
1
-import * as React from 'react';
2
-import { StyleSheet, View, Text } from 'react-native';
3
-import Header from '../shared/header';
4
-
5
-export default function Donate({navigation}) {
6
-    return (
7
-        <View style={styles.container}>
8
-         <Text>Donate Screen</Text>
9
-        </View>
10
-    )
11
-}
12
-
13
-const styles = StyleSheet.create({
14
-    container: {
15
-        padding: 24
16
-    }
17
-});

+ 0
- 16
drawer.js Parādīt failu

@@ -1,16 +0,0 @@
1
-import { createDrawerNavigator } from "react-navigation-drawer";
2
-import { createAppContainer } from "react-navigation";
3
-
4
-import HomeStack from './homeStack';
5
-import About from './screens/about';
6
-
7
-const RootDrawerNavigator = createDrawerNavigator ({
8
-    Home: {
9
-        screen: HomeStack,
10
-    },
11
-    About: {
12
-        screen: About,
13
-    }
14
-})
15
-
16
-export default createAppContainer(RootDrawerNavigator);

+ 211
- 0
eventsTable.php Parādīt failu

@@ -0,0 +1,211 @@
1
+<!-- Events Page for TPMG -->
2
+
3
+<!-- http://https://ada.uprrp.edu/~pablo.puig1/TPMG/eventsTable.php -->
4
+
5
+<!--Page background color-->
6
+
7
+<body style="background-color:#6cd1f4">
8
+
9
+<!--Navigation Bar-->
10
+
11
+<!doctype html>
12
+<html lang="en">
13
+  <head>
14
+    <meta charset="utf-8">
15
+    <meta name="viewport" content="width=device-width, initial-scale=1">
16
+    <title>TPMG admin</title>
17
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
18
+  </head>
19
+    <body>
20
+    <nav class="navbar navbar-expand-lg bg-light">
21
+        <div class="container-fluid">
22
+          <!-- <a class="navbar-brand" href="/">TPMG</a> -->
23
+          <img src="LogoSidename.png" alt="logo" width="200"/>
24
+          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
25
+            <span class="navbar-toggler-icon"></span>
26
+          </button>
27
+          <div class="collapse navbar-collapse" id="navbarSupportedContent">
28
+            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
29
+              <li class="nav-item">
30
+                <a href="TPMG.php" class="nav-link active" aria-current="page">Home</a>
31
+              </li>
32
+              <li class="nav-item">
33
+                <a href="usersTable.php" class="nav-link">Users</a>
34
+              </li>
35
+              <li class="nav-item">
36
+                <a href="eventsTable.php" class="nav-link">Events</a>
37
+              </li>
38
+              <li class="nav-item">
39
+                <a href="about.php" class="nav-link">About</a>
40
+              </li>
41
+            </ul>          
42
+          </div>
43
+        </div>
44
+    </nav>
45
+
46
+<?PHP
47
+
48
+//---------------
49
+// Connection to server and database
50
+//---------------
51
+
52
+$host = "localhost";
53
+$basedatos = "techos";
54
+$user = "pablo.puig1";
55
+$passw = "9NA3kSExI2fGE6eV";
56
+
57
+try{
58
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
59
+}
60
+catch(Exception $ex){
61
+    print("Error connecting to database: ". $ex->getMessage()) and die();
62
+}
63
+
64
+?>
65
+
66
+<!-- Add User Panel -->
67
+
68
+<div class="container-fluid px-1 py-5 mx-auto">
69
+    <div class="row d-flex justify-content-center">
70
+        <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
71
+            <div class="card">
72
+                <h5 class="text-left mb-4">Enter Information to Add Event:</h5>
73
+                <form class="form-card" method="post" action="./addEvent.php">
74
+                    <div class="row justify-content-between text-left">
75
+                        <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">Event name<span class="text-danger"> *</span></label> <input type="text" id="name" name="name" placeholder="" onblur="validate(1)" style="width: 275px"> </div>
76
+                    </div>
77
+                    <div class="row justify-content-between text-left">
78
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Start date<span class="text-danger"> *</span></label> <input type="text" id="Sdate" name="Sdate" placeholder="YYYY-MM-DD" onblur="validate(2)" > </div>
79
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">End date<span class="text-danger"> *</span></label> <input type="text" id="Edate" name="Edate" placeholder="YYYY-MM-DD" onblur="validate(3)" > </div>
80
+                    </div>
81
+                    <br>
82
+                    <div class="row justify-content-between text-left">
83
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Participant count<span class="text-danger"> *</span></label><input type="int" id="Pcount" name="Pcount" placeholder="" onblur="validate(4)"> </div>
84
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Participant limit<span class="text-danger"> *</span></label> <input type="int" id="Plimit" name="Plimit" placeholder="" onblur="validate(5)"> </div>
85
+                    </div>
86
+                    <br>
87
+                    <div class="row justify-content-between text-left">
88
+                        <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">Event description<span class="text-danger"> *</span></label> <input type="text" id="Desc" name="Desc" placeholder="" onblur="validate(1)" style="width: 900px"> </div>
89
+                    </div>
90
+                    <br>
91
+                    <div class="row justify-content-end">
92
+                        <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Add">Add</button> </div>
93
+                    </div>
94
+                </form>
95
+            </div>
96
+        </div>
97
+    </div>
98
+    <br>
99
+<!-- Delete User Panel -->
100
+    <div class="row d-flex justify-content-center">
101
+        <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
102
+            <div class="card">
103
+                <h5 class="text-left mb-4">Enter Event-ID to delete:</h5>
104
+                <form class="form-card" method="post" action="./deleteEvent.php">
105
+                    <div class="row justify-content-between text-left">
106
+                        <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">Event-ID<span class="text-danger"> *</span></label> <input type="int" id="EID" name="EID" placeholder="" onblur="validate(1)" style="width: 275px"> </div>
107
+                    </div>
108
+                    <br>
109
+                    <div class="row justify-content-end">
110
+                        <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Delete">Delete</button> </div>
111
+                    </div>
112
+                </form>
113
+            </div>
114
+        </div>
115
+    </div>
116
+  </div>
117
+
118
+<!-- Table  -->
119
+
120
+<style>
121
+
122
+    table{
123
+        border-collapse: collapse;
124
+        width: 75%
125
+    }
126
+    th, td {
127
+        padding: 8px;
128
+        text-align: left;
129
+        border-bottom: 1px solid black;
130
+    }
131
+    rt {
132
+        background-color: #D6EEEE
133
+    }
134
+</style>
135
+<table style="background-color: #ffffff;margin-left:auto;margin-right:auto">
136
+<?PHP
137
+
138
+//---------------
139
+// Table that displays Users in the server
140
+//---------------
141
+
142
+$queryUsers= "SELECT * from events";
143
+$stmt=mysqli_prepare($connection, $queryUsers);
144
+mysqli_stmt_execute($stmt);
145
+
146
+mysqli_stmt_bind_result($stmt, $eid, $name, $start_date, $end_date, $participant_count, $participant_limit, $description);
147
+
148
+//Making table headers
149
+print "<tr>";
150
+print "<td>";
151
+print "Event-ID"; //eid
152
+print "</td>";
153
+print "<td>";
154
+print "Name"; //name
155
+print "</td>";
156
+print "<td>";
157
+print "Start Date"; //start_date
158
+print "</td>";
159
+print "<td>";
160
+print "End Date"; //end_date
161
+print "</td>";
162
+print "<td>";
163
+print "Participant Count"; //participant_count
164
+print "</td>";
165
+print "<td>";
166
+print "Participant Limit"; //participant_limit
167
+print "</td>";
168
+print "<td>";
169
+print "Description"; //description
170
+print "</td>";
171
+print "</tr>";
172
+
173
+while(mysqli_stmt_fetch($stmt)){
174
+    
175
+    print "<tr>";
176
+    print "<td>";
177
+    print $eid; //printing EID
178
+    print "</td>";
179
+    print "<td>";
180
+    print $name; //printing name
181
+    print "</td>";
182
+    print "<td>";
183
+    print $start_date; //printing start_date
184
+    print "</td>";
185
+    print "<td>";
186
+    print $end_date; //printing end_date
187
+    print "</td>";
188
+    print "<td>";
189
+    print $participant_count; //printing participant_count
190
+    print "</td>";
191
+    print "<td>";
192
+    print $participant_limit; //printing participant_limit
193
+    print "</td>";
194
+    print "<td>";
195
+    print $description; //printing description
196
+    print "</td>";
197
+    print "</tr>";
198
+
199
+    print "\n";
200
+}
201
+?>
202
+</table>
203
+
204
+
205
+
206
+<br/>
207
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
208
+        <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
209
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
210
+    </body>
211
+</html>

+ 81
- 0
eventslist.php Parādīt failu

@@ -0,0 +1,81 @@
1
+<?PHP
2
+
3
+// ---------------
4
+// Connection to server and database
5
+// ---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+// //---------------
20
+// // Query and sending results
21
+// //---------------
22
+header('Content-Type: application/json');
23
+
24
+$encodedData=file_get_contents('php://input');
25
+$decodedData=json_decode($encodedData, true);
26
+
27
+$FindEID=$decodedData["FindEID"];
28
+
29
+$query= "SELECT eid, name, start_date, end_date, participant_count, participant_limit, description from events";
30
+$stmt=mysqli_prepare($connection, $query);
31
+mysqli_stmt_execute($stmt);
32
+
33
+mysqli_stmt_bind_result($stmt, $eid, $name, $start_date, $end_date, $participant_count, $participant_limit, $description);
34
+
35
+while(mysqli_stmt_fetch($stmt)){
36
+
37
+    $response[] = array("id"=>$eid, "activityName"=>$name, "subscribed"=> false, "icon"=> 'person-add-outline', "startDate"=>$start_date, "endDate"=>$end_date, "totalSubscribed"=>$participant_count, "maxSubscribed"=>$participant_limit, "activityDescription"=>$description);
38
+
39
+}
40
+
41
+
42
+// if(mysqli_num_rows($stmt)>0)
43
+// {
44
+//     $Row = mysqli_fetch_assoc($stmt);
45
+//     $eid = $Row['eid'];
46
+//     $name = $Row['name'];
47
+//     $start_date = $Row['start_date'];
48
+//     $end_date = $Row['end_date'];
49
+//     $participant_count = $Row['participant_count'];
50
+//     $participant_limit = $Row['participant_limit'];
51
+//     $description = $Row['description'];
52
+// }
53
+// else
54
+// {
55
+//     $eid = "";
56
+//     $name = "";
57
+//     $start_date = "";
58
+//     $end_date = "";
59
+//     $participant_count = "";
60
+//     $participant_limit = "";
61
+//     $description = "";
62
+// }
63
+
64
+
65
+// ----------------------------------------------
66
+// $eid = '1';
67
+// $name = 'testEvent';
68
+// $start_date = '2023-01-07';
69
+// $end_date = '2023-01-23';
70
+// $participant_count = '13';
71
+// $participant_limit = '20';
72
+// $description = 'TEST TEST TEST TEST TEST TEST TEST TEST';
73
+//-----------------------------------------------
74
+
75
+// $response[] = array("eid"=>$eid, "name"=>$name, "Sdate"=>$start_date, "Edate"=>$end_date, "Pcount"=>$participant_count, "Plimit"=>$participant_limit, "description"=>$description);
76
+echo json_encode($response);
77
+// $TPMGJson = json_encode($response);
78
+// file_put_contents('./events.json', $TPMGJson);
79
+// echo $TPMGJson;
80
+
81
+?>

Binārs
favicon.png Parādīt failu


+ 0
- 17
gallery.js Parādīt failu

@@ -1,17 +0,0 @@
1
-import * as React from 'react';
2
-import { StyleSheet, View, Text } from 'react-native';
3
-import Header from '../shared/header';
4
-
5
-export default function Gallery() {
6
-    return (
7
-        <View style={styles.container}>
8
-         <Text>Gallery Screen</Text>
9
-        </View>
10
-    )
11
-}
12
-
13
-const styles = StyleSheet.create({
14
-    container: {
15
-        padding: 24
16
-    }
17
-});

+ 0
- 44
header.js Parādīt failu

@@ -1,44 +0,0 @@
1
-import React from 'react';
2
-import {StyleSheet, Text, View, Image} from 'react-native';
3
-import { DrawerActions } from 'react-navigation';
4
-import {MaterialIcons} from '@expo/vector-icons';
5
-
6
-export default function Header({navigation}) {
7
-    const openMenu = () => {
8
-        navigation.openDrawer()
9
-    }
10
-    return (
11
-        <View style={styles.header}>
12
-            
13
-            <View>
14
-                <Image 
15
-                style={styles.tinyLogo}
16
-                source={require('../assets/logo.png')} />
17
-            </View>
18
-        </View>
19
-    );
20
-}
21
-
22
-const styles = StyleSheet.create({
23
-    header: {
24
-        width: '100%',
25
-        height: '100%',
26
-        flexDirection: 'row',
27
-        alignItems: 'center',
28
-        justifyContent: 'center',
29
-    },
30
-    headerText: {
31
-        fontweight: 'bold',
32
-        fontSize: 20,
33
-        color: '#333',
34
-        letterSpacing: 1,
35
-    },
36
-    icon: {
37
-        position: 'absolute',
38
-        left: -75
39
-    },
40
-    tinyLogo: {
41
-        width:120,
42
-        height:35,
43
-    },
44
-})

+ 0
- 37
homeStack.js Parādīt failu

@@ -1,37 +0,0 @@
1
-import * as React from 'react';
2
-import { createStackNavigator } from "react-navigation-stack";
3
-import { createAppContainer } from "react-navigation";
4
-import About from '../screens/about'
5
-import Gallery from '../screens/gallery'
6
-import Header from '../shared/header';
7
-
8
-const screens = {
9
-    About: {
10
-        screen: About,
11
-        navigationOptions: ({navigation}) => {
12
-            return {
13
-                headerTitle: () => <Header navigation={navigation}/>,
14
-            }
15
-        }
16
-    },
17
-    Gallery: {
18
-        screen: Gallery,
19
-        navigationOptions: ({navigation}) => {
20
-            return {
21
-                headerTitle: () => <Header navigation={navigation}/>,
22
-            }
23
-        }
24
-    },
25
-    Calendar: {
26
-        screen: Calendar,
27
-        navigationOptions: ({navigation}) => {
28
-            return {
29
-                headerTitle: () => <Header navigation={navigation}/>,
30
-            }
31
-        }
32
-    },
33
-}
34
-
35
-const HomeStack = createStackNavigator(screens);
36
-
37
-export default createAppContainer(HomeStack);

Binārs
icon.png Parādīt failu


+ 80
- 0
joinslist.php Parādīt failu

@@ -0,0 +1,80 @@
1
+<?PHP
2
+
3
+// ---------------
4
+// Connection to server and database
5
+// ---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+// //---------------
20
+// // Query and sending results
21
+// //---------------
22
+header('Content-Type: application/json');
23
+
24
+$encodedData=file_get_contents('php://input');
25
+$decodedData=json_decode($encodedData, true);
26
+
27
+$FindUID=$decodedData["FindUID"];
28
+
29
+$query= "SELECT UID, EID from joins";
30
+$stmt=mysqli_prepare($connection, $query);
31
+mysqli_stmt_execute($stmt);
32
+
33
+mysqli_stmt_bind_result($stmt, $uid, $eid);
34
+
35
+while(mysqli_stmt_fetch($stmt)){
36
+
37
+    $response[] = array("uid"=>$uid, "eid"=>$eid);
38
+
39
+}
40
+
41
+// if(mysqli_num_rows($stmt)>0)
42
+// {
43
+//     $Row = mysqli_fetch_assoc($stmt);
44
+//     $eid = $Row['eid'];
45
+//     $name = $Row['name'];
46
+//     $start_date = $Row['start_date'];
47
+//     $end_date = $Row['end_date'];
48
+//     $participant_count = $Row['participant_count'];
49
+//     $participant_limit = $Row['participant_limit'];
50
+//     $description = $Row['description'];
51
+// }
52
+// else
53
+// {
54
+//     $eid = "";
55
+//     $name = "";
56
+//     $start_date = "";
57
+//     $end_date = "";
58
+//     $participant_count = "";
59
+//     $participant_limit = "";
60
+//     $description = "";
61
+// }
62
+
63
+
64
+// ----------------------------------------------
65
+// $eid = '1';
66
+// $name = 'testEvent';
67
+// $start_date = '2023-01-07';
68
+// $end_date = '2023-01-23';
69
+// $participant_count = '13';
70
+// $participant_limit = '20';
71
+// $description = 'TEST TEST TEST TEST TEST TEST TEST TEST';
72
+//-----------------------------------------------
73
+
74
+// $response[] = array("eid"=>$eid, "name"=>$name, "Sdate"=>$start_date, "Edate"=>$end_date, "Pcount"=>$participant_count, "Plimit"=>$participant_limit, "description"=>$description);
75
+echo json_encode($response);
76
+// $TPMGJson = json_encode($response);
77
+// file_put_contents('./events.json', $TPMGJson);
78
+// echo $TPMGJson;
79
+
80
+?>

+ 37
- 0
loginUserAdd.php Parādīt failu

@@ -0,0 +1,37 @@
1
+<?PHP
2
+
3
+// ---------------
4
+// Connection to server and database
5
+// ---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+// //---------------
20
+// // Query and sending results
21
+// //---------------
22
+header('Content-Type: application/json');
23
+
24
+$encodedData=file_get_contents('php://input');
25
+$decodedData=json_decode($encodedData, true);
26
+
27
+$addName=$decodedData["name"];
28
+$addEmail=$decodedData["email"];
29
+$addPhone=$decodedData["phone"];
30
+
31
+$queryAddUser = "INSERT INTO users (name, email, phone_num) VALUES ('$addName', '$addEmail', '$addPhone')";
32
+mysqli_query($connection, $queryAddUser);
33
+// $stmtAdd = mysqli_prepare($connection, $queryAddUser);
34
+// mysqli_stmt_execute($stmtAdd);
35
+
36
+
37
+?>

Binārs
logo.png Parādīt failu


+ 0
- 39
package.json Parādīt failu

@@ -1,39 +0,0 @@
1
-{
2
-  "name": "tpmgnav",
3
-  "version": "1.0.0",
4
-  "main": "node_modules/expo/AppEntry.js",
5
-  "scripts": {
6
-    "start": "expo start",
7
-    "android": "expo start --android",
8
-    "ios": "expo start --ios",
9
-    "web": "expo start --web"
10
-  },
11
-  "dependencies": {
12
-    "@emotion/react": "^11.10.5",
13
-    "@emotion/styled": "^11.10.5",
14
-    "@expo/webpack-config": "^0.17.2",
15
-    "@mui/material": "^5.10.15",
16
-    "@react-navigation/drawer": "^6.5.1",
17
-    "@react-navigation/native": "^6.0.14",
18
-    "@react-navigation/native-stack": "^6.9.2",
19
-    "expo": "~47.0.7",
20
-    "expo-dev-client": "~2.0.1",
21
-    "expo-status-bar": "~1.4.2",
22
-    "expo-web-browser": "^12.0.0",
23
-    "react": "18.1.0",
24
-    "react-dom": "18.1.0",
25
-    "react-native": "0.70.5",
26
-    "react-native-gesture-handler": "^2.8.0",
27
-    "react-native-reanimated": "~2.12.0",
28
-    "react-native-safe-area-context": "4.4.1",
29
-    "react-native-screens": "~3.18.0",
30
-    "react-native-web": "~0.18.9",
31
-    "react-navigation": "^4.4.4",
32
-    "react-navigation-stack": "^2.10.4",
33
-    "yarn": "^1.22.19"
34
-  },
35
-  "devDependencies": {
36
-    "@babel/core": "^7.12.9"
37
-  },
38
-  "private": true
39
-}

+ 0
- 17
solicitar.js Parādīt failu

@@ -1,17 +0,0 @@
1
-import * as React from 'react';
2
-import { StyleSheet, View, Text } from 'react-native';
3
-import Header from '../shared/header';
4
-
5
-export default function Solicitar({navigation}) {
6
-    return (
7
-        <View style={styles.container}>
8
-         <Text>Solicitar Screen</Text>
9
-        </View>
10
-    )
11
-}
12
-
13
-const styles = StyleSheet.create({
14
-    container: {
15
-        padding: 24
16
-    },
17
-});

+ 0
- 66
sorting.py Parādīt failu

@@ -1,66 +0,0 @@
1
-"""
2
-Carlos J Corrada Bravo
3
-Este programa calcula el promedio de tiempo de ejecucion de cuatro algoritmos de ordenamiento
4
-La variable maxValor define el valor maximo de los elementos de la lista
5
-La variable largoLista define el largo de las listas a ordenar
6
-La variable veces define las veces que se va a hacer el ordenamiento 
7
-Al final se imprimen los promedios de cada algortimo
8
-"""
9
-from random import randint
10
-import time
11
-
12
-def mergeSort(lista):
13
-	#definan el algoritmo de ordenamiento mergesort
14
-	return lista
15
-
16
-def heapSort(lista):
17
-	#definan el algoritmo de ordenamiento heapsort
18
-	return lista
19
-
20
-def quickSort(lista):
21
-	#definan el algoritmo de ordenamiento quicksort
22
-	return lista
23
-
24
-def shellSort(lista):
25
-	#definan el algoritmo de ordenamiento shellsort
26
-	return lista
27
-
28
-maxValor=1000 	#define el valor maximo de los elementos de la lista
29
-largoLista=1000 #define el largo de las listas a ordenar
30
-veces=100 		#define las veces que se va a hacer el ordenamiento 
31
-
32
-acumulaMerge=0 	#variable para acumular el tiempo de ejecucion del mergesort
33
-acumulaHeap=0 	#variable para acumular el tiempo de ejecucion del heapsort
34
-acumulaQuick=0 	#variable para acumular el tiempo de ejecucion del quicksort
35
-acumulaShell=0 	#variable para acumular el tiempo de ejecucion del shellsort
36
-
37
-for i in range(veces):
38
-	mergelista = [randint(0,maxValor) for r in range(largoLista)] #creamos una lista con valores al azar
39
-	heaplista=list(mergelista)
40
-	quicklista=list(mergelista)
41
-	searchlista=list(mergelista)
42
-
43
-	t1 = time.clock() 				#seteamos el tiempo al empezar
44
-	mergeSort(mergelista) 				#ejecutamos el algoritmo mergeSort
45
-	acumulaMerge+=time.clock()-t1 	#acumulamos el tiempo de ejecucion
46
-	
47
-	t1 = time.clock()				#seteamos el tiempo al empezar
48
-	heapSort(heaplista)					#ejecutamos el algoritmo heapSort
49
-	acumulaHeap+=time.clock()-t1 	#acumulamos el tiempo de ejecucion
50
-	
51
-	t1 = time.clock()				#seteamos el tiempo al empezar
52
-	quickSort(quicklista)				#ejecutamos el algoritmo quickSort
53
-	acumulaQuick+=time.clock()-t1 	#acumulamos el tiempo de ejecucion
54
-	
55
-	t1 = time.clock()				#seteamos el tiempo al empezar
56
-	shellSort(searchlista)				#ejecutamos el algoritmo shellSort
57
-	acumulaShell+=time.clock()-t1 	#acumulamos el tiempo de ejecucion
58
-
59
-#imprimos los resultados
60
-print "Promedio de tiempo de ejecucion de "+ str(veces) +" listas de largo " + str(largoLista)
61
-print "MergeSort " + str(acumulaMerge/veces) + " segundos"
62
-print "HeapSort " + str(acumulaHeap/veces) + " segundos"
63
-print "QuickSort " + str(acumulaQuick/veces) + " segundos"
64
-print "ShellSort " + str(acumulaShell/veces) + " segundos"
65
-
66
-

Binārs
splash.png Parādīt failu


+ 190
- 0
usersTable.php Parādīt failu

@@ -0,0 +1,190 @@
1
+<!-- Users table Page for TPMG -->
2
+
3
+<!-- http://https://ada.uprrp.edu/~pablo.puig1/TPMG/userTable.php -->
4
+
5
+<!--Page background color-->
6
+
7
+<body style="background-color:#6cd1f4">
8
+
9
+<!--Navigation Bar-->
10
+
11
+<!doctype html>
12
+<html lang="en">
13
+  <head>
14
+    <meta charset="utf-8">
15
+    <meta name="viewport" content="width=device-width, initial-scale=1">
16
+    <title>TPMG admin</title>
17
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
18
+  </head>
19
+    <nav class="navbar navbar-expand-lg bg-light">
20
+        <div class="container-fluid">
21
+          <!-- <a class="navbar-brand" href="/">TPMG</a> -->
22
+          <img src="LogoSidename.png" alt="logo" width="200"/>
23
+          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
24
+            <span class="navbar-toggler-icon"></span>
25
+          </button>
26
+          <div class="collapse navbar-collapse" id="navbarSupportedContent">
27
+            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
28
+              <li class="nav-item">
29
+                <a href="TPMG.php" class="nav-link active" aria-current="page">Home</a>
30
+              </li>
31
+              <li class="nav-item">
32
+                <a href="usersTable.php" class="nav-link">Users</a>
33
+              </li>
34
+              <li class="nav-item">
35
+                <a href="eventsTable.php" class="nav-link">Events</a>
36
+              </li>
37
+              <li class="nav-item">
38
+                <a href="about.php" class="nav-link">About</a>
39
+              </li>
40
+            </ul>          
41
+          </div>
42
+        </div>
43
+    </nav>
44
+
45
+<?PHP
46
+
47
+//---------------
48
+// Connection to server and database
49
+//---------------
50
+
51
+$host = "localhost";
52
+$basedatos = "techos";
53
+$user = "pablo.puig1";
54
+$passw = "9NA3kSExI2fGE6eV";
55
+
56
+try{
57
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
58
+}
59
+catch(Exception $ex){
60
+    print("Error connecting to database: ". $ex->getMessage()) and die();
61
+}
62
+
63
+?>
64
+
65
+<!-- Add User Panel -->
66
+
67
+<div class="container-fluid px-1 py-5 mx-auto">
68
+    <div class="row d-flex justify-content-center">
69
+        <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
70
+            <div class="card">
71
+                <h5 class="text-left mb-4">Enter Information to Add User:</h5>
72
+                <form class="form-card" method="post" action="./addUser.php">
73
+                    <div class="row justify-content-between text-left">
74
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">First and Last name<span class="text-danger"> *</span></label> <input type="text" id="username" name="username" placeholder="" onblur="validate(1)" > </div>
75
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Account type<span class="text-danger"> *</span></label> <input type="text" id="ACC" name="ACC" placeholder="" onblur="validate(2)" > </div>
76
+                    </div>
77
+                    <br>
78
+                    <div class="row justify-content-between text-left">
79
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Email<span class="text-danger"> *</span></label><input type="text" id="email" name="email" placeholder="" onblur="validate(3)"> </div>
80
+                        <div class="form-group col-sm-6 flex-column d-flex"> <label class="form-control-label px-3">Phone number<span class="text-danger"> *</span></label> <input type="text" id="phone" name="phone" placeholder="" onblur="validate(4)"> </div>
81
+                    </div>
82
+                    <br>
83
+                    <div class="row justify-content-end">
84
+                        <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Add">Add</button> </div>
85
+                    </div>
86
+                </form>
87
+            </div>
88
+        </div>
89
+    </div>
90
+    <br>
91
+<!-- Delete User Panel -->
92
+    <div class="row d-flex justify-content-center">
93
+        <div class="col-xl-7 col-lg-8 col-md-9 col-11 text-center">
94
+            <div class="card">
95
+                <h5 class="text-left mb-4">Enter User-ID to delete:</h5>
96
+                <form class="form-card" method="post" action="./deleteUser.php">
97
+                    <div class="row justify-content-between text-left">
98
+                        <div class="row d-flex justify-content-center"> <label class="form-control-label px-3">User-ID<span class="text-danger"> *</span></label> <input type="int" id="UID" name="UID" placeholder="" onblur="validate(1)" style="width: 275px"> </div>
99
+                    </div>
100
+                    <br>
101
+                    <div class="row justify-content-end">
102
+                        <div class="form-group col-mb-4"> <button type="submit" class="btn btn-primary" value="Delete">Delete</button> </div>
103
+                    </div>
104
+                </form>
105
+            </div>
106
+        </div>
107
+    </div>
108
+  </div>
109
+
110
+<!-- Table  -->
111
+
112
+<style>
113
+
114
+    table{
115
+        border-collapse: collapse;
116
+        width: 75%
117
+    }
118
+    th, td {
119
+        padding: 8px;
120
+        text-align: left;
121
+        border-bottom: 1px solid black;
122
+    }
123
+    rt {
124
+        background-color: #D6EEEE
125
+    }
126
+</style>
127
+<table style="background-color: #ffffff;margin-left:auto;margin-right:auto">
128
+<?PHP
129
+
130
+//---------------
131
+// Table that displays Users in the server
132
+//---------------
133
+
134
+$querySeeUsers= "SELECT * from users";
135
+$stmtSee=mysqli_prepare($connection, $querySeeUsers);
136
+mysqli_stmt_execute($stmtSee);
137
+
138
+mysqli_stmt_bind_result($stmtSee, $uid, $acc_type, $name, $email, $phone);
139
+
140
+//Making table headers
141
+print "<tr>";
142
+print "<td>";
143
+print "User-ID"; //User-ID
144
+print "</td>";
145
+print "<td>";
146
+print "Account Type"; //Account type
147
+print "</td>";
148
+print "<td>";
149
+print "Name"; //Name
150
+print "</td>";
151
+print "<td>";
152
+print "Email"; //Email
153
+print "</td>";
154
+print "<td>";
155
+print "Phone"; //Phone
156
+print "</td>";
157
+print "</tr>";
158
+
159
+ //iterating line by line
160
+ while(mysqli_stmt_fetch($stmtSee)){
161
+    
162
+    print "<tr>";
163
+    print "<td>";
164
+    print $uid; //printing UID
165
+    print "</td>";
166
+    print "<td>";
167
+    print $acc_type; //printing account type
168
+    print "</td>";
169
+    print "<td>";
170
+    print $name; //printing name
171
+    print "</td>";
172
+    print "<td>";
173
+    print $email; //printing email
174
+    print "</td>";
175
+    print "<td>";
176
+    print $phone; //printing phone
177
+    print "</td>";
178
+
179
+    print "\n";
180
+}
181
+?>
182
+</table>
183
+
184
+
185
+<br/>
186
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
187
+        <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
188
+        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
189
+</body>
190
+</html>

+ 80
- 0
userslist.php Parādīt failu

@@ -0,0 +1,80 @@
1
+<?PHP
2
+
3
+// ---------------
4
+// Connection to server and database
5
+// ---------------
6
+
7
+$host = "localhost";
8
+$basedatos = "techos";
9
+$user = "pablo.puig1";
10
+$passw = "9NA3kSExI2fGE6eV";
11
+
12
+try{
13
+    $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
14
+}
15
+catch(Exception $ex){
16
+    print("Error connecting to database: ". $ex->getMessage()) and die();
17
+}
18
+
19
+// //---------------
20
+// // Query and sending results
21
+// //---------------
22
+header('Content-Type: application/json');
23
+
24
+$encodedData=file_get_contents('php://input');
25
+$decodedData=json_decode($encodedData, true);
26
+
27
+$FindUID=$decodedData["FindUID"];
28
+
29
+$query= "SELECT UID, acc_type, name, email, phone_num from users";
30
+$stmt=mysqli_prepare($connection, $query);
31
+mysqli_stmt_execute($stmt);
32
+
33
+mysqli_stmt_bind_result($stmt, $uid, $acc_type, $name, $email, $phone);
34
+
35
+while(mysqli_stmt_fetch($stmt)){
36
+
37
+    $response[] = array("id"=>$uid, "accountType"=>$acc_type, "name"=> $name, "email"=> $email, "phone"=>$phone);
38
+
39
+}
40
+
41
+// if(mysqli_num_rows($stmt)>0)
42
+// {
43
+//     $Row = mysqli_fetch_assoc($stmt);
44
+//     $eid = $Row['eid'];
45
+//     $name = $Row['name'];
46
+//     $start_date = $Row['start_date'];
47
+//     $end_date = $Row['end_date'];
48
+//     $participant_count = $Row['participant_count'];
49
+//     $participant_limit = $Row['participant_limit'];
50
+//     $description = $Row['description'];
51
+// }
52
+// else
53
+// {
54
+//     $eid = "";
55
+//     $name = "";
56
+//     $start_date = "";
57
+//     $end_date = "";
58
+//     $participant_count = "";
59
+//     $participant_limit = "";
60
+//     $description = "";
61
+// }
62
+
63
+
64
+// ----------------------------------------------
65
+// $eid = '1';
66
+// $name = 'testEvent';
67
+// $start_date = '2023-01-07';
68
+// $end_date = '2023-01-23';
69
+// $participant_count = '13';
70
+// $participant_limit = '20';
71
+// $description = 'TEST TEST TEST TEST TEST TEST TEST TEST';
72
+//-----------------------------------------------
73
+
74
+// $response[] = array("eid"=>$eid, "name"=>$name, "Sdate"=>$start_date, "Edate"=>$end_date, "Pcount"=>$participant_count, "Plimit"=>$participant_limit, "description"=>$description);
75
+echo json_encode($response);
76
+// $TPMGJson = json_encode($response);
77
+// file_put_contents('./events.json', $TPMGJson);
78
+// echo $TPMGJson;
79
+
80
+?>