From:             Admin at hellzoneinc dot com
Operating system: Server 2008
PHP version:      5.2.5
PHP Bug Type:     MySQL related
Bug description:  Script will not move row from 1 table to another. Works w/ 
PHP4.

Description:
------------
Well, I am using php-nuke for my website. I've had issues w/ PHP5 before
and have always gone back to PHP4 since it worked. Since the new release
isn't psoted for Windows yet, I must use PHP5. Everything works fine with
the user registration EXCEPT.... When the user clicks the activate link in
their e-mail, it brings them to the page saying it was successful, but it's
wrong. The user info gets entered into the nuke_users_temp table just fine,
however when the activate script runs, it doesn't copy the info over to
nuke_users as it should, but does make it through to the remove that row.
PHP4 works fine with this so I figured it's a PHP5 issue, so hope this
helps.

Reproduce code:
---------------
It's not a visual error, so here goes. Sorry for the numerous lines.

function activate($username, $check_num) {
        global $db, $user_prefix, $module_name, $language, $prefix;
        $username = filter($username, "nohtml", 1);
        $past = time()-86400;
        $db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE time <
$past");
        $sql = "SELECT * FROM ".$user_prefix."_users_temp WHERE
username='$username' AND check_num='$check_num'";
        $result = $db->sql_query($sql);
        if ($db->sql_numrows($result) == 1) {
                $row = $db->sql_fetchrow($result);
                $user_password = 
htmlspecialchars(stripslashes($row['user_password']));
                if ($check_num == $row['check_num']) {
                        $db->sql_query("INSERT INTO ".$user_prefix."_users 
(user_id, username,
user_email, user_password, user_avatar, user_avatar_type, user_regdate,
user_lang) VALUES (NULL, '".$row['username']."', '".$row['user_email']."',
'$user_password', 'gallery/blank.gif', '3', '".$row['user_regdate']."',
'$language')");
                        $result2 = $db->sql_query("SELECT user_id FROM 
".$user_prefix."_users
WHERE username='".$row['username']."'");
                        $row2 = $db->sql_fetchrow($result2);
                        $guserid = intval($row2['user_id']);
                        $db->sql_query("INSERT INTO ".$prefix."_bbgroups
(group_name, group_description, group_single_user, group_moderator) VALUES
('', 'Personal User', '1', '0')");
                        $group_id = $db->sql_nextid();
                        $db->sql_query("INSERT INTO
".$prefix."_bbuser_group (user_id, group_id, user_pending) VALUES
('$guserid', '$group_id', '0')");
                        $db->sql_query("DELETE FROM ".$user_prefix."_users_temp 
WHERE
username='$username' AND check_num='$check_num'");
                        include("header.php");
                        title(""._ACTIVATIONYES."");
                        OpenTable();
                        echo "<center><b>".$row['username'].":</b> 
"._ACTMSG."</center>";
                        CloseTable();
                        include("footer.php");
                        die();
                } else {
                        include("header.php");
                        title(""._ACTIVATIONERROR."");
                        OpenTable();
                        echo "<center>"._ACTERROR1."</center>";
                        CloseTable();
                        include("footer.php");
                        die();
                }
        } else {
                include("header.php");
                title(""._ACTIVATIONERROR."");
                OpenTable();
                echo "<center>"._ACTERROR2."</center>";
                CloseTable();
                include("footer.php");
                die();
        }

}

Expected result:
----------------
Copy the user from nuke_users_temp to nuke_users and I believe maybe 2
other tables from what I think I'm seeing, then remove that line from
nuke_users_temp.

Actual result:
--------------
Does not copy the user, but then removes them from nuke_users_temp as it
should.

-- 
Edit bug report at http://bugs.php.net/?id=43937&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43937&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43937&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43937&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43937&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43937&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43937&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43937&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43937&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43937&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43937&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43937&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43937&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43937&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43937&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43937&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43937&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43937&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43937&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43937&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43937&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43937&r=mysqlcfg

Reply via email to