Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

0 votes

Ich verwende als PHP Code zur Auswertung folgenden Code:

> $sumOffenheit = valueSum(array( 'PF04_01', 'PF04_07', 'PF04_13',
> 'PF04_19', 'PF04_25', 'PF04_31', 'PF04_37', 'PF04_43', 'PF04_49',
> 'PF04_55')); html('You got in the dimension openness to
> experience <strong>'.$sumOffenheit.'</strong> of 50 points. '); if
> ($sumOffenheit < 17) {   html('Therefore you have in the
> dimension <strong>openness</strong> <strong> to
> experience</strong> a <strong>low </strong>score.</p>'); } elseif
> ($sumOffenheit < 43) {   html('Therefore you have in the
> dimension <strong>openness to
> experience</strong> an <strong>average </strong>score.</p>'); } else {
> html('Therefore you have in the
> dimension <strong>openness</strong> <strong> to
> experience</strong> a <strong>high </strong>score.'</p>'); } html('<p>
> Persons with <strong>very high scores</strong> on the openness to
> experience scale become absorbed in the beauty of art and nature, are
> inquisitive about various domains of knowledge, use their imagination
> freely in everyday life, and take an interest in unusual ideas or
> people.   </p> <p> 	Conversely, persons with <strong>very low
> scores</strong> on this scale are rather unimpressed by most works of
> art, feel little intellectual curiosity, avoid creative pursuits, and
> feel little attraction toward ideas that may seem radical or
> unconventional.  </p> <p> 	Persons with an <strong>average
> score</strong> on the openness to experience scale are flexible and
> adjust their behavior depending on others or the situation.   </p>');
> 
> 
> $sumGewissenhaftigkeit = valueSum(array( 'PF04_02', 'PF04_08',
> 'PF04_14', 'PF04_20', 'PF04_26', 'PF04_32', 'PF04_38', 'PF04_44',
> 'PF04_50', 'PF04_56')); html('You got in the dimension
> consciousness <strong>'.$sumGewissenhaftigkeit.'</strong>  of 50
> points. '); if ($sumGewissenhaftigkeit < 17) {   html('Therefore you
> have in the dimension
> <strong>consciousness </strong>a <strong>low </strong>score.</p>'); }
> elseif ($sumGewissenhaftigkeit < 43) {   html('Therefore you have in
> the
> dimension <strong>consciousness </strong>an <strong>average </strong>score.');
> } else {   html('Therefore you have in the
> dimension <strong>consciousness </strong>a <strong>high </strong>score.</p>');
> } html('<p> Persons with very <strong>high scores</strong> on the
> conscientiousness scale organize their time and their physical
> surroundings, work in a disciplined way toward their goals, strive for
> accuracy and perfection in their tasks, and deliberate carefully when
> making decisions.   </p> <p> 	Conversely, persons with very<strong>
> low scores</strong> on this scale tend to be unconcerned with orderly
> surroundings or schedules, avoid difficult tasks or challenging goals,
> are satisfied with work that contains some errors, and make decisions
> on impulse or with little reflection.<br />  </p> <p> 	Persons with
> an <strong>average score</strong> on the consciousness scale are
> flexible and adjust their behavior depending on others or the
> situation.   </p>');
> 
> 
> 
> $sumVerträglichkeit = valueSum(array( 'PF04_03', 'PF04_09', 'PF04_15',
> 'PF04_21', 'PF04_27', 'PF04_33', 'PF04_39', 'PF04_45', 'PF04_51',
> 'PF04_57')); html('You got in the dimension
> compatibility <strong>'.$sumVerträglichkeit.'</strong>  of 50 points.
> '); if ($sumVerträglichkeit < 17) {   html('Therefore you have in the
> dimension <strong>compatibility
> </strong>a <strong>low </strong>score.</p>'); } elseif
> ($sumVerträglichkeit < 43) {   html('Therefore you have in the
> dimension <strong>compatibility </strong>an <strong>average </strong>score.</p>');
> } else {   html('Therefore you have in the
> dimension <strong>compatibility </strong>a <strong>high </strong>score.</p>');
> } html('<p> Persons with very <strong>high scores</strong> on the
> Agreeableness scale forgive the wrongs that they suffered, are lenient
> in judging others, are willing to compromise and cooperate with
> others, and can easily control their temper.   </p> <p> 	Conversely,
> persons with very <strong>low scores</strong> on this scale hold
> grudges against those who have harmed them, are rather critical of
> others' shortcomings, are stubborn in defending their point of view,
> and feel anger readily in response to mistreatment.<br />  </p> <p>
> 	Persons with an <strong>average score</strong> on the compatibility
> scale are flexible and adjust their behavior depending on others or
> the situation. <br />  </p>');
> 
> 
> $sumExtraversion = valueSum(array( 'PF04_04', 'PF04_10', 'PF04_16',
> 'PF04_22', 'PF04_28', 'PF04_34', 'PF04_40', 'PF04_46', 'PF04_52',
> 'PF04_58')); html('You got in the
> dimension extraversion <strong>'.$sumExtraversion.'</strong> of 50
> points. '); if ($sumExtraversion < 17) {   html('Therefore you have in
> the dimension
> <strong>extraversion</strong> a <strong>low </strong>score. </p>'); }
> elseif ($sumExtraversion < 43) {   html('Therefore you have in the
> dimension <strong>extraversion</strong> an <strong>average </strong>score.</p>');
> } else {   html('Therefore you have in the
> dimension <strong>extraversion</strong> a <strong>high </strong>score.</p>');
> } html('<p> Persons with very <strong>high scores </strong>on the
> extraversion scale feel positively about themselves, feel confident
> when leading or addressing groups of people, enjoy social gatherings
> and interactions, and experience positive feelings of enthusiasm and
> energy.   </p> <p> 	Conversely, persons with very <strong>low
> scores</strong> on this scale consider themselves unpopular, feel
> awkward when they are the center of social attention, are indifferent
> to social activities, and feel less lively and optimistic than others
> do.  </p> 	Persons with an <strong>average score</strong> on the
> extraversion scale are flexible and adjust their behavior depending on
> others or the situation. <br /> ');
> 
> 
> 
> $sumEmotionaleStabilität = valueSum(array( 'PF04_05', 'PF04_11',
> 'PF04_17', 'PF04_23', 'PF04_29', 'PF04_35', 'PF04_41', 'PF04_47',
> 'PF04_53', 'PF04_59')); html('You got in the dimension emotional
> stability <strong>'.$sumEmotionaleStabilität.'</strong> of 50 points.
> '); if ($sumEmotionaleStabilität < 17) {   html('Therefore you have in
> the dimension <strong>emotional
> stability</strong> a <strong>low </strong>score.</p>'); } elseif
> ($sumEmotionaleStabilität < 43) {   html('Therefore you have in the
> dimension <strong>emotional
> stability</strong> an <strong>average </strong>score.</p>'); } else { 
> html('Therefore you have in the dimension <strong>emotional
> stability</strong> a <strong>high </strong>score.</p>'); }
> html('<p>Persons with very <strong>high scores</strong> on he
> emotional stability scale are not deterred by the prospect of physical
> harm, feel little worry even in stressful situations, have little need
> to share their concerns with others, and feel emotionally detached
> from others.   </p> <p> 	Conversly, persons with <strong>low
> scores</strong> on the emotional stability scale experience fear of
> physical dangers, experience anxiety in response to life's stresses,
> feel a need for emotional support from others, and feel empathy and
> sentimental attachments with others.<br />  </p> <p> 	Persons with
> an <strong>average score</strong> on the emotional stability scale are
> flexible and adjust their behavior depending on others or the
> situation. <br /> ');
> 
> 
> 
> $sumEhrlichkeit = valueSum(array( 'PF04_06', 'PF04_12', 'PF04_18',
> 'PF04_24', 'PF04_30', 'PF04_36', 'PF04_42', 'PF04_48', 'PF04_54',
> 'PF04_60')); html('You got in the dimension honesty and
> humility <strong>'.$sumEhrlichkeit.'</strong> of 50 points. '); if
> ($sumEhrlichkeit < 17) {   html('Therefore you have in the dimension
> <strong>honesty and humility</strong> a <strong>low </strong>score.
> </p>'); } elseif ($sumEhrlichkeit < 43) {   html('Therefore you have
> in the dimension <strong>honesty and
> humility</strong> an <strong>average </strong>score.</p>'); } else {  
> html('Therefore you have in the dimension <strong>honesty and
> humility</strong> a <strong>high </strong>score.</p>'); } html('<p>
> Persons with very <strong>high scores </strong>on the honesty and
> humility scale avoid manipulating others for personal gain, feel
> little temptation to break rules, are uninterested in lavish wealth
> and luxuries, and feel no special entitlement to elevated social
> status.   </p> <p> 	Conversely, persons with very <strong>low scores
> </strong>on this scale will flatter others to get what they want, are
> inclined to break rules for personal profit, are motivated by material
> gain, and feel a strong sense of self-importance.<br />  </p> <p>
> 	Persons with an <strong>average score</strong> on the honesty and
> humility scale are flexible and adjust their behavior depending on
> others or the situation.  ');

Mir wird dann folgender Fehlercode ausgespuckt: Warnung: Das PHP Konstrukt use darf im PHP-Code nicht verwendet werden.
Warnung: Der PHP-Code enthält Funktionen oder PHP-Elemente, die nicht für die Verwendung im Fragebogen freigegeben wurden. Falls Sie der Meinung sind, dass die monierten Konstrukte ungefährlich sind, setzen Sie sich bitte mit dem Administrator in Kontakt!
Etwas ähnliches hatte ich bereits schon, da hat sich das Programm über etwas ähnliches beschwert... durch try and error bin ich dazu gekommen, dass er ganz normale Wörter als gefährlich eingestuft hat. ich glaube, es war die Phrase ", dass". jetzt ist mir aber die Code zu lange, um jedes Wort rauszunehmen und das Problem zu finden. Scheinbar stimmt da was im Hintergrund nicht.
LG

in SoSci Survey (dt.) by s049805 (395 points)

1 Answer

0 votes

Einige Schlüsselwörter (wie z.B. eval) können missbraucht werden, um auf Daten zuzugreifen, auf welche Sie als Nutzer keinen Zugriff haben dürfen. Um die Sicherheit des Servers zu gewährleisten, ist die Code-Kontrolle etwas restriktiver als es vielleicht notwendig wäre.

Generell ist das unproblematisch, weil Inhalte im Normalfall in Textbausteinen gespeichert und mittels text() eingebunden werden sollten. In Ihrem Fall ist das - zugegeben - ein wenig schwierig. Aber auch Sie können das Problem einfach lösen. Ersetzen Sie die Zeile

'... domains of knowledge, use their imagination ...'

Bitte wie folgt:

'... domains of knowledge, u'.'se their imagination ...'

Bei diesem Text wäre es aufgrund der Länge übrigens tatsächlich sinnvoll, ihn in einen Textbaustein auszulagern.

by SoSci Survey (130k points)
Danke für die schnelle Antwort - noch eine Frage:
Vor allem im Englischen müsste man im Sinne der richtigen Grammatik mit Apostrophen arbeiten. Wie kann man die einbinden ohne Textbausteine zu verwenden?
Wenn man die Strings im PHP-Code durch einfache Anführungszeichen umschließt, muss man einfache Anführungszeichen im Inhalte durch einen Backslash "maskieren":

html('That\'s correct');

Alternativ kann man die Strings auch mit doppelten Anführungszeichen um schließen - aber dann müsste man natürlich doppelte Anführungszeichen im Text maskieren (und außerdem noch ein paar weitere Zeichen wie das Dollar $)

html("That's correct");

Last but not least kann man das Apostroph auch als HTML-Enität angeben.

html('That&#39;s correct');

Aber das ist natürlich weniger komfortabel zu tippen.
...