Thread: encode base64
View Single Post
Author Message
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-10-2020 , 05:56   encode base64
Reply With Quote #1

Code:
error 017: undefined symbol "base64_encode"
error 088: number of arguments does not match definition
I've got these errors

base64.inc
PHP Code:
#include <amxmodx>

static const Codes64[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"

public Encode64(s[])
{
    new 
i=0,a=0,x=0,b=0,Result
    
for (i=1;i<strlen(s);i++) {
        
str_to_num(s[i])
        
256 x
        a 
8
        
while (>= 6) {
            
6
            x 
/ (<< a)
            
% (<< a)
            
Result += Codes64[1]
        }
    }
    if (
0) {
        
<< (a);
        
Result += Codes64[1];
    }
    return 
Result;
}

public 
Decode64(s[])
{
    new 
i=0,a=0,x=0,b=0,Result,ch[1]
    for (
1istrlen(s);i++) {
        for (new 
index 0Codes64[index]; index++)
            if (
s[i]==Codes64[index]) {
            
x=index-1
            
break
        }
        if (
>= 0) {
            
64 x
            a 
6
            
if (>= 8) {
                
8
                x 
>> a
                b 
% (<< a)
                
256
                Result 
+= num_to_word(x,ch,1)
            }
        }
        else exit;
    }
    return 
Result;

error line
PHP Code:
public get_graph_link(const szName[], szMotd[], iLen)
{
    static 
szName64[64];
    new 
iPos;
    
base64_encode(szNameszName64charsmax(szName64));
    
replace_all(szName64charsmax(szName64), "=""%%3D");
    
    
iPos += formatex(szMotd[iPos], iLen"<html><head></head><body bgcolor=^"#000000^"><div align=^"center^">");
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ffffff^">%s</span></strong><br /><br />", szName);
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ff0000;^">Day</span></strong><br />");
    
iPos += formatex(szMotd[iPos], iLen"<img src=^"http://www.gametracker.com/images/graphs/player_time.php?nameb64=%s&host=%s&start=-1d^" width=^"200^" height=^"150^"/><br /><br />",
    
szName64g_szIp);
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ff0000;^">Week</span></strong><br />");
    
iPos += formatex(szMotd[iPos], iLen"<img src=^"http://www.gametracker.com/images/graphs/player_time.php?nameb64=%s&host=%s&start=-1w^" width=^"200^" height=^"150^"/><br /><br />",
    
szName64g_szIp);
    
iPos += formatex(szMotd[iPos], iLen"<strong><span style=^"color:#ff0000;^">Month</span></strong><br />");
    
iPos += formatex(szMotd[iPos], iLen"<img src=^"http://www.gametracker.com/images/graphs/player_time.php?nameb64=%s&host=%s&start=-1m^" width=^"200^" height=^"150^"/><br /><br />",
    
szName64g_szIp);
    
iPos += formatex(szMotd[iPos], iLen"</div></body></html>");

PHP Code:
base64_encode(szNameszName64charsmax(szName64)); 
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline