- $content = array(
- 'sw' => $SW,
- 'cat' => GET_CATEGORY($data[1]),
- 'pay' => GET_PAYMENT($data[2]),
- 'subj' => COMPILE_CODE($data[3]),
- 'url' => DEREFERER($data[4]),
- 'stamp' => MAKE_DATETIME($data[5], "2"),
- 'recs' => $data[6],
- 'sent' => MAKE_DATETIME($data[7], "2"),
- 'clix' => $data[8],
- 'perc' => COMPILE_CODE($data[8] / $data[6] * 100)."%",
- );
+ $content['timestamp_ordered'] = generateDateTime($content['timestamp_ordered'], '2');
+ $content['timestamp_sent'] = generateDateTime($content['timestamp_send'], '2');
+
+ // Click rate
+ $content['click_rate'] = '0';
+
+ // Better protection against 'divison-by-zero'
+ if ($content['max_rec'] > 0) {
+ $content['click_rate'] = ($content['clicks'] / $content['max_rec'] * 100);
+ } // END - if