Uporaba kriptografsko ustreznih random generatorjev

This commit is contained in:
May Doušak 2023-01-23 19:12:10 +01:00
parent 455056db2c
commit 9709285827
25 changed files with 111 additions and 111 deletions

View File

@ -67,7 +67,7 @@
// dullus for text Justification. // dullus for text Justification.
// Bob Vincent (pillarsdotnet@users.sourceforge.net) for <li> value attribute. // Bob Vincent (pillarsdotnet@users.sourceforge.net) for <li> value attribute.
// Patrick Benny for text stretch suggestion on Cell(). // Patrick Benny for text stretch suggestion on Cell().
// Johannes Güntert for JavaScript support. // Johannes G<EFBFBD>ntert for JavaScript support.
// Denis Van Nuffelen for Dynamic Form. // Denis Van Nuffelen for Dynamic Form.
// Jacek Czekaj for multibyte justification // Jacek Czekaj for multibyte justification
// Anthony Ferrara for the reintroduction of legacy image methods. // Anthony Ferrara for the reintroduction of legacy image methods.
@ -78,7 +78,7 @@
// Mohamad Ali Golkar, Saleh AlMatrafe, Charles Abbott for Arabic and Persian support. // Mohamad Ali Golkar, Saleh AlMatrafe, Charles Abbott for Arabic and Persian support.
// Moritz Wagner and Andreas Wurmser for graphic functions. // Moritz Wagner and Andreas Wurmser for graphic functions.
// Andrew Whitehead for core fonts support. // Andrew Whitehead for core fonts support.
// Esteban Joël Marín for OpenType font conversion. // Esteban Jo<EFBFBD>l Mar<61>n for OpenType font conversion.
// Teus Hagen for several suggestions and fixes. // Teus Hagen for several suggestions and fixes.
// Yukihiro Nakadaira for CID-0 CJK fonts fixes. // Yukihiro Nakadaira for CID-0 CJK fonts fixes.
// Kosmas Papachristos for some CSS improvements. // Kosmas Papachristos for some CSS improvements.
@ -6947,7 +6947,7 @@ if (!class_exists('TCPDF', false)) {
$protection += $options[$permission]; $protection += $options[$permission];
} }
if ($owner_pass === null) { if ($owner_pass === null) {
$owner_pass = uniqid(rand()); $owner_pass = uniqid(random_int());
} }
$this->encrypted = true; $this->encrypted = true;
$this->_generateencryptionkey($user_pass, $owner_pass, $protection); $this->_generateencryptionkey($user_pass, $owner_pass, $protection);
@ -8784,7 +8784,7 @@ if (!class_exists('TCPDF', false)) {
/* /*
* Adds a javascript * Adds a javascript
* @access public * @access public
* @author Johannes Güntert, Nicola Asuni * @author Johannes G<EFBFBD>ntert, Nicola Asuni
* @since 2.1.002 (2008-02-12) * @since 2.1.002 (2008-02-12)
*/ */
public function IncludeJS($script) { public function IncludeJS($script) {
@ -8794,7 +8794,7 @@ if (!class_exists('TCPDF', false)) {
/* /*
* Create a javascript PDF string. * Create a javascript PDF string.
* @access protected * @access protected
* @author Johannes Güntert, Nicola Asuni * @author Johannes G<EFBFBD>ntert, Nicola Asuni
* @since 2.1.002 (2008-02-12) * @since 2.1.002 (2008-02-12)
*/ */
protected function _putjavascript() { protected function _putjavascript() {
@ -9424,7 +9424,7 @@ if (!class_exists('TCPDF', false)) {
* @param array $col1 first color (RGB components). * @param array $col1 first color (RGB components).
* @param array $col2 second color (RGB components). * @param array $col2 second color (RGB components).
* @param array $coords array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0). * @param array $coords array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
* @author Andreas Würmser, Nicola Asuni * @author Andreas W<EFBFBD>rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09) * @since 3.1.000 (2008-06-09)
* @access public * @access public
*/ */
@ -9442,7 +9442,7 @@ if (!class_exists('TCPDF', false)) {
* @param array $col1 first color (RGB components). * @param array $col1 first color (RGB components).
* @param array $col2 second color (RGB components). * @param array $col2 second color (RGB components).
* @param array $coords array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined. * @param array $coords array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined.
* @author Andreas Würmser, Nicola Asuni * @author Andreas W<EFBFBD>rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09) * @since 3.1.000 (2008-06-09)
* @access public * @access public
*/ */
@ -9464,7 +9464,7 @@ if (!class_exists('TCPDF', false)) {
* @param array $coords <ul><li>for one patch mesh: array(float x1, float y1, .... float x12, float y12): 12 pairs of coordinates (normally from 0 to 1) which specify the Bezier control points that define the patch. First pair is the lower left edge point, next is its right control point (control point 2). Then the other points are defined in the order: control point 1, edge point, control point 2 going counter-clockwise around the patch. Last (x12, y12) is the first edge point's left control point (control point 1).</li><li>for two or more patch meshes: array[number of patches]: arrays with the following keys for each patch: f: where to put that patch (0 = first patch, 1, 2, 3 = right, top and left of precedent patch - I didn't figure this out completely - just try and error ;-) points: 12 pairs of coordinates of the Bezier control points as above for the first patch, 8 pairs of coordinates for the following patches, ignoring the coordinates already defined by the precedent patch (I also didn't figure out the order of these - also: try and see what's happening) colors: must be 4 colors for the first patch, 2 colors for the following patches</li></ul> * @param array $coords <ul><li>for one patch mesh: array(float x1, float y1, .... float x12, float y12): 12 pairs of coordinates (normally from 0 to 1) which specify the Bezier control points that define the patch. First pair is the lower left edge point, next is its right control point (control point 2). Then the other points are defined in the order: control point 1, edge point, control point 2 going counter-clockwise around the patch. Last (x12, y12) is the first edge point's left control point (control point 1).</li><li>for two or more patch meshes: array[number of patches]: arrays with the following keys for each patch: f: where to put that patch (0 = first patch, 1, 2, 3 = right, top and left of precedent patch - I didn't figure this out completely - just try and error ;-) points: 12 pairs of coordinates of the Bezier control points as above for the first patch, 8 pairs of coordinates for the following patches, ignoring the coordinates already defined by the precedent patch (I also didn't figure out the order of these - also: try and see what's happening) colors: must be 4 colors for the first patch, 2 colors for the following patches</li></ul>
* @param array $coords_min minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0 * @param array $coords_min minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0
* @param array $coords_max maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1 * @param array $coords_max maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1
* @author Andreas Würmser, Nicola Asuni * @author Andreas W<EFBFBD>rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09) * @since 3.1.000 (2008-06-09)
* @access public * @access public
*/ */
@ -9544,7 +9544,7 @@ if (!class_exists('TCPDF', false)) {
* @param float $y ordinate of the top left corner of the rectangle. * @param float $y ordinate of the top left corner of the rectangle.
* @param float $w width of the rectangle. * @param float $w width of the rectangle.
* @param float $h height of the rectangle. * @param float $h height of the rectangle.
* @author Andreas Würmser, Nicola Asuni * @author Andreas W<EFBFBD>rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09) * @since 3.1.000 (2008-06-09)
* @access protected * @access protected
*/ */
@ -9567,7 +9567,7 @@ if (!class_exists('TCPDF', false)) {
* @param array $col1 first color (RGB components). * @param array $col1 first color (RGB components).
* @param array $col2 second color (RGB components). * @param array $col2 second color (RGB components).
* @param array $coords array of coordinates. * @param array $coords array of coordinates.
* @author Andreas Würmser, Nicola Asuni * @author Andreas W<EFBFBD>rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09) * @since 3.1.000 (2008-06-09)
* @access protected * @access protected
*/ */
@ -9591,7 +9591,7 @@ if (!class_exists('TCPDF', false)) {
/** /**
* Output shaders. * Output shaders.
* @author Andreas Würmser, Nicola Asuni * @author Andreas W<EFBFBD>rmser, Nicola Asuni
* @since 3.1.000 (2008-06-09) * @since 3.1.000 (2008-06-09)
* @access protected * @access protected
*/ */

View File

@ -4946,7 +4946,7 @@ class SurveyAdmin
#če naslov ni podan ali če je uporabnik pusti nespremenjen input box za ime ankete (==> Ime ankete) zgeneriramo novo ime #če naslov ni podan ali če je uporabnik pusti nespremenjen input box za ime ankete (==> Ime ankete) zgeneriramo novo ime
if ($naslov == null || $naslov == $lang['srv_novaanketa_polnoime']) { if ($naslov == null || $naslov == $lang['srv_novaanketa_polnoime']) {
$naslov = 'Test ' . rand(100, 999); $naslov = 'Test ' . random_int(100, 999);
} }
if ($akronim == null || $akronim == $lang['srv_novaanketa_ime_respondenti']) { if ($akronim == null || $akronim == $lang['srv_novaanketa_ime_respondenti']) {

View File

@ -7996,7 +7996,7 @@ class SurveyAdminSettings {
// izberemo random hash, ki se ni v bazi (to more bit, ker je index na fieldu cookie) // izberemo random hash, ki se ni v bazi (to more bit, ker je index na fieldu cookie)
do { do {
$rand = md5(mt_rand(1, mt_getrandmax()).'@'.$_SERVER['REMOTE_ADDR']); $rand = md5(random_int(1, mt_getrandmax()).'@'.$_SERVER['REMOTE_ADDR']);
$sql1 = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'"); $sql1 = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'");
} while (mysqli_num_rows($sql1) > 0); } while (mysqli_num_rows($sql1) > 0);
@ -8032,9 +8032,9 @@ class SurveyAdminSettings {
// Ce imamo samo veljavne vedno oznacimo enega // Ce imamo samo veljavne vedno oznacimo enega
if($only_valid == 1) if($only_valid == 1)
$rand = rand(1, mysqli_num_rows($sql1)); $rand = random_int(1, mysqli_num_rows($sql1));
else else
$rand = rand(0, mysqli_num_rows($sql1)); $rand = random_int(0, mysqli_num_rows($sql1));
if ($rand > 0) { if ($rand > 0) {
for ($j=1; $j<=$rand; $j++) for ($j=1; $j<=$rand; $j++)
@ -8065,11 +8065,11 @@ class SurveyAdminSettings {
$randX = 0; $randX = 0;
if($only_valid == 1) if($only_valid == 1)
$randX = rand(1, mysqli_num_rows($sql1)); $randX = random_int(1, mysqli_num_rows($sql1));
$j=1; $j=1;
while ($row1 = mysqli_fetch_array($sql1)) { while ($row1 = mysqli_fetch_array($sql1)) {
$rand = rand(-1, 1); $rand = random_int(-1, 1);
if ($rand > 0){ if ($rand > 0){
$vrednost[$row1['id']] = $row1['id']; $vrednost[$row1['id']] = $row1['id'];
@ -8109,9 +8109,9 @@ class SurveyAdminSettings {
// Ce imamo samo veljavne vedno oznacimo enega // Ce imamo samo veljavne vedno oznacimo enega
if($only_valid == 1) if($only_valid == 1)
$rand = rand(1, mysqli_num_rows($sql2)); $rand = random_int(1, mysqli_num_rows($sql2));
else else
$rand = rand(0, mysqli_num_rows($sql2)); $rand = random_int(0, mysqli_num_rows($sql2));
if ($rand > 0) { if ($rand > 0) {
for ($j=1; $j<=$rand; $j++) for ($j=1; $j<=$rand; $j++)
@ -8143,13 +8143,13 @@ class SurveyAdminSettings {
$randX = 0; $randX = 0;
if($only_valid == 1) if($only_valid == 1)
$randX = rand(1, mysqli_num_rows($sql2)); $randX = random_int(1, mysqli_num_rows($sql2));
$j=1; $j=1;
while ($row2 = mysqli_fetch_array($sql2)) { while ($row2 = mysqli_fetch_array($sql2)) {
if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) {
$rand = rand(-1, 1); $rand = random_int(-1, 1);
if ($rand > 0) { if ($rand > 0) {
$grid_id = $row2['id']; $grid_id = $row2['id'];
@ -8193,7 +8193,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$value = $this->randomString(); $value = $this->randomString();
else else
$value = rand(0,1)==0 ? $this->randomString() : ''; $value = random_int(0,1)==0 ? $this->randomString() : '';
$grid_id = $row2['id']; $grid_id = $row2['id'];
@ -8226,7 +8226,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$vrednost = $this->randomString(); $vrednost = $this->randomString();
else else
$vrednost = rand(0,1)==0 ? $this->randomString() : ''; $vrednost = random_int(0,1)==0 ? $this->randomString() : '';
$srv_data_map .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '', '', '', '". $srv_data_map .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '', '', '', '".
($vrednost != '' ? $vrednost : '-1')."', ''),"; ($vrednost != '' ? $vrednost : '-1')."', ''),";
@ -8240,17 +8240,17 @@ class SurveyAdminSettings {
else{ else{
if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) {
$make_input = ($only_valid == 1 ? true : rand(0,1)==0); $make_input = ($only_valid == 1 ? true : random_int(0,1)==0);
if($make_input){ if($make_input){
$lat = floatval(mt_rand(454000, 466500)/10000); $lat = floatval(random_int(454000, 466500)/10000);
$lng = floatval(mt_rand(136000, 163900)/10000); $lng = floatval(random_int(136000, 163900)/10000);
// Ce imamo samo veljavne imamo vedno vrednost // Ce imamo samo veljavne imamo vedno vrednost
if($only_valid == 1) if($only_valid == 1)
$vrednost = $this->randomString(); $vrednost = $this->randomString();
else else
$vrednost = rand(0,1)==0 ? $this->randomString() : ''; $vrednost = random_int(0,1)==0 ? $this->randomString() : '';
$srv_data_map .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '$lat', '$lng', '[N/A]', '". $srv_data_map .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '$lat', '$lng', '[N/A]', '".
($vrednost != '' ? $vrednost : '-1')."', ''),"; ($vrednost != '' ? $vrednost : '-1')."', ''),";
@ -8274,7 +8274,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$vrednost = $this->randomString(); $vrednost = $this->randomString();
else else
$vrednost = rand(0,1)==0 ? $this->randomString() : ''; $vrednost = random_int(0,1)==0 ? $this->randomString() : '';
$srv_data_heatmap .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '', '', '', '". $srv_data_heatmap .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '', '', '', '".
($vrednost != '' ? $vrednost : '-1')."', ''),"; ($vrednost != '' ? $vrednost : '-1')."', ''),";
@ -8288,17 +8288,17 @@ class SurveyAdminSettings {
else{ else{
if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) {
$make_input = ($only_valid == 1 ? true : rand(0,1)==0); $make_input = ($only_valid == 1 ? true : random_int(0,1)==0);
if($make_input){ if($make_input){
$lat = floatval(mt_rand(454000, 466500)/10000); $lat = floatval(random_int(454000, 466500)/10000);
$lng = floatval(mt_rand(136000, 163900)/10000); $lng = floatval(random_int(136000, 163900)/10000);
// Ce imamo samo veljavne imamo vedno vrednost // Ce imamo samo veljavne imamo vedno vrednost
if($only_valid == 1) if($only_valid == 1)
$vrednost = $this->randomString(); $vrednost = $this->randomString();
else else
$vrednost = rand(0,1)==0 ? $this->randomString() : ''; $vrednost = random_int(0,1)==0 ? $this->randomString() : '';
$srv_data_heatmap .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '$lat', '$lng', '[N/A]', '". $srv_data_heatmap .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '$lat', '$lng', '[N/A]', '".
($vrednost != '' ? $vrednost : '-1')."', ''),"; ($vrednost != '' ? $vrednost : '-1')."', ''),";
@ -8325,7 +8325,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$value = $this->randomNumber(); $value = $this->randomNumber();
else else
$value = rand(0,1)==0 ? $this->randomNumber() : ''; $value = random_int(0,1)==0 ? $this->randomNumber() : '';
$grid_id = $row2['id']; $grid_id = $row2['id'];
@ -8349,7 +8349,7 @@ class SurveyAdminSettings {
elseif ($row['tip'] == 4) { elseif ($row['tip'] == 4) {
if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) {
$vrednost = rand(0,1)==0 ? $this->randomString() : ''; $vrednost = random_int(0,1)==0 ? $this->randomString() : '';
if ($vrednost != '') if ($vrednost != '')
$srv_data_text .= "('$row[id]', '', '$vrednost', '', '$this->usr_id'),"; $srv_data_text .= "('$row[id]', '', '$vrednost', '', '$this->usr_id'),";
} else { } else {
@ -8369,7 +8369,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$vrednost = $this->randomString(); $vrednost = $this->randomString();
else else
$vrednost = rand(0,1)==0 ? $this->randomString() : ''; $vrednost = random_int(0,1)==0 ? $this->randomString() : '';
if ($vrednost != '') if ($vrednost != '')
$srv_data_text .= "('$row[id]', '$row1[id]', '$vrednost', '', '$this->usr_id'),"; $srv_data_text .= "('$row[id]', '$row1[id]', '$vrednost', '', '$this->usr_id'),";
@ -8407,7 +8407,7 @@ class SurveyAdminSettings {
//if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber(); //if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber();
if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber($newLength); if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber($newLength);
} }
elseif (rand(0,1) == 0) { elseif (random_int(0,1) == 0) {
//if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber(); //if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber();
if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber($newLength); if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber($newLength);
//if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber(); //if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber();
@ -8462,7 +8462,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$vrednost = $this->randomDate(); $vrednost = $this->randomDate();
else else
$vrednost = rand(0,1)==0 ? $this->randomDate() : ''; $vrednost = random_int(0,1)==0 ? $this->randomDate() : '';
if ($vrednost != '') if ($vrednost != '')
$srv_data_text .= "('$row[id]', '', '$vrednost', '', '$this->usr_id'),"; $srv_data_text .= "('$row[id]', '', '$vrednost', '', '$this->usr_id'),";
@ -8487,12 +8487,12 @@ class SurveyAdminSettings {
// Ce imamo samo veljavne imamo vedno vrednosti // Ce imamo samo veljavne imamo vedno vrednosti
if($only_valid == 1){ if($only_valid == 1){
if (rand(0,1) == 0) $rows = floor($rows/2); if (random_int(0,1) == 0) $rows = floor($rows/2);
$array = range(1, $rows); $array = range(1, $rows);
shuffle($array); shuffle($array);
} }
elseif (rand(0,1) == 0) { elseif (random_int(0,1) == 0) {
if (rand(0,1) == 0) $rows = floor($rows/2); if (random_int(0,1) == 0) $rows = floor($rows/2);
$array = range(1, $rows); $array = range(1, $rows);
shuffle($array); shuffle($array);
} }
@ -8533,7 +8533,7 @@ class SurveyAdminSettings {
// Ce imamo samo veljavne imamo vedno vrednosti // Ce imamo samo veljavne imamo vedno vrednosti
if($only_valid == 1) if($only_valid == 1)
$vrednost = $this->randomNumber(); $vrednost = $this->randomNumber();
elseif(rand(0,1) == 0) elseif(random_int(0,1) == 0)
$vrednost = $this->randomNumber(); $vrednost = $this->randomNumber();
if (isset( $vrednost )) { if (isset( $vrednost )) {
@ -8566,9 +8566,9 @@ class SurveyAdminSettings {
// Ce imamo samo veljavne vedno oznacimo enega // Ce imamo samo veljavne vedno oznacimo enega
if($only_valid == 1) if($only_valid == 1)
$rand = rand(1, mysqli_num_rows($sql2)); $rand = random_int(1, mysqli_num_rows($sql2));
else else
$rand = rand(0, mysqli_num_rows($sql2)); $rand = random_int(0, mysqli_num_rows($sql2));
if ($rand > 0) { if ($rand > 0) {
for ($j=1; $j<=$rand; $j++) for ($j=1; $j<=$rand; $j++)
@ -8600,13 +8600,13 @@ class SurveyAdminSettings {
$randX = 0; $randX = 0;
if($only_valid == 1) if($only_valid == 1)
$randX = rand(1, mysqli_num_rows($sql2)); $randX = random_int(1, mysqli_num_rows($sql2));
$j=1; $j=1;
while ($row2 = mysqli_fetch_array($sql2)) { while ($row2 = mysqli_fetch_array($sql2)) {
if ($s->checkSpremenljivka($rowC['id'], $isTestData=true)) { if ($s->checkSpremenljivka($rowC['id'], $isTestData=true)) {
$rand = rand(-1, 1); $rand = random_int(-1, 1);
if ($rand > 0) { if ($rand > 0) {
$grid_id = $row2['id']; $grid_id = $row2['id'];
@ -8651,7 +8651,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$value = $this->randomString(); $value = $this->randomString();
else else
$value = rand(0,1)==0 ? $this->randomString() : ''; $value = random_int(0,1)==0 ? $this->randomString() : '';
$grid_id = $row2['id']; $grid_id = $row2['id'];
@ -8686,7 +8686,7 @@ class SurveyAdminSettings {
if($only_valid == 1) if($only_valid == 1)
$value = $this->randomNumber(); $value = $this->randomNumber();
else else
$value = rand(0,1)==0 ? $this->randomNumber() : ''; $value = random_int(0,1)==0 ? $this->randomNumber() : '';
$grid_id = $row2['id']; $grid_id = $row2['id'];
@ -8939,13 +8939,13 @@ class SurveyAdminSettings {
$chars_length = (strlen($chars) - 1); $chars_length = (strlen($chars) - 1);
// Start our string // Start our string
$string = $chars[mt_rand(0, $chars_length)]; $string = $chars[random_int(0, $chars_length)];
// Generate random string // Generate random string
for ($i = 1; $i < $length; $i = strlen($string)) for ($i = 1; $i < $length; $i = strlen($string))
{ {
// Grab a random character from our list // Grab a random character from our list
$r = $chars[mt_rand(0, $chars_length)]; $r = $chars[random_int(0, $chars_length)];
// Make sure the same two characters don't appear next to each other // Make sure the same two characters don't appear next to each other
if ($r != $string[$i - 1]) $string .= $r; if ($r != $string[$i - 1]) $string .= $r;
@ -8962,7 +8962,7 @@ class SurveyAdminSettings {
function randomDate ($startDate = '01.01.1950', $endDate = '') { function randomDate ($startDate = '01.01.1950', $endDate = '') {
if ($endDate == '') $endDate = date("d.m.Y"); if ($endDate == '') $endDate = date("d.m.Y");
$days = round((strtotime($endDate) - strtotime($startDate)) / (60 * 60 * 24)); $days = round((strtotime($endDate) - strtotime($startDate)) / (60 * 60 * 24));
$n = rand(0,$days); $n = random_int(0,$days);
return date("d.m.Y",strtotime("$startDate + $n days")); return date("d.m.Y",strtotime("$startDate + $n days"));
} }

View File

@ -845,7 +845,7 @@ class SurveyCopy {
foreach ( $arr_src['srv_user'] AS $row_array ) { foreach ( $arr_src['srv_user'] AS $row_array ) {
do { do {
$rand = md5(mt_rand(1, mt_getrandmax()).'@'.$ip); $rand = md5(random_int(1, PHP_INT_MAX).'@'.$ip);
$sql = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'"); $sql = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'");
} while (mysqli_num_rows($sql) > 0); } while (mysqli_num_rows($sql) > 0);
@ -1175,7 +1175,7 @@ class SurveyCopy {
// Nastavimo nov cookie - izberemo random hash, ki se ni v bazi // Nastavimo nov cookie - izberemo random hash, ki se ni v bazi
do { do {
$rand = md5(mt_rand(1, mt_getrandmax()) . '@' . $global_user_id); $rand = md5(random_int(1, PHP_INT_MAX) . '@' . $global_user_id);
$sql = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'"); $sql = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'");

View File

@ -71,7 +71,7 @@ class SurveyMobile {
// Ni se registriran, ga je potrebno dodati na prijavno formo // Ni se registriran, ga je potrebno dodati na prijavno formo
else { else {
// geslo med 00000 in zzzzz // geslo med 00000 in zzzzz
$pass = base_convert(mt_rand(0x19A100, 0x39AA3FF), 10, 36); $pass = base_convert(random_int(0x19A100, 0x39AA3FF), 10, 36);
$EncPass = base64_encode((hash('SHA256', $pass))); $EncPass = base64_encode((hash('SHA256', $pass)));
$fn = explode("@", $user_email); $fn = explode("@", $user_email);

View File

@ -726,7 +726,7 @@ class SurveyRespondents {
// izberemo random hash, ki se ni v bazi // izberemo random hash, ki se ni v bazi
do { do {
$rand = md5(mt_rand(1, mt_getrandmax()) . '@' . $_SERVER['REMOTE_ADDR']); $rand = md5(random_int(1, PHP_INT_MAX) . '@' . $_SERVER['REMOTE_ADDR']);
$sql = sisplet_query("SELECT id FROM srv_user WHERE SUBSTRING(cookie, 1, 6) = SUBSTRING('".$rand."', 1, 6)"); $sql = sisplet_query("SELECT id FROM srv_user WHERE SUBSTRING(cookie, 1, 6) = SUBSTRING('".$rand."', 1, 6)");
} while (mysqli_num_rows($sql) > 0); } while (mysqli_num_rows($sql) > 0);

View File

@ -2770,7 +2770,7 @@ class SurveyTelephone {
} }
function generateCode() { function generateCode() {
$cookie = md5(mt_rand(1, mt_getrandmax()) . '@' . $_SERVER['REMOTE_ADDR']); $cookie = md5(random_int(1, PHP_INT_MAX) . '@' . $_SERVER['REMOTE_ADDR']);
return array(substr($cookie,0,6), $cookie); return array(substr($cookie,0,6), $cookie);
} }

View File

@ -1383,7 +1383,7 @@ class SurveyInvitationsNew {
function generateCode() { function generateCode() {
// Zgeneriramo cookie // Zgeneriramo cookie
$cookie = md5(mt_rand(1, mt_getrandmax()) . '@' . $_SERVER['REMOTE_ADDR']); $cookie = md5(random_int(1, PHP_INT_MAX) . '@' . $_SERVER['REMOTE_ADDR']);
// Ce je prvi znak stevilka jo spremenimo v crko ker drugace vcasih izvoz v excel ne dela ok // Ce je prvi znak stevilka jo spremenimo v crko ker drugace vcasih izvoz v excel ne dela ok
$letters = array('a', 'b', 'c', 'd', 'e', 'f'); $letters = array('a', 'b', 'c', 'd', 'e', 'f');

View File

@ -112,7 +112,7 @@ class SurveyUnsubscribe {
} }
function generateCode() { function generateCode() {
$cookie = md5(mt_rand(1, mt_getrandmax()) . '@' . $_SERVER['REMOTE_ADDR']); $cookie = md5(random_int(1, PHP_INT_MAX) . '@' . $_SERVER['REMOTE_ADDR']);
return array(substr($cookie,0,6), $cookie); return array(substr($cookie,0,6), $cookie);
} }

View File

@ -220,7 +220,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
if (function_exists('posix_getpid')) { if (function_exists('posix_getpid')) {
$baseUnique = posix_getpid(); $baseUnique = posix_getpid();
} else { } else {
$baseUnique = mt_rand(); $baseUnique = random_int();
} }
return uniqid($baseUnique,true); return uniqid($baseUnique,true);
} }

View File

@ -79,7 +79,7 @@ class PHPExcel_Calculation_MathTrig {
* ATAN2 * ATAN2
* *
* This function calculates the arc tangent of the two variables x and y. It is similar to * This function calculates the arc tangent of the two variables x and y. It is similar to
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used * calculating the arc tangent of y <EFBFBD> x, except that the signs of both arguments are used
* to determine the quadrant of the result. * to determine the quadrant of the result.
* The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a * The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
* point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between * point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
@ -880,9 +880,9 @@ class PHPExcel_Calculation_MathTrig {
$max = PHPExcel_Calculation_Functions::flattenSingleValue($max); $max = PHPExcel_Calculation_Functions::flattenSingleValue($max);
if ($min == 0 && $max == 0) { if ($min == 0 && $max == 0) {
return (rand(0,10000000)) / 10000000; return (random_int(0,10000000)) / 10000000;
} else { } else {
return rand($min, $max); return random_int($min, $max);
} }
} // function RAND() } // function RAND()

View File

@ -128,7 +128,7 @@ class PHPConsoleHandlerTest extends TestCase
{ {
$message = 'test'; $message = 'test';
$tag = 'tag'; $tag = 'tag';
$context = array($tag, 'custom' => mt_rand()); $context = array($tag, 'custom' => random_int());
$expectedMessage = $message . ' ' . json_encode(array_slice($context, 1)); $expectedMessage = $message . ' ' . json_encode(array_slice($context, 1));
$this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with( $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with(
$this->equalTo($expectedMessage), $this->equalTo($expectedMessage),
@ -139,7 +139,7 @@ class PHPConsoleHandlerTest extends TestCase
public function testDebugTags($tagsContextKeys = null) public function testDebugTags($tagsContextKeys = null)
{ {
$expectedTags = mt_rand(); $expectedTags = random_int();
$logger = $this->initLogger($tagsContextKeys ? array('debugTagsKeysInContext' => $tagsContextKeys) : array()); $logger = $this->initLogger($tagsContextKeys ? array('debugTagsKeysInContext' => $tagsContextKeys) : array());
if (!$tagsContextKeys) { if (!$tagsContextKeys) {
$tagsContextKeys = $this->getHandlerDefaultOption('debugTagsKeysInContext'); $tagsContextKeys = $this->getHandlerDefaultOption('debugTagsKeysInContext');

View File

@ -128,7 +128,7 @@ class StreamHandlerTest extends TestCase
*/ */
public function testWriteNonExistingResource() public function testWriteNonExistingResource()
{ {
$handler = new StreamHandler('ftp://foo/bar/baz/'.rand(0, 10000)); $handler = new StreamHandler('ftp://foo/bar/baz/'.random_int(0, 10000));
$handler->handle($this->getRecord()); $handler->handle($this->getRecord());
} }
@ -138,7 +138,7 @@ class StreamHandlerTest extends TestCase
*/ */
public function testWriteNonExistingPath() public function testWriteNonExistingPath()
{ {
$handler = new StreamHandler(sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); $handler = new StreamHandler(sys_get_temp_dir().'/bar/'.random_int(0, 10000).DIRECTORY_SEPARATOR.random_int(0, 10000));
$handler->handle($this->getRecord()); $handler->handle($this->getRecord());
} }
@ -148,7 +148,7 @@ class StreamHandlerTest extends TestCase
*/ */
public function testWriteNonExistingFileResource() public function testWriteNonExistingFileResource()
{ {
$handler = new StreamHandler('file://'.sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); $handler = new StreamHandler('file://'.sys_get_temp_dir().'/bar/'.random_int(0, 10000).DIRECTORY_SEPARATOR.random_int(0, 10000));
$handler->handle($this->getRecord()); $handler->handle($this->getRecord());
} }
@ -163,7 +163,7 @@ class StreamHandlerTest extends TestCase
if (defined('PHP_WINDOWS_VERSION_BUILD')) { if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->markTestSkipped('Permissions checks can not run on windows'); $this->markTestSkipped('Permissions checks can not run on windows');
} }
$handler = new StreamHandler('/foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); $handler = new StreamHandler('/foo/bar/'.random_int(0, 10000).DIRECTORY_SEPARATOR.random_int(0, 10000));
$handler->handle($this->getRecord()); $handler->handle($this->getRecord());
} }
@ -178,7 +178,7 @@ class StreamHandlerTest extends TestCase
if (defined('PHP_WINDOWS_VERSION_BUILD')) { if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->markTestSkipped('Permissions checks can not run on windows'); $this->markTestSkipped('Permissions checks can not run on windows');
} }
$handler = new StreamHandler('file:///foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); $handler = new StreamHandler('file:///foo/bar/'.random_int(0, 10000).DIRECTORY_SEPARATOR.random_int(0, 10000));
$handler->handle($this->getRecord()); $handler->handle($this->getRecord());
} }
} }

View File

@ -43,7 +43,7 @@ namespace PropsExample {
return new Session($c->session_storage); return new Session($c->session_storage);
}); });
$this->random = $this->protect(function () { return rand(); }); $this->random = $this->protect(function () { return random_int(); });
$this->mail = function (MyContainer2 $c) { $this->mail = function (MyContainer2 $c) {
return new Zend_Mail(); return new Zend_Mail();

View File

@ -1447,7 +1447,7 @@ class MAZA {
$max = /*strlen($codeAlphabet)-1;*/59; // edited $max = /*strlen($codeAlphabet)-1;*/59; // edited
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$token .= $codeAlphabet[mt_rand(0, $max)]; $token .= $codeAlphabet[random_int(0, $max)];
} }
return $token; return $token;

View File

@ -815,7 +815,7 @@ class ApiLogin
} // Ni se registriran, ga je potrebno dodati na prijavno formo } // Ni se registriran, ga je potrebno dodati na prijavno formo
else { else {
// geslo med 00000 in zzzzz // geslo med 00000 in zzzzz
$this->pass = base_convert(mt_rand(0x19A100, 0x39AA3FF), 10, 36); $this->pass = base_convert(random_int(0x19A100, 0x39AA3FF), 10, 36);
$this->EncPass = base64_encode((hash('SHA256', $this->pass.$pass_salt))); $this->EncPass = base64_encode((hash('SHA256', $this->pass.$pass_salt)));
$this->email = $user_email; $this->email = $user_email;
@ -977,7 +977,7 @@ class ApiLogin
} }
// geslo med 00000 in zzzzz // geslo med 00000 in zzzzz
$this->pass = base_convert(mt_rand(0x19A100, 0x39AA3FF), 10, 36); $this->pass = base_convert(random_int(0x19A100, 0x39AA3FF), 10, 36);
$this->EncPass = base64_encode((hash('SHA256', $this->pass.$pass_salt))); $this->EncPass = base64_encode((hash('SHA256', $this->pass.$pass_salt)));
$this->email = str_replace([" ", "č", "ć", "Č", "Ć", "ž", "Ž", "š", "Š", "đ", "Đ"], [".", "c", "c", "C", "C", "z", "Z", "s", "S", "d", "D"], $user->email); $this->email = str_replace([" ", "č", "ć", "Č", "Ć", "ž", "Ž", "š", "Š", "đ", "Đ"], [".", "c", "c", "C", "C", "z", "Z", "s", "S", "d", "D"], $user->email);
@ -1933,7 +1933,7 @@ class ApiLogin
// Novo geslo sestavis iz dveh nakljucnih besed + stevilke // Novo geslo sestavis iz dveh nakljucnih besed + stevilke
include($site_path.'lang/words_'.$lang['language_short'].'.php'); include($site_path.'lang/words_'.$lang['language_short'].'.php');
$geslo = strtolower($words[rand(0, 999)].rand(0, 9).$words[rand(0, 999)]); $geslo = strtolower($words[random_int(0, 999)].random_int(0, 9).$words[random_int(0, 999)]);
// passhint je parameter v linku ki ga skombiniras skupaj z emailom in mu potem aktiviras novo geslo // passhint je parameter v linku ki ga skombiniras skupaj z emailom in mu potem aktiviras novo geslo
$passhint = base64_encode((hash('SHA256', time().$pass_salt))); $passhint = base64_encode((hash('SHA256', time().$pass_salt)));

View File

@ -119,7 +119,7 @@ class Format {
$vid = ''; $vid = '';
General::srand_once(); General::srand_once();
for ($i=0; $i<$len; $i++) for ($i=0; $i<$len; $i++)
$vid .= rand(0,9); $vid .= random_int(0,9);
return $vid; return $vid;
} }

View File

@ -308,7 +308,7 @@ class Profile {
// Ni se registriran, ga je potrebno dodati na prijavno formo // Ni se registriran, ga je potrebno dodati na prijavno formo
else { else {
// geslo med 00000 in zzzzz // geslo med 00000 in zzzzz
$this->pass = base_convert(mt_rand(0x19A100, 0x39AA3FF), 10, 36); $this->pass = base_convert(random_int(0x19A100, 0x39AA3FF), 10, 36);
$this->EncPass = base64_encode((hash('SHA256', $this->pass .$pass_salt))); $this->EncPass = base64_encode((hash('SHA256', $this->pass .$pass_salt)));
$this->email = $user_email; $this->email = $user_email;
$fn = explode ("@", $user_email); $fn = explode ("@", $user_email);

View File

@ -438,9 +438,9 @@ class HeaderController extends Controller
// moznost zip skinov // moznost zip skinov
if (!is_file(self::$site_path . 'main/survey/skins/' . $row['skin'] . '.css')) { if (!is_file(self::$site_path . 'main/survey/skins/' . $row['skin'] . '.css')) {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $row['skin'] . '/' . $row['skin'] . '.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $row['skin'] . '/' . $row['skin'] . '.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} else { } else {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $row['skin'] . '.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $row['skin'] . '.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} }
} }
// nastavljen je profil, nastavimo temo in potem še lastne nastavitve // nastavljen je profil, nastavimo temo in potem še lastne nastavitve
@ -451,9 +451,9 @@ class HeaderController extends Controller
// moznost zip skinov // moznost zip skinov
if (!is_file(self::$site_path . 'main/survey/skins/' . $rowa['skin'] . '.css')) { if (!is_file(self::$site_path . 'main/survey/skins/' . $rowa['skin'] . '.css')) {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $rowa['skin'] . '/' . $rowa['skin'] . '.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $rowa['skin'] . '/' . $rowa['skin'] . '.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} else { } else {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $rowa['skin'] . '.css' . ($themePreview || true ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $rowa['skin'] . '.css' . ($themePreview || true ? '?foo=' . random_int() : '') . '">' . "\n";
} }
$sqlt = sisplet_query("SELECT * FROM srv_theme_editor WHERE profile_id = '" . $row['skin_profile'] . "'"); $sqlt = sisplet_query("SELECT * FROM srv_theme_editor WHERE profile_id = '" . $row['skin_profile'] . "'");
@ -602,7 +602,7 @@ class HeaderController extends Controller
// Za office in nature skina imamo random background // Za office in nature skina imamo random background
if($row['skin'] == '1kaOffice' || $row['skin'] == '1kaNature'){ if($row['skin'] == '1kaOffice' || $row['skin'] == '1kaNature'){
$bg_number = rand(1,15); $bg_number = random_int(1,15);
echo '<style> html{ background-image: url(' . self::$site_url . 'main/survey/skins/'.$row['skin'].'/bg'.$bg_number.'.jpg); } </style>'; echo '<style> html{ background-image: url(' . self::$site_url . 'main/survey/skins/'.$row['skin'].'/bg'.$bg_number.'.jpg); } </style>';
} }
} }
@ -634,10 +634,10 @@ class HeaderController extends Controller
if ($row['skin_profile_mobile'] == 0) { if ($row['skin_profile_mobile'] == 0) {
if (!is_file(self::$site_path . 'main/survey/skins/' . $row['mobile_skin'] . '.css')) { if (!is_file(self::$site_path . 'main/survey/skins/' . $row['mobile_skin'] . '.css')) {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/MobileBlue.css'.($themePreview ? '?foo=' . mt_rand() : '').'" media="all">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/MobileBlue.css'.($themePreview ? '?foo=' . random_int() : '').'" media="all">' . "\n";
} }
else { else {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $row['mobile_skin'] . '.css'.($themePreview ? '?foo='. mt_rand() : '').'" media="all">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $row['mobile_skin'] . '.css'.($themePreview ? '?foo='. random_int() : '').'" media="all">' . "\n";
} }
} }
// nastavljen je profil, nastavimo temo in potem še lastne nastavitve // nastavljen je profil, nastavimo temo in potem še lastne nastavitve
@ -647,9 +647,9 @@ class HeaderController extends Controller
$rowa = mysqli_fetch_array($sqla); $rowa = mysqli_fetch_array($sqla);
if (!is_file(self::$site_path . 'main/survey/skins/' . $rowa['skin'] . '.css')) { if (!is_file(self::$site_path . 'main/survey/skins/' . $rowa['skin'] . '.css')) {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/MobileBlue.css'.($themePreview ? '?foo=' . mt_rand() : '').'" media="all">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/MobileBlue.css'.($themePreview ? '?foo=' . random_int() : '').'" media="all">' . "\n";
} else { } else {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $rowa['skin'] . '.css'.($themePreview || true ? '?foo='. mt_rand() : '').'" media="all">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/' . $rowa['skin'] . '.css'.($themePreview || true ? '?foo='. random_int() : '').'" media="all">' . "\n";
} }
$sqlt = sisplet_query("SELECT * FROM srv_theme_editor_mobile WHERE profile_id = '" . $row['skin_profile_mobile'] . "'"); $sqlt = sisplet_query("SELECT * FROM srv_theme_editor_mobile WHERE profile_id = '" . $row['skin_profile_mobile'] . "'");
@ -814,14 +814,14 @@ class HeaderController extends Controller
echo '<link type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,700&subset=latin,latin-ext" rel="stylesheet">'; echo '<link type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,700&subset=latin,latin-ext" rel="stylesheet">';
// Imamo različne backgrounde // Imamo različne backgrounde
$bg_number = rand(1,9); $bg_number = random_int(1,9);
echo '<style> echo '<style>
html{ html{
background-image: url(' . self::$site_url . 'main/survey/skins/___po_narocilu/Bled/bg'.$bg_number.'.jpg); background-image: url(' . self::$site_url . 'main/survey/skins/___po_narocilu/Bled/bg'.$bg_number.'.jpg);
} }
</style>'; </style>';
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/Bled.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/Bled.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
// Premaknemo footer na dno // Premaknemo footer na dno
echo '<script> echo '<script>
@ -850,15 +850,15 @@ class HeaderController extends Controller
// mobitel // mobitel
if (get('mobile') == 1) { if (get('mobile') == 1) {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/MJU_mobile.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/MJU_mobile.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} }
// tablica // tablica
elseif(get('mobile') == 2){ elseif(get('mobile') == 2){
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/MJU_tablet.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/MJU_tablet.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} }
// navaden racunalnik // navaden racunalnik
else{ else{
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/MJU.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/MJU.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} }
} }
// Custom skin za IAS anketo - spanci // Custom skin za IAS anketo - spanci
@ -871,11 +871,11 @@ class HeaderController extends Controller
// mobitel // mobitel
if (get('mobile') == 1) { if (get('mobile') == 1) {
echo ' <link rel="stylesheet" href="' . self::$site_url . 'public/css/main_mobile.css" media="all">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'public/css/main_mobile.css" media="all">' . "\n";
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/IAS_mobile.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/IAS_mobile.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} }
// navaden racunalnik // navaden racunalnik
else{ else{
echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/IAS.css' . ($themePreview ? '?foo=' . mt_rand() : '') . '">' . "\n"; echo ' <link rel="stylesheet" href="' . self::$site_url . 'main/survey/skins/___po_narocilu/IAS.css' . ($themePreview ? '?foo=' . random_int() : '') . '">' . "\n";
} }
} }
} }

View File

@ -1095,7 +1095,7 @@ class InitClass extends Controller
// izberemo random hash, ki se ni v bazi // izberemo random hash, ki se ni v bazi
do { do {
$rand = md5(mt_rand(1, mt_getrandmax()) . '@' . Helper::remote_address()); $rand = md5(random_int(1, PHP_INT_MAX) . '@' . Helper::remote_address());
$sql = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'"); $sql = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'");
} while (mysqli_num_rows($sql) > 0); } while (mysqli_num_rows($sql) > 0);

View File

@ -116,7 +116,7 @@ class Model
if ($usr_id > 0) { if ($usr_id > 0) {
$seed_num = (int)$usr_id + (int)$spremenljivka; $seed_num = (int)$usr_id + (int)$spremenljivka;
mt_srand($seed_num); mt_srand($seed_num);
$seed = mt_rand(); $seed = random_int(0, PHP_INT_MAX);
} }
// na random izberemo (tiste, ki se random sortirajo) in jih damo na prosto mesto // na random izberemo (tiste, ki se random sortirajo) in jih damo na prosto mesto

View File

@ -61,13 +61,13 @@ if (@extension_loaded('zlib'))
{ {
$char = $code{$i}; $char = $code{$i};
$width = mt_rand(0, 4); $width = random_int(0, 4);
$char_widths[] = $width; $char_widths[] = $width;
$img_width += $_png[$char]['width'] - $width; $img_width += $_png[$char]['width'] - $width;
} }
$offset_x = mt_rand(0, $total_width - $img_width); $offset_x = random_int(0, $total_width - $img_width);
$offset_y = mt_rand(0, $total_height - $img_height); $offset_y = random_int(0, $total_height - $img_height);
$image = ''; $image = '';
$hold_chars = array(); $hold_chars = array();
@ -81,7 +81,7 @@ if (@extension_loaded('zlib'))
for ($k = 0; $k < $offset_x; $k++) for ($k = 0; $k < $offset_x; $k++)
{ {
$image .= chr(mt_rand(140, 255)); $image .= chr(random_int(140, 255));
} }
for ($k = 0; $k < strlen($code); $k++) for ($k = 0; $k < strlen($code); $k++)
@ -98,7 +98,7 @@ if (@extension_loaded('zlib'))
for ($k = $offset_x + $img_width; $k < $total_width; $k++) for ($k = $offset_x + $img_width; $k < $total_width; $k++)
{ {
$image .= chr(mt_rand(140, 255)); $image .= chr(random_int(140, 255));
} }
$l++; $l++;
@ -107,7 +107,7 @@ if (@extension_loaded('zlib'))
{ {
for ($k = 0; $k < $total_width; $k++) for ($k = 0; $k < $total_width; $k++)
{ {
$image .= chr(mt_rand(140, 255)); $image .= chr(random_int(140, 255));
} }
} }
@ -159,11 +159,11 @@ function randomise($scanline, $width)
if ($pixel < 190) if ($pixel < 190)
{ {
$new_line .= chr(mt_rand(0, 205)); $new_line .= chr(random_int(0, 205));
} }
else if ($pixel > 190) else if ($pixel > 190)
{ {
$new_line .= chr(mt_rand(145, 255)); $new_line .= chr(random_int(145, 255));
} }
else else
{ {

View File

@ -174,9 +174,9 @@ echo "<hr>KLican sem na getfields<hr>";
// Najprej random radio // Najprej random radio
for ($a = 0; $a < sizeof($this->arr_radio); $a++) { for ($a = 0; $a < sizeof($this->arr_radio); $a++) {
$radios .= "&" .$this->arr_radio[$a][0] ."=" .$this->arr_radio[$a][rand(1, sizeof($this->arr_radio[$a])-1)]; $radios .= "&" .$this->arr_radio[$a][0] ."=" .$this->arr_radio[$a][random_int(1, sizeof($this->arr_radio[$a])-1)];
$data[$this->arr_radio[$a][0]] = $this->arr_radio[$a][rand(1, sizeof($this->arr_radio[$a])-1)]; $data[$this->arr_radio[$a][0]] = $this->arr_radio[$a][random_int(1, sizeof($this->arr_radio[$a])-1)];
echo "Na ossfet " .$this->arr_radio[$a][0] ." nastavljam vrednost " .$this->arr_radio[$a][rand(1, sizeof($this->arr_radio[$a])-1)]; echo "Na ossfet " .$this->arr_radio[$a][0] ." nastavljam vrednost " .$this->arr_radio[$a][random_int(1, sizeof($this->arr_radio[$a])-1)];
} }
// hidden ni random // hidden ni random
for ($a = 0; $a < sizeof($this->arr_hidden); $a++) { for ($a = 0; $a < sizeof($this->arr_hidden); $a++) {
@ -190,8 +190,8 @@ echo "Na ossfet " .$this->arr_radio[$a][0] ." nastavljam vrednost " .$this->arr_
$kljukic = rand (1, sizeof($this->arr_checkbox[$a])); $kljukic = rand (1, sizeof($this->arr_checkbox[$a]));
for ($b = 0; $b < $kljukic; $b++) { for ($b = 0; $b < $kljukic; $b++) {
$checks .= "&" .$this->arr_checkbox[$a][0] ."=" .$this->arr_checkbox[$a][rand(1, sizeof($this->arr_checkbox[$a])-1)]; $checks .= "&" .$this->arr_checkbox[$a][0] ."=" .$this->arr_checkbox[$a][random_int(1, sizeof($this->arr_checkbox[$a])-1)];
$data[$this->arr_checkbox[$a][0]] = $this->arr_checkbox[$a][rand(1, sizeof($this->arr_checkbox[$a])-1)]; $data[$this->arr_checkbox[$a][0]] = $this->arr_checkbox[$a][random_int(1, sizeof($this->arr_checkbox[$a])-1)];
} }
} }
echo "data[vrednost_2901] je " .$data['vrednost_2901']; echo "data[vrednost_2901] je " .$data['vrednost_2901'];

View File

@ -8,7 +8,7 @@
$moja = ""; $moja = "";
for ($a=0; $a<200; $a++) { for ($a=0; $a<200; $a++) {
$moja .= $charset[rand(0, strlen($charset))]; $moja .= $charset[random_int(0, strlen($charset))];
} }

View File

@ -173,7 +173,7 @@ class LoadTest {
// radio button - izberemo enega nakljucno // radio button - izberemo enega nakljucno
if ($input['type'] == 'radio') { if ($input['type'] == 'radio') {
$pos = rand(0, count($input)-2); $pos = random_int(0, count($input)-2);
$form[$key] = $input[$pos]; $form[$key] = $input[$pos];
// checkbox (razlika je v tabeli in navadnih, ker imajo razlicen nacin poimenovanja, in se ne da drugace zaznati skupin... zakompliciran..) // checkbox (razlika je v tabeli in navadnih, ker imajo razlicen nacin poimenovanja, in se ne da drugace zaznati skupin... zakompliciran..)
@ -181,20 +181,20 @@ class LoadTest {
// navaden checkbox - izberemo enega nakljucno // navaden checkbox - izberemo enega nakljucno
if ( count($input) > 2 ) { if ( count($input) > 2 ) {
$pos = rand(0, count($input)-2); $pos = random_int(0, count($input)-2);
$form[$key] = $input[$pos]; $form[$key] = $input[$pos];
// multigrid checkbox - vsak checkbox obkljukamo z verjetnostjo 50% (ker se ne da razbrati vrstic zaradi takega poimenovanja) // multigrid checkbox - vsak checkbox obkljukamo z verjetnostjo 50% (ker se ne da razbrati vrstic zaradi takega poimenovanja)
} else { } else {
foreach ($input AS $k => $v) { foreach ($input AS $k => $v) {
if ($v != 'checkbox') if ($v != 'checkbox')
if (rand(0,1) >= 0.5) $form[$key] = $v; else unset($form[$key]); if (random_int(0,1) >= 0.5) $form[$key] = $v; else unset($form[$key]);
} }
} }
// textfield - vpisemo nek random string // textfield - vpisemo nek random string
} elseif ($input['type'] == 'text') { } elseif ($input['type'] == 'text') {
$form[$key] = ($_GET['uniqueID']!=''?$_GET['uniqueID'].'-':'') . substr(sha1(rand(0,1).time()), 0, 10); $form[$key] = ($_GET['uniqueID']!=''?$_GET['uniqueID'].'-':'') . substr(sha1(random_int(0,1).time()), 0, 10);
// ce je samo 1 element, nimamo kaj randomizirat (count je 2, ker je en type) // ce je samo 1 element, nimamo kaj randomizirat (count je 2, ker je en type)