Jump to content

Yum

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by Yum


  1. Hello,

     

    I'm trying to make the ban on an account through my php. I am not knowing generate the correct value for unban_time ...

     

    Using the basis of Ceres I got this:

     

    DEFINE('PARTNER_BAN', "UPDATE `login` SET `unban_time` = NOW() + '%d' WHERE `account_id` = '%d' AND `unban_time` = '0'");

     

    What is the value of %d?

    if (isset($GET_frm_name) && isset($GET_id)) {	$query = sprintf(ACCOUNTS_SEARCH_ACCOUNT_ID, trim($GET_id));	$result = execute_query($query, 'adminaccban.php');	if ($line = $result->fetch_row()) {		$today = getdate();				if (notnumber($GET_id))			alert($lang['INCORRECT_CHARACTER']);		if ($GET_bday == $today['mday'] && $GET_bmonth == $today['mon'] && $GET_byear == $today['year'])			$ban = 0;		else 			$ban = truedate($GET_bday, $GET_bmonth, $GET_byear);		if ($ban <= time())			$ban = 0;				if ($GET_block == 5)			$ban = 0;		if ($_SESSION[$CONFIG_name.'level'] <= $line[4] || ($line[4] >= $_SESSION[$CONFIG_name.'level'] && $_SESSION[$CONFIG_name.'level'] != 99)) {			$ban = $line[6];			$GET_block = $line[7];		}		$query = sprintf(ACCBAN_UPDATE, $ban, $GET_block, trim($GET_id));		$result = execute_query($query, 'adminaccban.php');		alert("Account Updated");	}}[/code][code]function truedate($day, $month, $year) {	$diames = array (		1  => 31,		2  => 28,		3  => 31,		4  => 30,		5  => 31,		6  => 30,		7  => 31,		8  => 31,		9  => 30,		10 => 31,		11 => 30,		12 => 31,	);	if (($year % 4) === 0)		$diames[2] = 29;	if ($day > $diames[$month])		return 0;	return mktime(0, 0, 0, $month, $day, $year);}

  2. Hello,
     
    Been a while since I bought some systems for rAthena. And now I add them in Hercules and had a lot of mistakes, errors generated by the new structure of the source.
     
    Could you help me with this?
     


    Error clif.c

     

    clif.c: In function âclif_parse_GlobalMessageâ:clif.c:9930: warning: implicit declaration of function âstr_replaceâclif.c:9930: warning: assignment makes pointer from integer without a cast

     

    Line 9930:

    invocation = str_replace(god_db[sd->status.god].invocation,"{CHARNAME}",sd->status.name);

     


    My Patch:


    strlib.c

     

    +char *str_replace( const char *string, const char *substr, const char *replacement )+{+  char *tok = NULL;+  char *newstr = NULL;+ +  tok = strstr( string, substr );+  if( tok == NULL ) return strdup( string );+	newstr = malloc( strlen( string ) - strlen( substr ) + strlen( replacement ) + 1 );+  if( newstr == NULL ) return NULL;+	  memcpy( newstr, string, tok - string );+	  memcpy( newstr + (tok - string), replacement, strlen( replacement ) );+	  memcpy( newstr + (tok - string) + strlen( replacement ), tok + strlen( substr ), strlen( string ) - strlen( substr ) - ( tok - string ) );+	  memset( newstr + strlen( string ) - strlen( substr ) + strlen( replacement ), 0, 1 );+	  return newstr;+}


    strlib.h

     

    char *(*str_replace) (const char *string, const char *substr, const char *replacement);

    clif.c
    +	if(sd->status.god != 0 && god_db[sd->status.god].god_id && sd->status.base_level >= MAX_LEVEL) {+		invocation = (char *)aMalloc(sizeof(char *));+	//ShowDebug("Tamanho do buffer criado: %d",sizeof(invocation));+	invocation = str_replace(god_db[sd->status.god].invocation,"{CHARNAME}",sd->status.name);+	//ShowDebug("Tamanho do buffer final: %d",sizeof(invocation));+		if(strcmp(invocation,message) == 0) {+			sc_start(&sd->bl,god_db[sd->status.god].buffid[0],100,god_db[sd->status.god].bufflv[0],god_db[sd->status.god].bufftm[0]);+			sc_start(&sd->bl,god_db[sd->status.god].buffid[1],100,god_db[sd->status.god].bufflv[1],god_db[sd->status.god].bufftm[1]);+		}+	}

     

     

     

     

    Error pc.c

     

    pc.c: In function âpc_dragontranslateâ:pc.c:5717: warning: implicit declaration of function âsv_splitâ


    Line 5717

    array_size = sv_split((char*)message_temp, strlen(message_temp), 0, ' ', array_output, 80, (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));

     

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.