29 Nisan 2024 05:12

Anasayfa

undefined...

Örnek kod

 
#include "httpd.h"
#include "http_config.h"
#include "http_protocol.h"
#include "ap_config.h"

typedefstruct {
constchar *aktif;
} mod_parametreler;

static mod_parametreler config;

module AP_MODULE_DECLARE_DATA Makdos_module;

/* The sample content handler */
static int makdos_handler(request_rec *r)
{
if (strcmp(r->handler, "makdos")) {
return DECLINED;
}
r->content_type="text/html";

if (!r->header_only)
ap_rputs("The sample page from mod_makdos.c\n", r);
 
ap_rprintf(r, "Aktiflik: %s \n", config.aktif);

return OK;
}

static void makdos_register_hooks(apr_pool_t*p)
{
ap_hook_handler(makdos_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

static const char *set_aktif(cmd_parms *cmd, void*cfg, char*arg) {
if (!strcasecmp(arg, "on")) config.aktif="Acik";
else config.aktif="Kapali";
return NULL;
}
static const command_rec makdos_cmds[]= {
AP_INIT_TAKE1("aktif", (constchar*(*)()) set_aktif, NULL, RSRC_CONF, "aktif etmelisin"),
{NULL}
};

/* Dispatch list for API hooks */
module AP_MODULE_DECLARE_DATA makdos_module = {
STANDARD20_MODULE_STUFF,
NULL, /* create per-dir config structures */
NULL, /* merge per-dir config structures */
NULL, /* create per-server config structures */
NULL, /* merge per-server config structures */
makdos_cmds, /* table of config file commands */
makdos_register_hooks /* register hooks */
};
 

 

Apache conf'a Aktif <on|off> deneyebilirsiniz

Makdos Bilişim Teknolojileri 2015 - 2022