Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Shareware Program?
Page 2 of 2

PostPosted: Tue Apr 18, 2006 12:30 pm
by mlambrigger
You want to use the Handango registration model, this can help you.

I have tested this with all the exemples on the site. If you find a bug, please let me know in those columns.

Code: Select all
/*
   Fichier:   Encode.oc
   Auteur:      Marc Lambrigger
   Date:      17 Avril 2006
   Description:
      - fonctions d'encodage des informations
      - fonction de calcul de la cl?ɬ© par RPNString
*/

struct lstChainInt{
   int    valInt;
   char    valChar;
   lstChainInt* next;
};

int rpnString(string value, string strRPN){
// encode a value based on the handango RPNString system
// the stack is 10 places max
   int      stack[10];   // stack
   int      istack;      // index of the stack
   int      max;      // number of pos of the string
   int    c, i, key = 0;   // variables of the RPNString
   string   temp;      // subvalue of the strRPN (operator, variable or value)
   int    istr = 0;   // index of the RPNString
   int    j = 0;
   bool    end = false;
      
   i = 0;
   max = strlen(value);
   strRPN += "#";
   while (i < max){
      // convert char from RPNString
      c = (int)value[i];
      end = false;
      j = 0;
      while(!end){
         temp ="";
         while(strRPN[j] != " " && strRPN[j] != "#"){
            temp += strRPN[j++];
            if(strRPN[j] == "#") end = true;
         }
         j++;
         switch(temp){
            case "key": stack[istack] = key; istack++; break;
            case "c": stack[istack] = c; istack++; break;
            case "i": stack[istack] = i; istack++; break;
            case "+": stack[istack-2] = stack[istack-2] + stack[istack-1]; istack--; break;
            case "-": stack[istack-2] = stack[istack-2] - stack[istack-1]; istack--; break;
            case "*": stack[istack-2] = stack[istack-2] * stack[istack-1]; istack--; break;
            case "/": stack[istack-2] = stack[istack-2] / stack[istack-1]; istack--; break;
            case "%": stack[istack-2] = stack[istack-2] % stack[istack-1]; istack--; break;
            case "<<": stack[istack-2] = stack[istack-2] << stack[istack-1]; istack--; break;
            case ">>": stack[istack-2] = stack[istack-2] >> stack[istack-1]; istack--; break;
            case "~": stack[istack-1] = ~stack[istack-1]; break;
            case "&": stack[istack-2] = stack[istack-2] & stack[istack-1]; istack--; break;
            case "|": stack[istack-2] = stack[istack-2] | stack[istack-1]; istack--; break;
            case "&&": stack[istack-2] = stack[istack-2] && stack[istack-1]; istack--; break;
            case "||": stack[istack-2] = stack[istack-2] || stack[istack-1]; istack--; break;
            case "!": stack[istack-1] = !stack[istack-1]; break;
            case "==": stack[istack-2] = stack[istack-2] == stack[istack-1]; istack--; break;
            case ">=": stack[istack-2] = stack[istack-2] >= stack[istack-1]; istack--; break;
            default: stack[istack] = temp; istack++; break;
         }
         
      }
      istack--;
      if(istack != 0){
         alert("Error in your RPNString: waiting for "+istack+" more operator(s)");
         i = max;         
         stack[0] = 999999;
      }
      else key = stack[0];
      i++;
   }
   return key & 0x0FFFF;
}

int HGrpnString(string strRPN){
   string id;
   
   id = username();
   if(strlen(id) > 10) id = substr(id, 0, 5) + substr(id, strlen(id)-5, 5);
   return rpnString(id, strRPN);
}



Marc Lambrigger