= now()') != $survey_id) die('We\'re sorry, but this survey is already closed!'); } if( !isset( $_SESSION['VISITOR_ID'] ) ) { $planned_runs = GetQueryValue('SELECT max_runs FROM RSurvey WHERE survey_id = '.SSST2($survey_id)); $successful_runs = GetRowCount('SELECT DISTINCT visitor_id FROM RAnswer WHERE survey_id = '.SSST2($survey_id)); if( ($successful_runs >= $planned_runs) && ($planned_runs !=0) ) die('Thank you, but we already have enough results with this survey'); //welcome screen with user info if( isset($_POST['first_name']) ) { $first_name = ''; $last_name = ''; $sex = ''; $age = ''; $nationality = ''; $job=''; $household = ''; $phone = ''; $email = ''; if( isset($_POST['first_name'])) $first_name = SSST($_POST['first_name']); if( isset($_POST['last_name'])) $last_name = SSST($_POST['last_name']); if( isset($_POST['sex'])) $sex = SSST($_POST['sex']); if( isset($_POST['age'])) $age = SSST($_POST['age']); if( $age == 'Select') $age = ''; if( NotInteger($age) ) die('age is not integer'); if( isset($_POST['nationality'])) $nationality = SSST($_POST['nationality']); if( isset($_POST['job'])) $job = SSST($_POST['job']); if( isset($_POST['household'])) $household = SSST($_POST['household']); if( NotInteger($household) ) die('household is not integer'); if( isset($_POST['phone'])) $phone = SSST($_POST['phone']); if( isset($_POST['email'])) $email = SSST($_POST['email']); if( ($sex != 'F') && ($sex != 'M') ) die('sex is wrong. lol.'); $query = 'INSERT INTO RVisitor (first_name, last_name, sex, age, nationality, job, household, phone, email, survey_id, survey_date) VALUES('. SSST2($first_name).','.SSST2($last_name).','.SSST2($sex).','.SSST2($age).','.SSST2($nationality).','. SSST2($job).','.SSST2($household).','.SSST2($phone).','.SSST2($email).','. SSST2($survey_id).',now())'; ExecuteSQL($query); $_SESSION['PRE_VISITOR_ID'] = GetQueryValue('SELECT visitor_id FROM RVisitor ORDER BY visitor_id DESC LIMIT 0,1'); $redirect = 'start.php'; }/* else if( isset($_REQUEST['txtMode'])&&('save_mode'==$_REQUEST['txtMode']) ) { $out = 'Continue testing. You will see an image for a few seconds.

'. 'Using the right-button of your mouse click on the parts of the image that appear more predominantly to your eyes. Do not wait to click. React spontaneously.

'. 'When you are ready, click on the button Start.

'. ''; }*/ else if ( isset($_SESSION['PRE_VISITOR_ID']) ) { $out = 'You will see an image for a few seconds.

'. 'Using the right-button of your mouse click on the parts of the image that appear more predominantly to your eyes. Do not wait to click. React spontaneously.

'. 'When you are ready, click on the button Start.

'. ''; /* if (!isset($_SESSION['REAL_SURVEY'])) {*/ $_SESSION['VISITOR_ID'] = $_SESSION['PRE_VISITOR_ID']; unset($_SESSION['PRE_VISITOR_ID']); } else { $out = '

Please, read carefully

'. GetQueryValue('SELECT survey_desc FROM RSurvey WHERE survey_id = '.$survey_id). '

When you click the button Start survey you will see an image.'. '

From that moment, using the left button of your mouse you should click on the parts of the image that appear more predominantly to your eyes.'. '

You can click on the image only during a few seconds. Therefore, we kindly ask you to not wait. Click on any part of the image as soon as you notice it.'. '

You should really react spontaneously, because there is no right or wrong answer to this exercise. It is your spontaneous reaction that we value most.'. '

If you think you understood this explaination click on the button Start survey now. Otherwise read this text again.'. '

'. 'Please, answer the following questions.'. '

'. '

'. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. '
First name:Last name:
Age:Sex: male female
Nationality:Job:
Number of persons in household:
Phone:'. 'E-mail:'. '
'. '

'. '

'; } } else { //determining visitor $visitor_id = $_SESSION['VISITOR_ID']; if( NotInteger($visitor_id) ) die('bad visitor id'); $action = ''; if( isset($_POST['txtAction']) ) $action = $_POST['txtAction']; $process_action = 1; } ?> MyClick survey - <? echo GetQueryValue('SELECT survey_name FROM RSurvey WHERE survey_id = '.$survey_id); ?>
RSurvey.next_question group by RQuestion.survey_id ORDER BY RQuestion.question_id ASC SELECT RQuestion.question_id as cur, @next:=RSurvey.next_question, @maxim :=count(RQuestion.question_id) , @x:=MOD(@next,@maxim ) FROM RQuestion, RSurvey WHERE RQuestion.survey_id = 16 and RSurvey.survey_id = 16 group by RQuestion.survey_id ORDER BY RQuestion.question_id ASC */ ExecuteSQL("UPDATE RSurvey SET next_question = next_question + 1 WHERE survey_id = ".$survey_id); $max = 'SELECT count(RQuestion.question_id) as maxim, RSurvey.next_question as next FROM RQuestion, RSurvey WHERE RQuestion.survey_id = '.$survey_id.' and RSurvey.survey_id = '.$survey_id.' group by RQuestion.survey_id'; $res = mysql_fetch_array(mysql_query($max)); $_SESSION['QUESTION_ID'] = 0; $_SESSION['NEXT_ROW'] = (int)$res['next']; $_SESSION['COUNT_ROW'] = (int)$res['maxim']; $_SESSION['ASKED_ROW'] = 0; } if( !isset($_SESSION['QUESTION_NUM']) ) $_SESSION['QUESTION_NUM'] = 1; $go_to_next_question = 0; echo '
'; // if( isset($_POST['RES'])&& ($_SESSION['REAL_SURVEY'] == 'is')) if( isset($_POST['RES']) && isset($_SESSION['REAL_SURVEY'])) { //saving question results if (!empty($_POST['RES'])) $_SESSION['RES'.$_SESSION['QUESTION_ID']] = $_POST['RES']; if( isset($_POST['RATE']) ) $_SESSION['RATE'.$_SESSION['QUESTION_ID']] = $_POST['RATE']; if( GetQueryValue('SELECT show_questionnaire FROM RSurvey WHERE survey_id = '.SSST2($survey_id)) == '1' ) { //Showing text questions card about image require('qquestions.php'); } else { $go_to_next_question = 1; } } else { $go_to_next_question = 1; } if( $go_to_next_question == 1 ) { if($_SESSION['ASKED_ROW']== $_SESSION['COUNT_ROW']) { if ( !isset($_SESSION['REAL_SURVEY'])){ $question_id = 0; $_SESSION['ASKED_ROW'] = 0; $redirect = 'start.php'; } elseif ( isset($_SESSION['REAL_SURVEY'])&&('is'==$_SESSION['REAL_SURVEY']) ){ echo '

