Skip to content

change07_indent_doubleip #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/master_wellitsupport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy PHP app to Azure Web App - wellitsupport

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Check if composer.json exists
id: check_files
uses: andstor/file-existence-action@v1
with:
files: 'composer.json'

- name: Run composer install if composer.json exists
if: steps.check_files.outputs.files_exists == 'true'
run: composer validate --no-check-publish && composer install --prefer-dist --no-progress

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: php-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: php-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: 'wellitsupport'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_15C9046B281540AFA649D20EF83C7DE0 }}
package: .
88 changes: 86 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,87 @@
<?php
<!DOCTYPE html>
<html>
<head>
<title>Redirecting</title>
</head>
<body>
<h1>Redirecting</h1>
<?php
$visitorip = $_SERVER["REMOTE_ADDR"];
if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$visitorip .= ' (' . $_SERVER["HTTP_X_FORWARDED_FOR"] . ')';
}
if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
$visitorip .= ' (' . $_SERVER["HTTP_CLIENT_IP"] . ')';
}

echo "Hello World!";
// Get the user-agent string
$userAgent = $_SERVER["HTTP_USER_AGENT"];

// Parse the user-agent string to extract OS and browser information
$os = "Unknown";
$browser = "Unknown";

// Define arrays of known OS and browser substrings
$osArray = array(
'Windows' => 'Windows',
'Linux' => 'Linux',
'Mac OS' => 'Mac OS',
'iOS' => 'iPhone|iPad|iPod',
'Android' => 'Android'
);

$browserArray = array(
'Chrome' => 'Chrome',
'Firefox' => 'Firefox',
'Safari' => 'Safari',
'Edge' => 'Edg',
'IE' => 'MSIE|Trident'
);

// Determine the visitor's operating system
foreach ($osArray as $osName => $osPattern) {
if (preg_match("/$osPattern/i", $userAgent)) {
$os = $osName;
break;
}
}

// Determine the visitor's browser
foreach ($browserArray as $browserName => $browserPattern) {
if (preg_match("/$browserPattern/i", $userAgent)) {
$browser = $browserName;
break;
}
}

// Specify the file path where you want to save the IP, OS, and browser information
$file = 'visitor_info.txt';

// Prepare the data for writing to the file
$timestamp = date('Y-m-d H:i:s');
$data = "Timestamp: $timestamp\n";
$data .= "IP Address: $visitorip\n";
$data .= "Operating System: $os\n";
$data .= "Browser: $browser\n\n";

// Open the file in append mode to add the information
if ($handle = fopen($file, 'a')) {
// Append the information to the file
fwrite($handle, $data);

// Close the file
fclose($handle);
} else {
// Handle file write error
echo "";
}
?>
<script>
// JavaScript to redirect to another page after a delay (e.g., 500 milliseconds)
setTimeout(function() {
// Redirect to the target page
window.location.href = 'well-it/www.well-it.com/index.html';
}, 300);
</script>
</body>
</html>
Binary file added well-it/www.well-it.com/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions well-it/www.well-it.com/_00.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
www.well-it.com/index.html
13 changes: 13 additions & 0 deletions well-it/www.well-it.com/_downloads.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Downloads </title>
</head>
<body>
<h1> Downloads </h1>
<ul>
<li><a id="https://www.well-it.com/" href="index.html"> Credit Union software and technology </a></li>
</ul>
</body>
</html>
1 change: 1 addition & 0 deletions well-it/www.well-it.com/_hcms/forms/v2.js

Large diffs are not rendered by default.

Loading