From: Pasi <pa...@ik...> - 2004-02-13 10:47:10
|
Hello! I'm using phpwebsite version 0.9.3-1-full. When you go to remove an announcement, and in the confirmation phase press submit (Yes-button), this is what I have in the apache logs: "GET /index.php?module=announce&ANN_op=delete&ANN_id=125 HTTP/1.0" 200 11843" "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=announce&ANN_op=delete&ANN_id=125" And in the mysql logs I see this: 1333 Query select * from mod_announce where id = '125' 1323 Query delete from mod_announce where id = '125' 1323 Query delete from mod_fatcat_elements where module_title = 'announce' and module_id = 125 As you can see, everything goes OK. BUT, if you press submit (Yes-button) _many times_ in the confirmation phase (because the delete operation can take some time if the server is heavily loaded, and the user thinks that nothing is happening..), this is what happens: "GET /index.php?module=announce&ANN_op=delete&ANN_id=125 HTTP/1.0" 200 11843" "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=announce&ANN_op=delete&ANN_id=125" "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=announce&ANN_op=delete&ANN_id=125" "POST /index.php HTTP/1.0" 200 11427 http://server/index.php?module=announce&ANN_op=delete&ANN_id=125" and in the mysql.. not so nice things: 1333 Query select * from mod_announce where id = '125' 1333 Query delete from mod_announce where id = NULL 1333 Query delete from mod_fatcat_elements where module_title = 'announce' And quess what? All the announcements are gone from the pages! The delete-query above deletes ALL the categories from the ALL announcements! Any ideas how to fix this? This bug happens every time I try this.. It looks like the "and module_id =" is "optimized" away because the module_id is NULL :) causing ALL the stuff to be deleted.. -- Pasi Kärkkäinen ^ . . Linux / - \ Choice.of.the .Next.Generation. |
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 |
From: Pasi <pa...@ik...> - 2004-02-13 14:39:36
|
On Fri, Feb 13, 2004 at 09:04:36AM -0500, Matthew McNaney wrote: > 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"] .= "An error occurred when trying > to delete the announcement."; > return; > } > /*-------------- End ------------------*/ > > $GLOBALS["core"]->sqlDelete("mod_announce", "id", $this->_id); > Thanks. I'll try that. -- Pasi Kärkkäinen ^ . . Linux / - \ Choice.of.the .Next.Generation. |