[TYPO3-english] Run PHP code

Mike Kane sara_bets at hotmail.com
Tue Nov 19 20:23:43 CET 2013


Greetings everyone.

I'm trying to do a self-made solution to deal with expiring usergroups (itypo_expiring_fe_groups) with some PHP code... I made some successful tests in XAMPP in a "normal" database, but when i tried to apply this to typo3, it was a big failure, as it does nothing.

Here it is my code ( used page_php_content extension to place it in one random page)

<?php

$exp_date = mysql_query("SELECT tx_itypoexpiringfegroups_groups, SUBSTRING(tx_itypoexpiringfegroups_groups,15,10) FROM fe_users WHERE uid=24702");

while($row = mysql_fetch_array($exp_date))
  {
  echo (strftime ( '%b-%d-%Y, %H:%M', $row ['SUBSTRING(tx_itypoexpiringfegroups_groups,15,10)'])). "<br />";
  $teste = mysql_query("UPDATE fe_users SET usergroup='2' WHERE date(from_unixtime(SUBSTRING(tx_itypoexpiringfegroups_groups,15,10))) < date(now())");
  }


?>

If by this code is not very clear what i want to do, the main goal is to read the date of expiration of the membership (i used SUBSTRING because the field has other information like this "23|1383569880|1415105880*" and then compare it with the date of the server....If the server date is more recent than the expiration date, the usergroup must be changed.

Like i said before, i ran tests in Apache with a normal database and it worked perfectly, so maybe this is a wrong way to do what i need.

Kind Regards,
Mike Kane


More information about the TYPO3-english mailing list