Jump to content

[SOLVED] account validation error


Renlok

Recommended Posts

ok ive made the most part of it work except for some reason it wont update the information cant figure out why

heres the code:
[code]
include "header.php";
$confirm = $_POST['confirm'];
$id = $_GET['id'];
if($action == activate)
{
    if($confirm == checkbox)
{
$id = $_POST['id'];
//-- User wants to confirm his/her registration
$query = "UPDATE a_users SET suspended=0 where id='$id'";
$res = mysql_query($query);
if(!$res)
{
$TPL_errmsg = $ERR_001;
$TPL_err = 1;
}

include "templates/template_confirmed_php.html";
}
else
{
echo 'You must confirm the activation before you can activate your account.<br>';
}
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30543-solved-account-validation-error/
Share on other sites

Honestly it's hard to tell with this limited snippet of code. For example, I don't see any database connection info. You have both a $_GET and a $_POST of the $id variable. I'm assuming you're getting the 'id' from the url to fill the $_GET which populates the checkbox name.. ? Then when they check the box it passes that 'id' on through the $_POST statement?  Also, IF they check the box then the query should run to update a specific field to an 'active' status. Is that field named 'suspended'?
$confirm = $_POST['confirm'];
is taken off the form, confirm is a checkbox

$id = $_GET['id'];
this is taken from the url this is the users id

$id = $_POST['id'];
then i added this because it wasnt updating i thought i may not have id for some reason

the db connection in in the header

and if you the code for the from here it is
[code]
        <FORM NAME=registration ACTION="confirm.php?action=activate" METHOD="POST">
          <TABLE WIDTH="600" BORDER="0" CELLPADDING="5">
            <TR>
              <TD colspan="2" VALIGN="top" ALIGN="right"> <DIV align="left"><? print $std_font.$MSG_267; ?></DIV></TD>
            </TR>
            <TR>
              <TD WIDTH="130">&nbsp;</TD>
              <TD WIDTH="544">
                <? print $std_font.$MSG_368; ?>
                <BR> <input type="checkbox" name="confirm" value="checkbox">
                <? print $MSG_249; ?><br>
<?php $id = $GET['id']; ?>
<input type="hidden" name="id" value="<?php $id ?>">
                <BR> <INPUT TYPE=submit NAME=submit value='Activate Account'>
              </TD>
            </TR>
            <TR>
              <TD WIDTH="130">&nbsp;</TD>
              <TD WIDTH="544"> <FONT FACE="Verdana,Helvetica,Arial" SIZE="2">&nbsp;
                </FONT> <BR> <INPUT type="hidden" name="id" value="<? echo $id; ?>">
              </TD>
            </TR>
          </TABLE>
        </FORM>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.