
sakisdem
Members-
Posts
14 -
Joined
-
Last visited
sakisdem's Achievements

Newbie (1/5)
0
Reputation
-
I don’t want to write the code because I want to copy paste! I want to see how it done! And you said to me that I need to replace the array with the result of the SELECT query but I wand to have predefine codes and the function to putt the only one time. All I know is the code I show you If I know how to do it I am not bother you with sally questions
-
can you please show me how it gone? I am new in PHP Thanks
-
sorry but i am new in this. I make this: function validateCode ($code) { // Create the array of valid codes, and flip it to enable the use of isset (). $validCodes = array ('aaaa', 'bbbb', 'cccc', 'dddd'); $validCodes = array_flip ($validCodes); // Check if the given code exists in the array. if (isset ($validCodes[$code])) { return true; } //verify if this was used before $db = &JFactory::getDBO(); $db->setQuery("SELECT `SubmissionId` FROM #__rsform_submission_values WHERE `FieldValue` = '".$param."' AND `FormId` = '".intval($_POST['form']['formId'])."' LIMIT 1"); $tmp = $db->loadResult(); if($tmp) // It didn't. return false; }
-
Thanks a lot Christian! Actually I try to have some codes for verification in my field of password and I want to use only one time the code. I make this script: function registrationCode($param,$extra=null) { $validCodes = array('AAAA','BBBB','CCCC','DDDD'); $bul = true; foreach($validCodes as $validCode) if(strtolower($validCode) == strtolower($param)) { $bul = true; //verify if this was used before $db = &JFactory::getDBO(); $db->setQuery("SELECT `SubmissionId` FROM #__rsform_submission_values WHERE `FieldValue` = '".$param."' AND `FormId` = '".intval($_POST['form']['formId'])."' LIMIT 1"); $tmp = $db->loadResult(); if($tmp) $bul = false; //break; } else $bul = false; return $bul; } Please tell me how to make it with you code now
-
Hi to all I create a function for my password field but i have one problem. I predefine 4 codes but the function allows me to use only the last, in this case is dddd. Can anyone help me with this? The code I wrote is: function registrationCode($param,$extra=null) { $validCodes = array('aaaa','bbbb','cccc','dddd'); $bul = true; foreach($validCodes as $validCode) if(strtolower($validCode) == strtolower($param)) { $bul = true; if($tmp) $bul = false; //break; } else $bul = false; return $bul; }
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
Actually I’m using Joomla 2.5.8 and the RSForm Pro component. The component, store all the results in one table in my database. (Created himself). Barand if you wand I can give you access to my administration panel in Joomla and see if you can help me.- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
I already do this but I don’t know if is correct… <?php $meetgroup[ ] = "meet1"; $meetgroup[ ] = "meet2"; $meetgroup[ ] = "meet3"; $meetgroup[ ] = "meet4"; $meetgroup[ ] = "meet5"; $fruitgroup[ ] = "fruit1"; $fruitgroup[ ] = "fruit2"; $fruitgroup[ ] = "fruit3"; $fruitgroup[ ] = "fruit4"; $fruitgroup[ ] = "fruit5"; $delicatgroup[ ] = "delicat1"; $delicatgroup[ ] = "delicat2"; $delicatgroup[ ] = "delicat3"; $delicatgroup[ ] = "delicat4"; $delicatgroup[ ] = "delicat5"; $fishgroup[ ] = "fish1"; $fishgroup[ ] = "fish2"; $fishgroup[ ] = "fish3"; $fishgroup[ ] = "fish4"; $fishgroup[ ] = "fish5"; $pfcgroup[ ] = "pfc1"; $pfcgroup[ ] = "pfc2"; $pfcgroup[ ] = "pfc3"; $pfcgroup[ ] = "pfc4"; $pfcgroup[ ] = "pfc5"; $answers = a1(a10, a11, a12, a13, a14) ; // could be $_POST['answers'] $random_group = $answers[array_rand($meetgroup, $fruitgroup, $delicatgroup, $fishgroup, $pfcgroup)]; echo $random_group; ?>- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
the a lot for the answer Barand but i'm really new in scripts. Can you please show me how to do that?- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
nobody?- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
Can anyone help me? Plz!- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
My first question is about departments: butcher shop Fruit Department sausage / cheese cutter (Delicatessen) fish market Packaged food and cleaning Then i have 5 questions for each departments: For the butcher shop i have the folow questions The meat was fresh - i name it meet1 The meat quality was - i name it meet2 The butcher serve you well on that you needed - i name it meet3 The butcher gave you advice about baking - i name it meet4 There was good variety in terms of types of butcher - i name it meet5 etc. What to i do to make each departments questions a group & My first questions i am trying to create a right variable so can display random questions. Let me explain feather My first question is a checkbox questions with 5 answers. every answer have a 5 more group questions. I need a variables code to do this: Every time the user checks (in first checkbox) the answer 1 and 3 the code automatically selected to display the group of 1 or 3 (not the 2 together) The same philosophy must have and the outher questions, if the answer (on first) is 2, 4 and 5 must display the group of question 2 or 4 or 5. I hope to understand Thanks a lot!- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
and my questions is one by one and i need to group the question befor do anything- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Online Survey With Random Questions Group Variables
sakisdem replied to sakisdem's topic in Third Party Scripts
actialy my site is build in joomla 2.5.8 and the program i use the RSForm Pro component. All the variables is display in one php file: <?php /** * @version 1.4.0 * @package RSform!Pro 1.4.0 * @copyright © 2007-2011 www.rsjoomla.com * @license GPL, http://www.gnu.org/copyleft/gpl.html */ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); class RSFormProValidations { function none($value,$extra=null,$data=null) { return true; } function alpha($param,$extra=null,$data=null) { if(strpos($param,"\n") !== false) $param = str_replace(array("\r","\n"),'',$param); for($i=0;$i<strlen($param);$i++) if(strpos($extra,$param[$i]) === false && preg_match('#([^a-zA-Z ])#', $param[$i])) return false; return true; } function numeric($param,$extra=null,$data=null) { if(strpos($param,"\n") !== false) $param = str_replace(array("\r","\n"),'',$param); for($i=0;$i<strlen($param);$i++) if (strpos($extra,$param[$i]) === false && !is_numeric($param[$i])) return false; return true; } function alphanumeric($param,$extra = null,$data=null) { if(strpos($param,"\n") !== false) $param = str_replace(array("\r","\n"),'',$param); for($i=0;$i<strlen($param);$i++) if(strpos($extra,$param[$i]) === false && preg_match('#([^a-zA-Z0-9 ])#', $param[$i])) return false; return true; } function alphaaccented($value, $extra=null, $data=null) { if (preg_match('#[^[:alpha:] ]#u', $value)) { return false; } return true; } function alphanumericaccented($value, $extra=null, $data=null) { if (preg_match('#[^[:alpha:]0-9 ]#u', $value)) { return false; } return true; } function email($email,$extra=null,$data=null) { jimport('joomla.mail.helper'); $email = trim($email); return JMailHelper::isEmailAddress($email); } function emaildns($email,$extra=null,$data=null) { // Check if it's an email address format if (!RSFormProValidations::email($email,$extra,$data)) return false; $email = trim($email); list($user, $domain) = explode('@', $email, 2); // checkdnsrr for PHP < 5.3.0 if (!function_exists('checkdnsrr') && function_exists('exec') && is_callable('exec')) { @exec('nslookup -type=MX '.escapeshellcmd($domain), $output); foreach($output as $line) if (preg_match('/^'.preg_quote($domain).'/',$line)) return true; return false; } // fallback method... if (!function_exists('checkdnsrr') || !is_callable('checkdnsrr')) return true; return checkdnsrr($domain, substr(PHP_OS, 0, 3) == 'WIN' ? 'A' : 'MX'); } function uniquefield($value, $extra=null,$data=null) { $db =& JFactory::getDBO(); $form = JRequest::getVar('form'); $formId = (int) @$form['formId']; $db->setQuery("SELECT `SubmissionValueId` FROM #__rsform_submission_values WHERE FormId='".$formId."' AND `FieldName`='".$db->getEscaped($data['NAME'])."' AND `FieldValue`='".$db->getEscaped($value)."'"); return $db->loadResult() ? false : true; } function uniquefielduser($value, $extra=null,$data=null) { $db =& JFactory::getDBO(); $form = JRequest::getVar('form'); $formId = (int) @$form['formId']; $user =& JFactory::getUser(); $db->setQuery("SELECT sv.`SubmissionValueId` FROM #__rsform_submission_values sv LEFT JOIN #__rsform_submissions s ON (sv.SubmissionId=s.SubmissionId) WHERE sv.FormId='".$formId."' AND sv.`FieldName`='".$db->getEscaped($data['NAME'])."' AND sv.`FieldValue`='".$db->getEscaped($value)."' AND (".($user->get('guest') ? "s.`UserIp`='".$db->getEscaped($_SERVER['REMOTE_ADDR'])."'" : "s.`UserId`='".(int) $user->get('id')."'").")"); return $db->loadResult() ? false : true; } function uszipcode($value) { return preg_match("/^([0-9]{5})(-[0-9]{4})?$/i",$value); } function phonenumber($value) { return preg_match("/\(?\b[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\b/i", $value); } function creditcard($value,$extra=null,$data=null) { $value = preg_replace ('/[^0-9]+/', '', $value); if (!$value) return false; if (preg_match("/^([34|37]{2})([0-9]{13})$/", $value)) // Amex return true; if (preg_match("/^([30|36|38]{2})([0-9]{12})$/", $value)) // Diners return true; if (preg_match("/^([6011]{4})([0-9]{12})$/", $value)) // Discover return true; if (preg_match("/^([51|52|53|54|55]{2})([0-9]{14})$/", $value)) // Master return true; if (preg_match("/^([4]{1})([0-9]{12,15})$/", $value)) // Visa return true; return false; } function custom($param,$extra=null,$data=null) { if(strpos($param,"\n") !== FALSE) $param = str_replace(array("\r","\n"),'',$param); for($i=0;$i<strlen($param);$i++) if(strpos($extra,$param[$i]) === false) return false; return true; } function password($param,$extra=null,$data=null) { if ($data['DEFAULTVALUE'] == $param) return true; return false; } function ipaddress($param,$extra=null,$data=null) { return preg_match('#\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b#', $param, $match); } function validurl($param,$extra=null,$data=null) { $format = '/^(https?):\/\/'. // protocol '(([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+'. // username '([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+)?'. // password '@)?(?#'. // auth requires @ ')((([a-z0-9][a-z0-9-]*[a-z0-9]\.)*'. // domain segments AND '[a-z][a-z0-9-]*[a-z0-9]'. // top level domain OR '|((\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])\.){3}'. '(\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])'. // IP address ')(:\d+)?'. // port ')(((\/+([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)*'. // path '(\?([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)'. // query string '?)?)?'. // path and query string optional '(#([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?'. // fragment '$/i'; return preg_match($format, $param, $match); } function regex($value,$pattern=null,$data=null) { return preg_match($pattern, $value); } function registrationCode($param,$extra=null) { $validCodes = array('AAAA','BBBB','CCCC','DDDD'); $bul = true; foreach($validCodes as $validCode) if(strtolower($validCode) == strtolower($param)) { $bul = true; //verify if this was used before $db = &JFactory::getDBO(); $db->setQuery("SELECT `SubmissionId` FROM #__rsform_submission_values WHERE `FieldValue` = '".$param."' AND `FormId` = '".intval($_POST['form']['formId'])."' LIMIT 1"); $tmp = $db->loadResult(); if($tmp) $bul = false; //break; } else $bul = false; return $bul; }} Can you help me from here?- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with:
-
Hi to all i am trying to create a right variable so can display random questions. Let me explain feather My first question is a checkbox questions with 5 answers. every answer have a 5 more group questions. I need a variables code to do this: Every time the user checks (in first checkbox) the answer 1 and 3 the code automatically selected to display the group of 1 or 3 (not the 2 together) The same philosophy must have and the outher questions, if the answer (on first) is 2, 4 and 5 must display the group of question 2 or 4 or 5. Thanks a lot!
- 13 replies
-
- random question
- random
-
(and 2 more)
Tagged with: