Ajout ou correction sur develop___21:49
This commit is contained in:
43
domo91.py
43
domo91.py
@@ -511,27 +511,28 @@ if st.session_state["authenticated"]:
|
||||
except Exception as e:
|
||||
st.error(f"Erreur SQL (admin) : {e}")
|
||||
|
||||
|
||||
# --- ONGLET TRAFFIC ------
|
||||
elif onglet == "Traffic":
|
||||
st.markdown("## 🚦 Connexions récentes")
|
||||
try:
|
||||
conn = mysql.connector.connect(**db_config)
|
||||
cursor = conn.cursor(dictionary=True)
|
||||
cursor.execute(
|
||||
"SELECT Utilisateur, Lieu, Date_Connexion FROM Connexion_Log WHERE Lieu IS NOT NULL ORDER BY Date_Connexion DESC LIMIT 200"
|
||||
)
|
||||
connexions = cursor.fetchall()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
elif onglet == "Traffic":
|
||||
st.markdown("## 🚦 Connexions récentes")
|
||||
try:
|
||||
conn = mysql.connector.connect(**db_config)
|
||||
cursor = conn.cursor(dictionary=True)
|
||||
cursor.execute(
|
||||
"SELECT Utilisateur, Lieu, Date_Connexion FROM Connexion_Log WHERE Lieu IS NOT NULL ORDER BY Date_Connexion DESC LIMIT 200"
|
||||
)
|
||||
connexions = cursor.fetchall()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
if connexions:
|
||||
df_connexions = pd.DataFrame(connexions)
|
||||
st.success(f"{len(df_connexions)} connexions trouvées.") # Compteur affiché proprement
|
||||
st.dataframe(df_connexions, use_container_width=True)
|
||||
else:
|
||||
st.info("Aucune connexion enregistrée.")
|
||||
except Exception as e:
|
||||
st.error(f"Erreur chargement des connexions : {e}")
|
||||
if connexions:
|
||||
df_connexions = pd.DataFrame(connexions)
|
||||
st.dataframe(df_connexions, use_container_width=True)
|
||||
else:
|
||||
st.info("Aucune connexion enregistrée.")
|
||||
except Exception as e:
|
||||
st.error(f"Erreur chargement des connexions : {e}")
|
||||
|
||||
except Exception as err: # petit bug dans ton except ici (tu avais écrit "except exception")
|
||||
st.error(f"Erreur MySQL : {err}")
|
||||
|
||||
except Exception as err:
|
||||
st.error(f"Erreur MySQL : {err}")
|
||||
Reference in New Issue
Block a user