Survey is completed. Thank you.

'; // $redirect = 'finish_survey.php'; } } else { // $query = 'SELECT * FROM RQuestion WHERE survey_id = '.SSST2($survey_id).' AND question_id >'.SSST2($_SESSION['QUESTION_ID']).' ORDER BY question_id'; if ( isset($_SESSION['REAL_SURVEY'])) { $query = 'SELECT * FROM RQuestion WHERE survey_id = '.SSST2($survey_id).' ORDER BY question_id LIMIT '.(int)($_SESSION['NEXT_ROW']++%(int)$_SESSION['COUNT_ROW']).',1'; $_SESSION['ASKED_ROW']++; $res = mysql_query($query); $row = mysql_fetch_array($res); $question_id = $row['question_id']; } else { $query = 'SELECT * FROM RQuestion WHERE survey_id = '.SSST2($survey_id).' AND is_test = 1 ORDER BY RAND() LIMIT 1'; //$_SESSION['ASKED_ROW']++; $res = mysql_query($query); $row = mysql_fetch_array($res); $question_id = $row['question_id']; } $_SESSION['QUESTION_ID'] = $question_id; echo '

Question '; if ( isset($_SESSION['REAL_SURVEY'])) echo $_SESSION['QUESTION_NUM'].' - '; echo $row['question_caption'].'

'; echo $row['question_desc'].'
'; $user_text = $row['user_text']; if( $user_text == '' ) $user_text = 'Please click with the mouse on the image several times.'; if( $row['question_type'] == 'IMAGE' ) { $row_image = GetSQLrowArray('SELECT * FROM RQImage WHERE question_id = '.SSST2($question_id)); $picture_name = $row_image['picture_name']; $marker_name = $row_image['marker_name']; $click_count = $row_image['click_count']; $click_time = $row_image['click_time']; require('qimage.php'); } } } echo '
'; } } ?> document.location.href=\''.$redirect.'\';'; } ?>