post sp24 login changes

This commit is contained in:
Coding with Peter 2024-01-29 15:38:30 -08:00
parent 87410d5f09
commit cfd9b24303
4 changed files with 63 additions and 1 deletions

View File

@ -228,6 +228,8 @@ function appdata() {
// hosts
$hh = multi_row_1d("select session FROM conf_hosts WHERE host='{$USER['conf_id']}';");
$hbs = multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE s.id>1319 ORDER BY u.name;",0);
// conferences
$c = multi_row_select('SELECT * FROM conf_conferences;',0);
@ -241,6 +243,7 @@ function appdata() {
"mysessions" => $m,
"sessions" => $s,
"host" => $hh,
"hostbysession" => $hbs,
"user" => $USER,
"conference" => $c,
"ay" => $y,

53
fix_users.php Normal file
View File

@ -0,0 +1,53 @@
<?php
$TEST = 1;
// Create a new mysqli instance
if ($TEST) {
$mysqli = new mysqli("192.168.1.6", "phowell", "rolley34", "db");
} else {
$mysqli = new mysqli("localhost", "phowell", "p^howell", "PeterDB");
}
// Check for connection error
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
// Start a query to get rows ordered by 'goo'
$query = "SELECT * FROM conf_users ORDER BY goo DESC LIMIT 5000";
$result = $mysqli->query($query);
// Key: goo, Value: id
$goo_to_id = array();
// Iterating through each result
while ($row = $result->fetch_assoc()) {
$id = $row['id'];
$goo = $row['goo'];
// Check if an entry exists for this 'goo'
if (array_key_exists($goo, $goo_to_id)) {
// Save lower and higher id
$lower_id = min($id, $goo_to_id[$goo]);
$higher_id = max($id, $goo_to_id[$goo]);
echo "(test) UPDATE conf_signups SET user={$lower_id} WHERE user={$higher_id}\n<br>\n";
// Prepare an update statement and execute
if (! $TEST) {
$update_stmt = $mysqli->prepare("UPDATE conf_signups SET user=? WHERE user=?");
$update_stmt->bind_param("ii", $lower_id, $higher_id);
$update_stmt->execute();
echo "UPDATE conf_signups SET user={$lower_id} WHERE user={$higher_id}\n<br>\n";
}
} else {
$goo_to_id[$goo] = $id;
}
}
// Closing the database connection
$mysqli->close();

View File

@ -925,7 +925,7 @@ const ActivityList = Vue.component('activitylist', {
methods: {
hoststr: function(id) { var self = this
return _.reduce( self.hosts_by_sesid[id], function(mem,val) { if (val.name) { return mem + val.name + ", " } return mem }, '') },
mode_string: function(a) { if (this.active>3) { return _.findWhere(this.$root.modes_menu, { 'id': a.mode })['string'] } return a.mode },
mode_string: function(a) { if (this.$root.active) { return _.findWhere(this.$root.modes_menu, { 'id': a.mode })['string'] } return a.mode },
get_day_title: function(day) {
console.log(day)
var d = dayjs(day, 'MMM DD YYYY')
@ -942,6 +942,10 @@ const ActivityList = Vue.component('activitylist', {
am_editing: function(id) { return 0 },
fetch_myevents: function() {
var self = this;
basic_get('dir_api.php?a=get/hosts', function(r2) {
self.hosts_by_sesid = _.groupBy(r2,function(x) { return x.id } )
} )
basic_get('api2.php?query=app',
function(r2) {
self.mysessions = r2.mysessions
@ -952,6 +956,7 @@ const ActivityList = Vue.component('activitylist', {
self.options = r2.options
self.conference = r2.conference
self.ay = r2.ay
self.hosts_by_sesid = _.groupBy(r2.hostbysession,function(x) { return x.id } )
self.survey_on = parseInt( _.findWhere(self.options, { label:'survey_on' }).value )
self.zoom_on = parseInt( _.findWhere(self.options, { label:'zoom_on' }).value )

View File

@ -3,6 +3,7 @@
<meta name="viewport" content="initial-scale=1.0" />
<meta charset="utf-8" />
<?php
date_default_timezone_set('America/Los_Angeles');
$server = $_SERVER['SERVER_NAME'];
if ( $server == 'intranet1.gavilan.edu') {
require 'mAuth.php';