summaryrefslogtreecommitdiff
path: root/authenticate_session
blob: 4ff6ace7290068ab7eb419dd9d4d44bdc9896708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh -e

AUTH="'authenticated' => 'yes'"

replace_stream()
{
  sed "s/\('_SESSION_REMOTE_ADDR'\)/$AUTH, \1/"
}

if [ "$1" ];
then
  cd /tmp
  mv "$1" "$1".unauthenticated
  cat "$1".unauthenticated|replace_stream > "$1"
  chown www-data.www-data "$1"
else
  replace_stream
fi