From: Matthew M. <ma...@tu...> - 2004-02-13 14:07:30
|
Go to Announcement.php and add the following: function delete() { if(!$_SESSION["OBJ_user"]->allow_access("announce", "delete_announcement")) { $this->_error("access_denied"); return; } if(isset($_POST["yes"])){ /*------------- Cut Here ------------ */ if (!isset($this->_id)){ $GLOBALS["CNT_announce"]["content"] .=3D "An error occurred when trying to delete the announcement."; return; } /*-------------- End ------------------*/ =20 $GLOBALS["core"]->sqlDelete("mod_announce", "id", $this->_id); On Fri, 2004-02-13 at 05:45, Pasi K=C3=A4rkk=C3=A4inen wrote: > Hello! >=20 > I'm using phpwebsite version 0.9.3-1-full. >=20 > When you go to remove an announcement, and in the confirmation phase pr= ess submit=20 > (Yes-button), this is what I have in the apache logs: >=20 > "GET /index.php?module=3Dannounce&ANN_op=3Ddelete&ANN_id=3D125 HTTP/1.0= " 200 11843" > "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=3Da= nnounce&ANN_op=3Ddelete&ANN_id=3D125" >=20 > And in the mysql logs I see this: >=20 > 1333 Query select * from mod_announce where id =3D '125' > 1323 Query delete from mod_announce where id =3D '125' > 1323 Query delete from mod_fatcat_elements where module_title =3D= 'announce' and module_id =3D 125 >=20 > As you can see, everything goes OK. >=20 >=20 > BUT, if you press submit (Yes-button) _many times_ in the confirmation = phase=20 > (because the delete operation can take some time if the server is heavi= ly > loaded, and the user thinks that nothing is happening..),=20 > this is what happens: >=20 > "GET /index.php?module=3Dannounce&ANN_op=3Ddelete&ANN_id=3D125 HTTP/1.0= " 200 11843" > "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=3Da= nnounce&ANN_op=3Ddelete&ANN_id=3D125" > "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=3Da= nnounce&ANN_op=3Ddelete&ANN_id=3D125" > "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=3Da= nnounce&ANN_op=3Ddelete&ANN_id=3D125" >=20 > and in the mysql.. not so nice things: >=20 > 1333 Query select * from mod_announce where id =3D '125' > 1333 Query delete from mod_announce where id =3D NULL > 1333 Query delete from mod_fatcat_elements where module_title =3D= 'announce' >=20 > And quess what? All the announcements are gone from the pages! The > delete-query above deletes ALL the categories from the ALL announcement= s! >=20 > Any ideas how to fix this? This bug happens every time I try this.. >=20 > It looks like the "and module_id =3D" is "optimized" away because the > module_id is NULL :) causing ALL the stuff to be deleted.. >=20 >=20 > -- Pasi K=C3=A4rkk=C3=A4inen > =20 > ^ > . . > Linux > / - \ > Choice.of.the > .Next.Generation. >=20 >=20 > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers --=20 Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 http://phpwebsite.appstate.edu http://ess.appstate.edu |