Monday 02 June 2003 5:15:22 am
Hi ..
Try this, click here New Reply, check the the url, check the long number, then click back, then agian New Reply, u will find the is increased with one, this mean new entry, as much you repeat this as much you increase the DB with empty values, which gonna slow down the site ! Also when new visitor try to register, when he just open the register page new record will be added to the DB, also if didn`t register !
The best way i had found to check the db if user have copy or draft in the, if it`s exists, the redirect him to this copy, else create new one. I hade create new module, and users just with this mudole can submit to the site, so i had put this lines in the module action :
// Find if he have copy in the DB //
$db = eZDb::instance();
$DBCheck =& $db->arrayQuery( "select id , current_version from ezcontentobject where
contentclass_id = '15' and owner_id = '$userID' order by current_version desc limit 1 ");
if($DBCheck[0][id]) // Get the old one//
{
$module->redirectTo( '/content/edit' . '/' . $DBCheck[0][id] . '/' . $DBCheck[0][current_version] );
}
else // create new one//
{
$module->redirectTo( '/content/edit' . '/' . $contentObject->attribute( 'id' ) . '/' . $contentObject->attribute( 'current_version' ) ); } To stop the user register flood :
$DBCheck =& $db->arrayQuery( "select id , current_version from ezcontentobject where
contentclass_id = '4' and published ='0' and modified='0' and status='0' order by current_version desc limit 1 "); The user will get the 1st empty record id from the DB .. so do you have better idea ?
|