0% found this document useful (0 votes)
17 views3 pages

CREATE TABLE User Detail

sql commands

Uploaded by

tnyange909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

CREATE TABLE User Detail

sql commands

Uploaded by

tnyange909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATE TABLE vip_betting (

user_id INT AUTO_INCREMENT PRIMARY KEY,


user_name VARCHAR(255) NOT NULL,
user_email VARCHAR(255) NOT NULL,
user_password VARCHAR(255) NOT NULL,
version INT
);
https://elearning.iaa.ac.tz/login/index.php

import React, { useState, useCallback } from 'react';


import debounce from 'lodash.debounce';

const useLoginTest = () => {


const [response, setResponse] = useState(null);

const attemptLogin = useCallback(


debounce(async (username, password) => {
try {
// Construct the URL with query parameters
const url = `https://elearning.iaa.ac.tz/login/index.php?username=$
{encodeURIComponent(
username
)}&password=${encodeURIComponent(password)}`;

// Send the fetch request


const result = await fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'Mozilla/5.0 (compatible; EthicalLoginTest/1.0)', //
Example of adding meaningful headers
},
credentials: 'include', // Include cookies if needed
});

// Parse the response


const data = await result.text(); // Assuming the response is HTML or text
setResponse(data);
} catch (error) {
console.error('Error during login attempt:', error);
setResponse(`Error: ${error.message}`);
}
}, 500), // Debounce to limit rapid repeated requests
[]
);

return { response, attemptLogin };


};

const LoginTest = () => {


const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const { response, attemptLogin } = useLoginTest();

const handleSubmit = () => {


if (username && password) {
attemptLogin(username, password);
} else {
console.warn('Username and Password must not be empty');
}
};

return (
<div style={{ fontFamily: 'Arial, sans-serif', padding: '20px' }}>
<h1 style={{ color: '#333' }}>Ethical Login Test</h1>
<div style={{ marginBottom: '10px' }}>
<label>
Username:
<input
type="text"
value={username}
onChange={(e) => setUsername(e.target.value)}
style={{ marginLeft: '10px', padding: '5px', width: '200px' }}
/>
</label>
</div>
<div style={{ marginBottom: '10px' }}>
<label>
Password:
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
style={{ marginLeft: '10px', padding: '5px', width: '200px' }}
/>
</label>
</div>
<button
onClick={handleSubmit}
style={{
backgroundColor: '#007BFF',
color: '#fff',
border: 'none',
padding: '10px 20px',
cursor: 'pointer',
borderRadius: '5px',
}}
>
Test Login
</button>
{response && (
<div style={{ marginTop: '20px' }}>
<h2 style={{ color: '#007BFF' }}>Response:</h2>
<pre
style={{
background: '#f4f4f4',
padding: '10px',
borderRadius: '5px',
overflowX: 'auto',
}}
>
{response}
</pre>
</div>
)}
</div>
);
};

export default LoginTest;

You might also like