Hi, I've been trying to unserialize the data field from isp_fakt_rechnung table but it returns FALSE. I need this in order to get the web_id for the particular invoice. What am I mistaking? Thanks.
To unserialaize a record, try: $myarray = unserialize(stripslashes($myvar)) Also you might want to try the XML version instead.
Thank you, I wrote this small code and name it test.php in a web: Code: <?php $myvar = 'a:1:{i:10;a:1:{i:13;a:1:{i:59;a:7:{s:6:"anzahl";s:1:"1";s:4:"type";s:3:"Web";s:6:"nummer";s:3:"321";s:4:"name";s:28:"Free (anton.joomla-bg.net)";s:4:"text";s:0:"";s:5:"preis";s:1:"0";s:3:"vat";s:3:"16%";}}}}'; $myarray = unserialize(stripslashes($myvar)); var_dump($myarray); ?> $myvar is a record from the ispconfig database. and when I load it i get 'bool(false)' result. Regards!
Normally it should work this way. Please have a look at the file /home/admispconfig/ispconfig/web/isp_fakt/view/view.php Here the relevant part: Code: $rechnung_id = intval($HTTP_GET_VARS["rechnung_id"]); $rg_record = $go_api->db->queryOneRecord("SELECT * from isp_fakt_rechnung where rechnung_id = $rechnung_id"); $rechnung = unserialize(stripslashes($rg_record["data"])); (rechnung = invoice
I edited my previous post and put my code in. /home/admispconfig/ispconfig/web/isp_fakt/view/view.php is where I got it from. I know german
Then I have no idea, your code looks fine. Maybe the serialized string is somehow broken. PHP is a bit picky regarding unserialization.
One of the reasons could be, because I don't use the ispconfig php. For this test I use the clients' php. When I look at this client's invoices from ispconfig interface they show right.
Until now I had not seen any problems with different PHP versions regarding serialization. The forms in ISPConfig are serialaized too and we updated trough several PHP versions in ISPConfig until now and this never broke. Have you tried to use the XML version of the stored invoice instead? If you use simplexml, it should be easily accessible from PHP.
I will try. Thanks for your time. But if there is another way to find the web_id from the tables related to the invoices it will do too. My goal is to count invoices for free webs per client and if there are more than N for a web, then I will suspend the web.