Пришлось переделать mod-access-key так чтоб он запрашивал доступ на URL в базу.<br>Вот код<br><br> &nbsp; MYSQL *conn;<br> &nbsp; MYSQL_RES *res;<br> &nbsp; MYSQL_ROW row;<br> &nbsp; char *server = &quot;localhost&quot;;<br> &nbsp; char *user = &quot;root&quot;;<br>
 &nbsp; char *password = &quot;123&quot;;<br> &nbsp; char *database = &quot;download&quot;;<br> &nbsp; unsigned int retint;<br> &nbsp; conn = mysql_init(NULL);<br> &nbsp; if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) {<br>
 &nbsp; &nbsp; &nbsp;ngx_log_error(NGX_LOG_INFO, r-&gt;connection-&gt;log, 0, &quot;Error: %s\n&quot;,mysql_error(conn));<br> &nbsp; };<br><br> &nbsp; signed char *q_uri = (signed char *)r-&gt;unparsed_uri.data;<br> &nbsp; sprintf(query, &quot;SELECT COUNT(*) AS CNT FROM DOWNS WHERE URI = RTRIM(&#39;%s&#39;)&quot;, q_uri);<br>
 &nbsp; ngx_log_error(NGX_LOG_INFO, r-&gt;connection-&gt;log, 0, &quot;EXECUTING: %s&quot;,query);<br> &nbsp; if (mysql_query(conn, query)) {<br> &nbsp; &nbsp; &nbsp;ngx_log_error(NGX_LOG_INFO, r-&gt;connection-&gt;log, 0, &quot;Error: %s&quot;,mysql_error(conn));<br>
 &nbsp; };<br> &nbsp; res = mysql_use_result(conn);<br> &nbsp; row = mysql_fetch_row(res);<br><br><b style="color: rgb(255, 0, 0);">Проблема:</b><br>никак не удается взать резултат из базы в переменную.<br><b>retint = (unsigned int)row[0];</b><br>
&nbsp;&nbsp; mysql_free_result(res);<br>
&nbsp;&nbsp; mysql_close(conn);<br>
<br>чтоб потом сделать простои IF.<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; if (retint &gt; 0)<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; return NGX_OK;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; else<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; return NGX_HTTP_FORBIDDEN;<br>&nbsp;&nbsp; };<br>Все ето происходит на линуксе, пробовал и етот код работает на тестере (не модуль, просто апликация пишет на stdout)<br>
<br>За любую помощь буду очень благодарен,<br>С уважением,<br><br>