The LimeSurvey Fund-Raiser 2012 is complete. Thank you for donating a total of 25,000 USD!     List of donors »

Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: limesurvey in other website

limesurvey in other website 2 years 5 months ago #52767

  • ResearchOnBlogs
  • ResearchOnBlogs's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 16
  • Karma: 8
Hi there,

I'm using ls via iframe in Drupal.

To enter a survey I use this script:

bugs.limesurvey.org/view.php?id=2982

Forum
<?php
/*
When having a close token survey (token table exist)
you can create a token on the fly by giving as parameters sid and token                                                         lines  43- 49
In addition if someone has already complete a survey  he can review his answers an d correct them          lines  55- 61
 
Just put this script in limesurveys  root directory
Example:
 
http://localhost/limesurvey185plus-build7253-20090708/newtoken.php?sid=27644&newtest=Y&token=123456789012345678901234567890123456
 
Prerequisites:
1.  Anonymous answers?                            No       (This survey is NOT anonymous.)
2.  Enable Token-based answers persistence?       Yes
3.  Switch to closed-acces mode
4.  Use cookies?                                  No
 
*/
// Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB   
 
require_once(dirname(__FILE__).'/classes/core/startup.php');
require_once(dirname(__FILE__).'/config-defaults.php');
require_once(dirname(__FILE__).'/common.php');
require_once(dirname(__FILE__).'/classes/core/language.php');
@ini_set('session.gc_maxlifetime', $sessionlifetime);
 
$loadname=returnglobal('loadname');
$loadpass=returnglobal('loadpass');
$scid=returnglobal('scid');
$thisstep=returnglobal('thisstep');
$move=sanitize_paranoid_string(returnglobal('move'));
$clienttoken=trim(sanitize_xss_string(strip_tags(returnglobal('token'))));      
if (!isset($thisstep)) {$thisstep = "";}
 
 
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
else {
		//This next line ensures that the $surveyid value is never anything but a number.
		$surveyid=sanitize_int($surveyid);
	 }
 
// get variables from address bar
if (isset($_GET['sid'])) { $sid = $_GET['sid']; }
if (isset($_GET['myname'])) { $myname=urldecode($_GET['myname']); }
if (isset($_GET['token'])) { $token = $_GET['token']; }
//if (isset($_GET['token'])) { $token = $_GET['token']; }
if (isset($_GET['lang'])) { $lang = $_GET['lang']; }
 
$name = explode("|", $myname);
 
 
// short things are better
$tokentable = $dbprefix."tokens_".$sid;
$location = $rooturl;
$location .= '?sid='.$sid;
//$location .= '?=gr&newtest=Y'; // Problem? What is gr?
$location .= '&token='.$token; // Problem last page??
$location .= '&newtest=Y';
 
$iscompleted=mysql_query("SELECT `completed` FROM ". $tokentable. " WHERE token= '".$token."'");
$completed = mysql_num_rows($iscompleted);
 
if ($completed==0)                         //   there is no token so create one and procced to the survey
	{
	$wri = "INSERT INTO ".$tokentable." (firstname,lastname,email,language,sent,token) VALUES ('".$name[0]."','".$name[1]."',' ','".$lang." ','Y','".$token."')";
	mysql_query($wri) or die("Query error: ". mysql_error());
	header('Location:'.$location);
	// header('Location:'.$HTTP_REFERER.'?failed=1');
	}
 
else                                       //   Token exists
	{
	$fullycompleted =mysql_result($iscompleted,0,0);
 
	if ($fullycompleted="Y")               //    Survyey Is Completed So start editing the answers
		{
			$wri = "Update ".$tokentable." set completed = 'N' where token ='".$token."'";
			mysql_query($wri) or die("Query error: ". mysql_error());
			header('Location:'.$location);
			// header('Location:'.$HTTP_REFERER.'?failed=1');
		}
 
	if ($fullycompleted="N")               //    Survyey is not  Completed So procced
		{
			header('Location:'.$location);
		}
 
	}
 
?>

I've two questions..
1. It seems that I have the same issue like: bugs.limesurvey.org/view.php?id=2982 .

But I'm using Version 1.90+ Build 9487 - in this build the problem should be solved.
If I don't use token & newtest, I got my last page. If I use both, I step to the beginning.

In my opinion something is going wrong..

I never got the same page.. If I keep the browser open, access survey I got my last page.
If I close the browser, access the the survey again I got some other page..


2. Would it by possible to enter a survey via lsrc, or is this only for "admin" use.. found no hint to take part a survey via lsdrc


I've made an additional bug report, but cschmitz found no error.
bugs.limesurvey.org/view.php?id=4752

research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
Last Edit: 2 years 5 months ago by ResearchOnBlogs.
The administrator has disabled public write access.

Re:limesurvey in other website 2 years 5 months ago #52771

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 4374
  • Thank you received: 451
  • Karma: 165
Yes , and ?
The administrator has disabled public write access.

Re:limesurvey in other website 2 years 5 months ago #52772

  • ResearchOnBlogs
  • ResearchOnBlogs's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 16
  • Karma: 8
pressed enter to fast.. B)

research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
The administrator has disabled public write access.

Re:limesurvey in other website 2 years 5 months ago #52777

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 4374
  • Thank you received: 451
  • Karma: 165
Hello,

:laugh: too fast for me too ;)

Yes, understand .

Please reopen the bug report if:
You want to have:

newtest=Y and go to the lastpage if token already have some answer.

And give a link to this forum topic.

For Dev:
I don't understand why there are :
if (isset($_GET['newtest']) && $_GET['newtest'] = "Y") 
    {
        unset($_GET['token']);
    }

And to put at lastpage:
elseif ($column =='lastpage' && isset($_GET['token']))

I think we can have :
elseif ($column =='lastpage' && (isset($_GET['token'])||(isset($_GET['newtest']) && ($_GET['newtest']=='Y'))
(I don't verify the bracket :woohoo: )
The administrator has disabled public write access.

Re:limesurvey in other website 2 years 5 months ago #52782

  • ResearchOnBlogs
  • ResearchOnBlogs's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 16
  • Karma: 8

research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
The administrator has disabled public write access.

Re:limesurvey in other website 2 years 5 months ago #52800

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5116
  • Thank you received: 260
  • Karma: 240
Shnoulle wrote:
if (isset($_GET['newtest']) && $_GET['newtest'] = "Y") 
    {
        unset($_GET['token']);
    }
Should the IF statement read:
if (isset($_GET['newtest']) && $_GET['newtest'] == "Y") 
    {
        unset($_GET['token']);
    }
There has to be a "==" at the IF clause instead of "=".

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.
  • Page:
  • 1
Moderators: DenisChenu, ITEd
Time to create page: 0.551 seconds
Donation Image