Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit bf53ea5

Browse files
i did things
1 parent 32d998f commit bf53ea5

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

WebGames-master/WebGames-master/userlogins-for-fun-miles-main/app.js renamed to WebGames-master/WebGames-master/userlogins-for-fun-miles-main (2).zip_unzipped/userlogins-for-fun-miles-main/app.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
// Initialize Userbase
1+
//Userbase
22
userbase.init({ appId: '7cd8e25b-723d-4af7-8bdf-ef558bd0dfcc' }); // Replace with your Userbase app ID
33

44
let currentUser; // Variable to hold the current user object
55
let isDatabaseOpen = false; // Flag to check if the database is open
66

7+
78
document.getElementById('signup-form').addEventListener('submit', async (e) => {
89
e.preventDefault();
910
const username = document.getElementById('signup-username').value; // Email as username
@@ -12,12 +13,14 @@ document.getElementById('signup-form').addEventListener('submit', async (e) => {
1213
try {
1314
const user = await userbase.signUp({ username: username, password });
1415
alert('Signup successful!');
16+
await logout(); // Log out the user immediately after signup
1517
} catch (error) {
1618
console.error('Signup error:', error);
1719
alert('Signup failed: ' + error.message);
1820
}
1921
});
2022

23+
2124
document.getElementById('login-form').addEventListener('submit', async (e) => {
2225
e.preventDefault();
2326
const username = document.getElementById('login-username').value; // Email as username
@@ -187,39 +190,40 @@ document.getElementById('save-cookies-cloud').addEventListener('click', async ()
187190
}
188191
});
189192

190-
// Function to load cookies from the cloud
191193
async function loadCookiesFromCloud() {
192194
try {
193195
// Ensure the database is open
194196
if (!isDatabaseOpen) {
195197
await openUserbaseDatabase();
196198
}
197199

198-
// Clear existing cookies
199-
document.cookie.split(";").forEach((cookie) => {
200-
document.cookie = cookie.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/");
201-
});
202-
203200
// Fetch cookies from the cloud
204201
const items = await userbase.getDatabaseItems({ databaseName: 'notes-database' });
205202
let cookiesFromCloud = '';
206203
items.forEach(item => {
207204
cookiesFromCloud += item.item.text;
208205
});
209206

210-
// Save cookies to the page
211-
document.cookie = `userCookies=${cookiesFromCloud}; path=/`;
207+
// Replace the current cookies with the loaded ones
208+
document.cookie.split(";").forEach((cookie) => {
209+
document.cookie = cookie.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/");
210+
});
211+
212+
const cookies = cookiesFromCloud.split('\n');
213+
cookies.forEach(cookie => {
214+
document.cookie = cookie.trim();
215+
});
216+
217+
// Display the cookies in the text box
218+
document.getElementById('cookies-input').value = cookiesFromCloud;
212219

213-
// Display the cookies on the page
214-
document.getElementById('cookies-display').innerText = cookiesFromCloud;
215-
// Alert the user that the cookies have been loaded
216-
alert('Cookies loaded from cloud!');
220+
// Alert the user that the cookies have been loaded and replaced
221+
alert('Cookies loaded from cloud and replaced!');
217222
} catch (error) {
218223
console.error('Error loading cookies from cloud:', error);
219224
alert('Failed to load cookies from cloud: ' + error.message);
220225
}
221226
}
222-
223227
// Add event listener to the "Load Cookies from Cloud" button
224228
document.getElementById('load-cookies-cloud').addEventListener('click', loadCookiesFromCloud);
225229

WebGames-master/WebGames-master/userlogins-for-fun-miles-main/index.html renamed to WebGames-master/WebGames-master/userlogins-for-fun-miles-main (2).zip_unzipped/userlogins-for-fun-miles-main/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@ <h2>Login</h2>
2525
</form>
2626
</div>
2727
<div id="note-management" style="display: none;">
28-
<h2>cookies-save</h2>
28+
<h2>Note Management</h2>
29+
<input type="text" id="note-input" placeholder="Write your note here..." />
30+
<button id="save-note">Save Note</button>
31+
<button id="logout-button">Logout</button>
32+
<ul id="notes-list" style="margin-top: 20px;"></ul>
2933
<div id="cookies-container">
34+
<h2>Cookies</h2>
3035
<p id="cookies-display"></p>
36+
<textarea id="cookies-input" placeholder="Edit your cookies here..."></textarea>
37+
<button id="save-cookies">Save Cookies</button>
3138
<button id="save-cookies-cloud">Save Cookies to Cloud</button>
3239
<button id="load-cookies-cloud">Load Cookies from Cloud</button>
3340
</div>

script2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const mainContentData = [
6767
{
6868
name: "Credits",
6969
image: "images1.png",
70-
link: "/credits.html",
70+
link: "/pass.html",
7171
},
7272
{
7373
name: "Games That Are Comeing Soon",
@@ -87,7 +87,7 @@ const mainContentData = [
8787
{
8888
name: "save to cloud",
8989
image: "/WebGames-master/WebGames-master/assets/save-to-cloud-2.png",
90-
link: "/WebGames-master/WebGames-master/userlogins-for-fun-miles-main/index.html",
90+
link: "/WebGames-master/WebGames-master/userlogins-for-fun-miles-main (2).zip_unzipped/userlogins-for-fun-miles-main/index.html",
9191
},
9292
];
9393
mainContentData.forEach(item => {

0 commit comments

Comments
 (0)