Jump to content

Recommended Posts

Fatal error: Cannot redeclare assign_rand_value() (previously declared in /home/lilysgra/public_html/lilysgraveyard/includes/readcookie.inc.php:25

 

<?php
function assign_rand_value($num) ///line 25
{
// for random session id >> accepts 1 - 36
  switch($num)
  {
    case "1":
     $rand_value = "a";
    break;
    case "2":
     $rand_value = "b";
    break;
    case "3":
     $rand_value = "c";
    break;
    case "4":
     $rand_value = "d";
    break;
    case "5":
     $rand_value = "e";
    break;
    case "6":
     $rand_value = "f";
    break;
    case "7":
     $rand_value = "g";
    break;
    case "8":
     $rand_value = "h";
    break;
    case "9":
     $rand_value = "i";
    break;
    case "10":
     $rand_value = "j";
    break;
    case "11":
     $rand_value = "k";
    break;
    case "12":
     $rand_value = "l";
    break;
    case "13":
     $rand_value = "m";
    break;
    case "14":
     $rand_value = "n";
    break;
    case "15":
     $rand_value = "o";
    break;
    case "16":
     $rand_value = "p";
    break;
    case "17":
     $rand_value = "q";
    break;
    case "18":
     $rand_value = "r";
    break;
    case "19":
     $rand_value = "s";
    break;
    case "20":
     $rand_value = "t";
    break;
    case "21":
     $rand_value = "u";
    break;
    case "22":
     $rand_value = "v";
    break;
    case "23":
     $rand_value = "w";
    break;
    case "24":
     $rand_value = "x";
    break;
    case "25":
     $rand_value = "y";
    break;
    case "26":
     $rand_value = "z";
    break;
    case "27":
     $rand_value = "1"; // no zeros, because if it starts with a zero, it might get cut off
    break;
    case "28":
     $rand_value = "1";
    break;
    case "29":
     $rand_value = "2";
    break;
    case "30":
     $rand_value = "3";
    break;
    case "31":
     $rand_value = "4";
    break;
    case "32":
     $rand_value = "5";
    break;
    case "33":
     $rand_value = "6";
    break;
    case "34":
     $rand_value = "7";
    break;
    case "35":
     $rand_value = "8";
    break;
    case "36":
     $rand_value = "9";
    break;
  }
return $rand_value;
}

function create_sessionid($length)
{
  if($length>0) 
  { 
   $rand_id="";
   for($i=1; $i<=$length; $i++)
   {
    mt_srand((double)microtime() * 1000000);
    $num = mt_rand(27,36);
    $rand_id .= assign_rand_value($num);
   }
  }
  return $rand_id;
    }

    // open the cookie and read the fortune ;-)
    if (isset($_COOKIE['fws_cust'])) { 
    $fws_cust = explode("-", $_COOKIE['fws_cust']);
    $name = $fws_cust[0];
    $customerid = $fws_cust[1];
    }
    else { 
    // you're not logged in, so you're a guest. let's see if you already have a session id
        if (!isset($_COOKIE['fws_guest'])) { 
        $fws_guest = create_sessionid(; // create a sessionid of 8 numbers, assuming a shop will never get 10.000.000 customers it's always a non existing customer id
        setcookie ("fws_guest", $fws_guest, time()+3600);
        $customerid = $fws_guest;
            
        }
        else {
          
          $customerid = $_COOKIE['fws_guest'];
        }
    }

?>

 

Link to comment
https://forums.phpfreaks.com/topic/70210-problem-with-newletter-addon/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.