Android Question Check If Users Exists

SCIS

Active Member
Licensed User
Longtime User
Dear,

This is my code, but it don't work and i don't know how to fix it.

1.
I need to select the 'Gebruikersnaam' out of the table 'Gebruiker' Where 'Gebruikernaam' is the same as the edittext.

2.
If job1 is true so there is a match I would like to have an error message and say that that username already exists.

Can you help me with this pleas? Thanks

B4X:
Sub CheckIfUsersExists
   
    job1.Initialize("Job1", Me)
    job1.PostString(ServerUrl,"SELECT Gebruikersnaam FROM Gebruiker WHERE Gebruikersnaam ='"&edtGebruikersnaam.Text&"'")
   
    Log(job1.ErrorMessage)
    Log("HttpUtils.GetString(SELECT Gebruikersnaam FROM Gebruiker) --> CheckIfUserExists")
    Log("Gebruikersnaam ="& edtGebruikersnaam.Text)

End Sub
 

SCIS

Active Member
Licensed User
Longtime User
This is what the error give, what could be the problem?

B4X:
Error: Internal Server Error
 
Upvote 0

SCIS

Active Member
Licensed User
Longtime User
This is what i get when i try to register a user now, but don't know what it mean

HTML:
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (registrerentc) Create, isFirst = true **
** Activity (registrerentc) Resume **
HttpUtils.GetString(SELECT Gebruikersnaam FROM Gebruiker) --> CheckIfUserExists
Gebruikersnaam =benjamin
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Message longer than Log limit (4000). Message was truncated.
<html>
    <head>
        <title>PHP Error - Undefined index: query</title>
        <style>
            body { font-family: 'Arial' 'Helvetica' 'sans-serif'; font-size: 11px; }
            a:link, a:visited { text-decoration: none; }
            a:hover { text-decoration: underline; }
            pre { font-family: 'Lucida Console' 'Courier New' 'Courier' 'monospaced'; font-size: 11px; line-height: 13px; }
            .page { padding: 10px; }
            .headingLeft { background-color: #440066; color: #ffffff; padding: 10px 0px 10px 10px; font-family: 'Verdana' 'Arial' 'Helvetica' 'sans-serif'; font-size: 18px; font-weight: bold; width: 70%; vertical-align: middle; }
            .headingLeftSmall { font-size: 10px; }
            .headingRight { background-color: #440066; color: #ffffff; padding: 0px 10px 10px 10px; font-family: 'Verdana' 'Arial' 'Helvetica' 'sans-serif'; font-size: 10px; width: 30%; vertical-align: middle; text-align: right; }
            .title { font-family: 'Verdana' 'Arial' 'Helvetica' 'sans-serif'; font-size: 19px; font-style: italic; color: #330055; }
            .code { background-color: #f4eeff; padding: 1px 10px 1px 10px; }
        </style>
        <script type="text/javascript">
            function ToggleHidden(strDiv) { var obj = document.getElementById(strDiv); var stlSection = obj.style; var isCollapsed = obj.style.display.length; if (isCollapsed) stlSection.display = ''; else stlSection.display = 'none'; }
        </script>
    </head>
    <body bgcolor="white" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
    <table border="0" cellspacing="0" width="100%">
        <tr>
            <td nowrap="nowrap" class="headingLeft"><span class="headingLeftSmall">Error in PHP Script<br /></span>/ticketcenter/api.php</div></td>
            <td nowrap="nowrap" class="headingRight">
                <b>PHP Version:</b> 5.3.29;&nbsp;&nbsp;<b>Zend Engine Version:</b> 2.3.0;&nbsp;&nbsp;<b>QCubed Version:</b> 2.1 Development Release (QCubed 2.1)<br />
                <b>Application:</b> Apache/2;&nbsp;&nbsp;<b>Server Name:</b> www.6itn.be<br />
                <b>HTTP User Agent:</b> </td>
        </tr>
    </table>
    <div class="page">
        <span class="title">Undefined&nbsp;index: query</span><br />
            <b>Error Type:</b>&nbsp;&nbsp;
            E_NOTICE            <br /><br />
            <b>Source File:</b>&nbsp;&nbsp;
            /home/zesitn/domains/6itn.be/public_html/ticketcenter/api.php            &nbsp;&nbsp;&nbsp;&nbsp;<b>Line:</b>&nbsp;&nbsp;
            17            <br /><br />
            <div class="code">
<pre>Line 12:    $que = &quot;SELECT * FROM USERS&quot;;
Line 13:    $objDbResult = QApplication::$Database[3]-&gt;Query($que);
Line 14:    $Total = 0;
Line 15:    */
Line 16:   
<font color=red>Line 17:    $que = urldecode($_GET['query']);
</font>Line 18:    $que = str_replace('&quot;', '', $que);
Line 19:    //echo $que;
Line 20:    $dbConfig = unserialize(DB_CONNECTION_1);
Line 21:    $server = $dbConfig['server'].':'.$dbConfig['port'];
Line 22:    //echo $server;
</pre>            </div><br />
            <b>Call Stack:</b>
            <br><br>
            <div class="code">
                <pre>#0 /home/zesitn/domains/6itn.be/public_html/ticketcenter/api.php(17): QcodoHandleError()
</pre>
            </div><br />
            <b>Variable Dump:</b>&nbsp;&nbsp;
            <a href="#" onclick="ToggleHidden('VariableDump'); return false;">Show/Hide</a>
            <br /><br />
            <div id="VariableDump" class="code" style="Display: none;">
<pre>  <a href="#" onclick="ToggleHidden('0'); return false;">_COOKIE</a>
<div id="0" style='display:none'>array (
)</div>  <a href="#" onclick="ToggleHidden('1'); return false;">_ENV</a>
<div id="1" style='display:none'>array (
)</div>  <a href="#" onclick="ToggleHidden('2'); return false;">_FILES</a>
<div id="2" style='display:none'>array (
)</div>  <a href="#" onclick="ToggleHidden('3'); return false;">_GET</a>
<div id="3" style='display:none'>array (
  'key' =&gt; 'njdenljdendjebdb8&Atilde;&uml;y',
)</div>  <a href="#" onclick="ToggleHidden('4'); return false;">_POST</a>
<div id="4" style='display:none'>array (
  'SELECT_Gebruikersnaam_FROM_Gebruiker_WHERE_Gebruikersnaam_' =&gt; '\'benjamin\'',
)</div>  <a href="#" onclick="ToggleHidden('5'); return false;">_REQUEST</a>
<div id="5" style='display:none'>array (
  'SELECT_Gebruikersnaam_FROM_Gebruiker_WHERE_Gebruike
Message longer than Log limit (4000). Message was truncated.
Internal Server Error
JobDone Sub gestart
HttpUtils.GetString(SELECT Gebruikersnaam FROM Gebruiker) --> CheckIfUserExists
Gebruikersnaam =benjamin
Message longer than Log limit (4000). Message was truncated.
<html>
    <head>
        <title>PHP Error - Undefined index: query</title>
        <style>
            body { font-family: 'Arial' 'Helvetica' 'sans-serif'; font-size: 11px; }
            a:link, a:visited { text-decoration: none; }
            a:hover { text-decoration: underline; }
            pre { font-family: 'Lucida Console' 'Courier New' 'Courier' 'monospaced'; font-size: 11px; line-height: 13px; }
            .page { padding: 10px; }
            .headingLeft { background-color: #440066; color: #ffffff; padding: 10px 0px 10px 10px; font-family: 'Verdana' 'Arial' 'Helvetica' 'sans-serif'; font-size: 18px; font-weight: bold; width: 70%; vertical-align: middle; }
            .headingLeftSmall { font-size: 10px; }
            .headingRight { background-color: #440066; color: #ffffff; padding: 0px 10px 10px 10px; font-family: 'Verdana' 'Arial' 'Helvetica' 'sans-serif'; font-size: 10px; width: 30%; vertical-align: middle; text-align: right; }
            .title { font-family: 'Verdana' 'Arial' 'Helvetica' 'sans-serif'; font-size: 19px; font-style: italic; color: #330055; }
            .code { background-color: #f4eeff; padding: 1px 10px 1px 10px; }
        </style>
        <script type="text/javascript">
            function ToggleHidden(strDiv) { var obj = document.getElementById(strDiv); var stlSection = obj.style; var isCollapsed = obj.style.display.length; if (isCollapsed) stlSection.display = ''; else stlSection.display = 'none'; }
        </script>
    </head>
    <body bgcolor="white" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
    <table border="0" cellspacing="0" width="100%">
        <tr>
            <td nowrap="nowrap" class="headingLeft"><span class="headingLeftSmall">Error in PHP Script<br /></span>/ticketcenter/api.php</div></td>
            <td nowrap="nowrap" class="headingRight">
                <b>PHP Version:</b> 5.3.29;&nbsp;&nbsp;<b>Zend Engine Version:</b> 2.3.0;&nbsp;&nbsp;<b>QCubed Version:</b> 2.1 Development Release (QCubed 2.1)<br />
                <b>Application:</b> Apache/2;&nbsp;&nbsp;<b>Server Name:</b> www.6itn.be<br />
                <b>HTTP User Agent:</b> </td>
        </tr>
    </table>
    <div class="page">
        <span class="title">Undefined&nbsp;index: query</span><br />
            <b>Error Type:</b>&nbsp;&nbsp;
            E_NOTICE            <br /><br />
            <b>Source File:</b>&nbsp;&nbsp;
            /home/zesitn/domains/6itn.be/public_html/ticketcenter/api.php            &nbsp;&nbsp;&nbsp;&nbsp;<b>Line:</b>&nbsp;&nbsp;
            17            <br /><br />
            <div class="code">
<pre>Line 12:    $que = &quot;SELECT * FROM USERS&quot;;
Line 13:    $objDbResult = QApplication::$Database[3]-&gt;Query($que);
Line 14:    $Total = 0;
Line 15:    */
Line 16:   
<font color=red>Line 17:    $que = urldecode($_GET['query']);
</font>Line 18:    $que = str_replace('&quot;', '', $que);
Line 19:    //echo $que;
Line 20:    $dbConfig = unserialize(DB_CONNECTION_1);
Line 21:    $server = $dbConfig['server'].':'.$dbConfig['port'];
Line 22:    //echo $server;
</pre>            </div><br />
            <b>Call Stack:</b>
            <br><br>
            <div class="code">
                <pre>#0 /home/zesitn/domains/6itn.be/public_html/ticketcenter/api.php(17): QcodoHandleError()
</pre>
            </div><br />
            <b>Variable Dump:</b>&nbsp;&nbsp;
            <a href="#" onclick="ToggleHidden('VariableDump'); return false;">Show/Hide</a>
            <br /><br />
            <div id="VariableDump" class="code" style="Display: none;">
<pre>  <a href="#" onclick="ToggleHidden('0'); return false;">_COOKIE</a>
<div id="0" style='display:none'>array (
  'PHPSESSID' =&gt; 'nrlte7st2po8nmf4uskjdbgko2',
)</div>  <a href="#" onclick="ToggleHidden('1'); return false;">_ENV</a>
<div id="1" style='display:none'>array (
)</div>  <a href="#" onclick="ToggleHidden('2'); return false;">_FILES</a>
<div id="2" style='display:none'>array (
)</div>  <a href="#" onclick="ToggleHidden('3'); return false;">_GET</a>
<div id="3" style='display:none'>array (
  'key' =&gt; 'njdenljdendjebdb8&Atilde;&uml;y',
)</div>  <a href="#" onclick="ToggleHidden('4'); return false;">_POST</a>
<div id="4" style='display:none'>array (
  'SELECT_Gebruikersnaam_FROM_Gebruiker_WHERE_Gebruikersnaam_' =&gt; '\'benjamin\'',
)</div>  <a href="#" onclick="ToggleHidden('5'); return false;">_REQUEST</a>
<div id="5" style='display:none'>array (
  'S
Message longer than Log limit (4000). Message was truncated.
Internal Server Error
JobDone Sub gestart
** Activity (main) Resume **
Connected to B4A-Bridge (Wifi)
** Activity (main) Pause, UserClosed = false **
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This is what i get when i try to register a user now, but don't know what it mean
The problem is in the php-script. Go there and fix it

Error in PHP Script /ticketcenter/api.php
PHP Version: 5.3.29
Zend Engine Version: 2.3.0
QCubed Version: 2.1 Development Release (QCubed 2.1)
Application: Apache/2
Server Name: www.6itn.be
HTTP User Agent:
 
Upvote 0
Top