Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

php - ICS file showing dangerous script

I am trying to generate the .ics file through PHP. But after download, the file google chrome showing the dangerous file. The same thing is working fine on my local server. Can anyone let me know how to fix it.?

function dateToCal($time)
{
    return date('YmdThis', strtotime($time));
}

// Build the ics file
$ical = 'BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTEND:' . dateToCal($_POST['date_end']) . '
UID:' . md5($_POST['summary']) . '
DTSTAMP:' . time() . '
LOCATION:' . addslashes($_POST['location']) . '
DESCRIPTION:' . addslashes($_POST['description']) . '
URL;VALUE=URI: ' . $_POST['url'] . '
SUMMARY:' . addslashes($_POST['summary']) . '
DTSTART:' . dateToCal($_POST['date_start']) . '
END:VEVENT
END:VCALENDAR';

//set correct content-type-header

header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename='.time().'.ics');
echo $ical;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...