This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
drupal_add_css("sites/all/themes/osulibraries/comp_map.css"); | |
drupal_add_js('setTimeout("window.location.reload()",300000);', 'inline'); | |
db_set_active('comp_map'); | |
$total_pc_results = db_query("SELECT * FROM compstatus WHERE computer_type='PC'"); | |
$avail_pc_results = db_query("SELECT * FROM compstatus WHERE status='0' AND computer_type='PC'"); | |
$pcs = mysql_num_rows($avail_pc_results) . '/' . mysql_num_rows($total_pc_results); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#add your database username and password | |
$user="username"; | |
$password="password"; | |
$database="computer_availability"; | |
#connect to the database | |
$DB = mysql_connect('mysqlcluster.adm.yourmysqlserver.edu', $user, $password); | |
@mysql_select_db($database) or die("Unable to select database"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#add your database username and password | |
$user="username"; | |
$password="password"; | |
$database="computer_availability"; | |
#unless the computers name was empty | |
if($_POST['workstation'] != ""){ | |
$workstation = strtoupper($_POST['workstation']); | |
} | |
else{ #build the computer's name from the host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use LWP; | |
use Sys::Hostname; | |
my $host = hostname(); | |
#the hostname after which you can find out the IP address | |
my $ipaddr = inet_ntoa(scalar gethostbyname($host || 'localhost')); | |
$ua = LWP::UserAgent->new; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use LWP; | |
use Sys::Hostname; | |
my $host = hostname(); | |
#the hostname after which you can find out the IP address | |
my $ipaddr = inet_ntoa(scalar gethostbyname($host || 'localhost')); | |
$ua = LWP::UserAgent->new; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE 'computer_availability' | |
CREATE TABLE `compstatus` ( | |
`computer_name` varchar(250) NOT NULL default "", | |
`status` int(11) default NULL, | |
`computer_type` varchar(250) default NULL, | |
`left_pos` int(11) default NULL, | |
`top_pos` int(11) default NULL, | |
`updated_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, | |
PRIMARY KEY (`computer_name`) | |
) |