I have this view, through a sql query I recover the level of the registered user, if the level is 9 it will perform another query if the level is 1 I must compose an error message and then print it in my html page through jquery , how can I do in C?
This is my code inside my web service.
if (strcmp(ws_method_external,"Metodo_Approva")==0)
{
if(pk_dbquery("Datarecovery","select * from utentiapplicazione where nomeapplicazione='wbc_gestionepacchetti800' and login='%s'",ws_login)<0)
{
pk_errmsg(PK_FALSE,PK_ERRQUERY,"Datarecovery",PK_DBERRNO,PK_DBERRMSG);
}
pk_dbfetchrow("Datarecovery");
sprintf(livello_login,"%s", pk_dbfetchfield("Datarecovery","livello"));
if(!strcmp(livello_login, "9"))
{
if(pk_dbquery("AccessUpdate","update ptpacchetti800 set loginapprovazione='%s', dataapprovazione=now() where id='%s'",ws_login,id)<0);
{
pk_errmsg(PK_FALSE,PK_ERRQUERY,"AccessUpdate",PK_DBERRNO,PK_DBERRMSG);
}
}
if(!strcmp(livello_login, "1"))
{
//Here the code
}
}
}
This is my javascript code making the call.
function FunctionApprova(OggettoID) {
var id = OggettoID.value;
$.ajax({
url: pacchetti_wsurl + 'ws_json_gestionepacchetti800',
type: 'GET',
data: {
ws_method_external: 'Metodo_Approva',
ws_login: readCookie("wc_login").replace(/\"/g, ""),
ws_password_type: 'C',
ws_pwd: encodeURI(readCookie("wc_password").replace(/\"/g, "")),
id: OggettoID.value,
id,
},
dataType: "json",
encode: true,
}).done(function(data) {
/*window.location.replace('./wbc_gestionepacchetti800.html');*/
});
event.preventDefault();