PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 16, 2022

[FIXED] ical file sync to iOS devices protect using htacess

 March 16, 2022     icalendar, ios, lamp, php     No comments   

Issue

I have an ical file generated on a server. I would like it to be sync with ios devices. It works fine if left open, but as soon as I add something like an htaccess file it breaks.

Is it possible to have an ical file sync with iphone and provide some sort of authentication behind the scenes to keep the ics file protected. I am in a LAMP environment.

Thanks, Bart


Solution

You seemingly have PHP with its trivial basic authentication setup. Note this isn't particularly secure, but it will do the job:

<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
    header('WWW-Authenticate: Basic realm="My Realm"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Text to send if user hits Cancel button';
    exit;
} else {
  # lookup $_SERVER['PHP_AUTH_USER'] and the hash of {$_SERVER['PHP_AUTH_PW']} on the backend.
  # return the contents of your ical file
}

I hope that helps, if not, leave a comment indicating what needs clarification and I'll add the relevant code.



Answered By - hd1
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing