Commit 96584ff7 authored by Enrico Glerean's avatar Enrico Glerean

adding all scripts for all web experiments

parent 0a927411

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

rsync -avztcp -e "ssh" --chmod=g+s,g+rw --group=braindata --exclude 'UK*' --exclude '.git' bml@bml.becs.aalto.fi:/var/www/emotion.becs.aalto.fi/sensations/ sensations/
# remove admin password
cat sensations/admin/admin.php| sed 's/key==\".*\"/key==\"1234\"/g' > temp.php
mv temp.php sensations/admin/admin.php
rsync -avztcp -e "ssh" --chmod=g+s,g+rw --group=braindata --exclude 'FI*' --exclude '.git' bml@bml.becs.aalto.fi:/var/www/emotion.becs.aalto.fi/sensations_FI/ sensations_FI/
# remove admin password
cat sensations_FI/admin/admin.php| sed 's/key==\".*\"/key==\"1234\"/g' > temp.php
mv temp.php sensations_FI/admin/admin.php
rsync -avztcp -e "ssh" --chmod=g+s,g+rw --group=braindata --exclude 'FI*' --exclude '.git' bml@bml.becs.aalto.fi:/var/www/emotion.becs.aalto.fi/sensations_sim/ sensations_sim/
rsync -avztcp -e "ssh" --chmod=g+s,g+rw --group=braindata --exclude 'FI*' --exclude '.git' --exclude 'temp' bml@bml.becs.aalto.fi:/var/www/emotion.becs.aalto.fi/sensations_embody_FI/ sensations_embody_FI/
# remove admin password
cat sensations_embody_FI/admin/admin.php| sed 's/key==\".*\"/key==\"1234\"/g' > temp.php
mv temp.php sensations_embody_FI/admin/admin.php
<?php
include('lib.php');
include('settings.php');
session_start();
$data="";
$err=-1;
// check that we have all variables
//$keys=array('sex','age','nation','phobia');
$keys=array('sex','age','nation','born','phobia');
$keys=array('sex','age','nation','born','weight','height','hand','education','psychologist','psychiatrist','neurologist');
$errs = array('sex','age','nation','born','weight','height','hand','education','psychologist','psychiatrist','neurologist');
for($k=0;$k<count($keys);$k++){
if(isset($_POST[$keys[$k]]))
{
$_SESSION[$keys[$k]]=$_POST[$keys[$k]];
}
}
//prevent hacking to server from open questions
if(isset($_POST['nation'])||empty($_POST['nation'])){
$clean = htmlspecialchars($_POST['nation'], ENT_QUOTES);
$_POST['nation'] = $clean;
}
for($k=0;$k<count($keys);$k++){
$a[$k]=isset($_POST[$keys[$k]]);
if(!isset($_POST[$keys[$k]]) )//|| empty($_POST[$keys[$k]]))
{
$err=$k;
}
}
if($err>=0)
header("Location: register.php?err=$err");
else
{
for($k=0;$k<count($keys);$k++){
if(isset($_POST[$keys[$k]]))
$data.=$_POST[$keys[$k]]."\n";
}
$ok=0;
while($ok==0)
{
$random = (rand()%999999);
$random = $language.$random;
if(is_dir("subjects/$random/"))
$ok=0;
else
{
$ok=1;
system("mkdir subjects/$random/",$ret);
if($ret==0)
{
system("chmod 777 subjects/$random/",$ret);
if($ret!=0)
die("There was a disk error. Please email enrico.glerean@aalto.fi");
}
}
}
$techdata=var_export($_SERVER,TRUE);
$file="subjects/$random/data.txt";
$fh = fopen($file, 'w') or die("There was a disk error. Please email enrico.glerean@aalto.fi");
fwrite($fh, $data);
fclose($fh);
if(0)
{
$file="subjects/$random/techdata.txt";
$fh = fopen($file, 'w') or die("There was a disk error. Please email enrico.glerean@aalto.fi");
fwrite($fh, $techdata);
fclose($fh);
}
$file="subjects/$random/index.php";
$fh = fopen($file, 'w') or die("There was a disk error. Please email enrico.glerean@aalto.fi");
fwrite($fh, " ");
fclose($fh);
header("Location: session_batch.php?userID=$random");
}
?>
<?php
include('header.php');
include('../lib.php');
$key=trim($_POST['key']);
if($key=="1234")
{
?>
<h1>Admin page</h1>
<!--
<h2>Create a new subject ID</h2>
<iframe src="makesubj.php" frameborder=0 width=400 height=100>
</iframe>
-->
<h2>Summary of data collected so far</h2>
<br>
<div style="top:0px;right:0px;position:absolute;color:#ccc"><a href="../index.php">Home page</a></div>
<?php
include("data.php");
}
else
echo "<div class=\"error\">Wrong key.</div> <a href=\"index.php\">Go back</a>";
include('footer.php');
?>
<?php
$d = opendir("../subjects/");
$allout=array();
$goodN=0;
while (false !== ($entry = readdir($d))) {
if(substr($entry,0,1)==".")
continue;
if($entry == "index.php")
continue;
$userID=$entry;
$outstrID=str_pad($entry,8);
$thisdir = new SplFileInfo("../subjects/$userID/index.php");
$thisdate=date('Y/m/d H:i:s', $thisdir->getMTime());
$outstr= "$thisdate\t|";
//$outstr.="\t<a href=\"../subjects/$entry/\">$outstrID</a>\t|\t";
$outstr.="\t$outstrID\t|\t";
$pfpath='../subjects/'.$userID.'/presentation_1.csv';
$haspres = is_file($pfpath);
if(!$haspres)
{
$outstr.="NOT STARTED\n";
}
else
{
$annpath='../subjects/'.$userID.'/';
$n=exec("ls $annpath|grep [0-9]_[1-5].csv|wc -l");
$n=trim($n);
$outstr.= "<b>$n</b> tokens completed\n";
if($n>=20) $goodN++;
}
array_push($allout,$outstr);
}
echo "<pre>";
$N=sizeof($allout);
echo "Total num of subjects registered: ".$N."\n";
echo "Total num of usable subjects (at least 20 tokens): ".$goodN."\n\n";
echo "DATE\t\t\t|\tUSERID \t|\tSTATUS\n";
echo "------------------------------------------------------------------------\n";
sort($allout);
foreach($allout as $outstr)
echo $outstr;
echo "\n\n\n\n";
echo "</pre>";
echo "<h2>Other</h2>";
echo "- <a href=\"maketar.php\">Merge all files for download</a>";
echo "<br>";
echo "- <a href=\"../matlabfiles/\">Matlab script for reading ratings</a>";
</div>
</body>
</html>
\ No newline at end of file
<?php
?>
<html>
<head>
<title>Admin page</title>
<LINK href="../css/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<?php
include('header.php');
?>
<form id="intro" method="POST" action="admin.php">
<h1>Admin log-in</h1>
<br><br>
<input style="font-size:14px;" name="key" type="text" onclick="this.value=''" value="enter admin key">
</form>
<?php
include('footer.php');
?>
<html>
<head>
<title>Admin page</title>
<style>
*{
margin:0px;
padding:0px;
}
body{
padding:10px;
font-family:Helvetica, Arial, sans-serif;
background:#dfd;
border:1px solid #390;
}
</style>
</head>
<body>
<div id="container">
<?php
$yes=$_POST["yes"];
if($yes==1)
{
$random = (rand()%1000000);
echo "Setting up user id <span style=\"font-size:20px;font-weight:bold\">$random</span><br><br>";
if(is_dir("../subjects/$random/"))
die("Error. Try again");
system("mkdir ../subjects/$random/",$ret);
if($ret==0)
{