Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 19,400
» Latest member: tobiasz
» Forum threads: 21,156
» Forum posts: 21,724

Full Statistics

Online Users
There are currently 272 online users.
» 0 Member(s) | 270 Guest(s)
Bing, Google

 
  Why NameCheap is a joke these days (DONT USE) Review
Posted by: SickProdigy - 12-09-2025, 09:48 PM - Forum: Lounge - No Replies

So I was trying to buy a domain 1 day, and it ended up forcing me into a chat with them, this is how it went:

Quote:Conversation with namecheap support

Hi! If you have an account, please
for a more tailored and personal service. Alternatively, please provide your
Avatar
One of our Customer Support agents will be with you soon. Stay tuned!

23 Sep 2023, 8:12 PM
Avatar
Jayalaxmi Ravikumar
joined the chat

23 Sep 2023, 8:13 PM
secureservers.top

23 Sep 2023, 8:13 PM
Hello, this is Jayalaxmi here! Thank you for contacting our Domain's Live Chat Support!
Avatar
Could you elaborate on the question, related to the domain please?

23 Sep 2023, 8:13 PM
Was trying to buy secureservers.top, ran credit and timed out. Went in to see if it would re-buy but pulls up live chat

23 Sep 2023, 8:13 PM
Avatar
Namecheap responsibly tries to prevent abusive domain registrations and reduce Internet fraud. Some of the domains contain specific word combinations (keywords) that may be used for illegal activity or trademark infringement.

23 Sep 2023, 8:15 PM
Oh says it contains restricted phrases in the info pane.

23 Sep 2023, 8:15 PM
Unfortunately, our system has detected that your chosen domain contains one of the keywords that are automatically banned, and therefore, it has blocked its registration.
We can whitelist the domain in question for you manually if the corresponding department investigates the case and proves that it is legit. Once it is done, you'll be able to proceed with submitting its registration further.

Avatar
I understand that not all uses of domains with these keywords have abusive purposes. Still, to check the possibility of whitelisting the domain, I will need you to answer two questions.
Firstly, could you please share for what purposes you use its website or any other services connected with the domain?

23 Sep 2023, 8:15 PM
It's mostly going to be for testing SSL connections between a few servers I own. Thought it was cleverly close.

23 Sep 2023, 8:16 PM
Avatar
Secondly, could you please confirm that you understand the following?
- If the case is proven to be a trademark infringement or if it's used for illicit activities, you run the risk of losing the domain with no possibility of a refund.
It’s a standard procedure for all the domains ...

23 Sep 2023, 8:18 PM
Understood

23 Sep 2023, 8:18 PM
Avatar
Please allow me 7 - 8 minutes to check the details for you.

23 Sep 2023, 8:20 PM
Alright

23 Sep 2023, 8:21 PM
Avatar
Do you have any documents related to the purpose the domain will be used?

23 Sep 2023, 8:28 PM
Avatar
nfortunately, I have not gotten replies from you for some time. Are we still connected?

23 Sep 2023, 8:33 PM
Yes I am.

23 Sep 2023, 8:40 PM
Avatar
?Could you please specify if you have any documents

23 Sep 2023, 8:42 PM
I don't know what I could show you. Apache installed on a server files? or i'm not sure, 1 second I'm looking for something, the thing is I don't have the domain so nothing is connected to it yet

23 Sep 2023, 8:44 PM
Avatar
Sure, take your time.

23 Sep 2023, 8:47 PM
like the last domain i bought was specifically for nginx reverse proxy in house. Now I'm looking to enter from outside through a server specifically vpn. Domain is just easier to remember and connect through

Please allow me sometime.
23 Sep 2023, 8:49 PM
xxx.xxx.xx.xx this ip will be linking to xxx.xxx. It's just for secure connections intermingled. I haven't built it yet because I need a second domain to assign the server.

23 Sep 2023, 8:50 PM
Avatar
Unfortunately, the domain name cannot be registered with Namecheap. Please accept our apologies for the inconvenience.
What is the restricted phrase?

23 Sep 2023, 8:58 PM
Avatar
Unfortunately, your question refers to our internal flow and policies. Such information is confidential and I cannot share it. You may send an alternative domain name so that I check if it does not contain restricted combinations.

23 Sep 2023, 8:58 PM
Avatar
Please let me know if I can assist you with anything else.

23 Sep 2023, 8:59 PM
I'll go elsewhere
Make me explain myself and act like it's not adequate enough

23 Sep 2023, 9:01 PM
Avatar
Please let me transfer our chat session to another support representative for further assistance with your question.

23 Sep 2023, 9:02 PM
Avatar
Anna Pysarenko
joined the chat

23 Sep 2023, 9:03 PM
Jayalaxmi Ravikumar left the chat

23 Sep 2023, 9:03 PM
Avatar
Greetings! My name is Anna, will be happy to assist you further. Please allow me 5-10 minutes to look through your previous conversation, review the necessary details, and look into your request

23 Sep 2023, 9:03 PM
ok
Our system has detected a restricted word within your domain, and we cannot whitelist this domain name
Avatar
If you want to check more information, please contact our Legal&Abuse team directly via email at [email protected]

23 Sep 2023, 9:09 PM
Avatar
Are we still connected?

23 Sep 2023, 9:15 PM
Oh yeah, we are. https://i.imgur.com/aDXcqbn.png
godaddy let me have it
all good

23 Sep 2023, 9:17 PM
Avatar
Anytime! Should you need any further assistance - just let me know

23 Sep 2023, 9:17 PM
It's not like you could assist me, just want my project ideas or something. Very strange.

TL / DR  : Namecheap asking me weird questions just to buy a domain. Then inevitably deny me access to the domain. Want me to explain what it will be used for, also wanting me to send documents referencing what it will be used for. Went straight to godaddy had 0 issue, and even bought 3 years so I don't have that hassle at least for a little while.

Side note for everyone: I've been "renting" domains for 10+ years from them. No issues what so ever. Never had a domain 'banned' or whatever he was saying could happen. EVER. No reason they should be harrassing me. I have a simple gaming forum, and a home server I want to work around. 

Whatever, how to find cheapest domains? Use: https://tld-list.com/

MAKE SURE TO CLICK CHEAPEST RENEWALS. That's where they get a lot of people. Sign on price is cheap but renewal is ridiculous.

Then click Domain level (Top Level Domains is preferred for me)

I use godaddy now for .top domains. Cheapest to renew right now. But according to that list there are cheaper out there. So may try some others from it. Site has changed a bit since I used it.

Print this item

  [Tut] Finviz Screening for Magic Formula Investing (High ROC, Low P/E)
Posted by: xSicKxBot - 12-09-2025, 08:24 AM - Forum: Python - No Replies

[Tut] Finviz Screening for Magic Formula Investing (High ROC, Low P/E)

Learn how to apply Joel Greenblatt’s legendary ‘Magic Formula’ investing strategy without paying for expensive software.

I’ll break down the core math behind buying good companies at cheap prices (High Return on Capital + High Earnings Yield) and give you a step-by-step tutorial on setting up a custom scan in Finviz.

Watch to see exactly how to filter the market to find the best potential value stocks for your portfolio right now:




Specifically, follow these four steps:

Finviz screenshotzz

  1. Go to Finviz > Screener and select the Fundamental tab
  2. Choose P/E > Low (<15)
  3. Click Financial Tab
  4. Sort by ROA (=Return on Assets) or ROE (=Return on Equity) by clicking on the respective column.


https://www.sickgaming.net/blog/2025/12/...c-low-p-e/

Print this item

  [Tut] Build a Multi-Step Form in React with Validation and Progress Bar
Posted by: xSicKxBot - 12-09-2025, 08:24 AM - Forum: PHP Development - No Replies

[Tut] Build a Multi-Step Form in React with Validation and Progress Bar

by Vincy. Last modified on November 18th, 2025.

A multi-step form is one of the best ways to replace a long form to make the customer feel easy. Example: a student enrolment form will usually be very long. If it is partitioned into multi-steps with section-wise sub forms, it encourages enduser to proceed forward. And importantly the merit is that it will increase your signup rate.

In this React tutorial, a registration form is partitioned into 4 steps. Those are to collect general, contact, personal, and authentication details from the users. Each step loads a sub-form with corresponding sections. Each subform is a separate component with proper structure and easy maintainability.

React Multi Step Form Validation Progress Bar

Rendering multi-step registration form


This RegisterForm is created as a parent React Form component. It loads all the sub-components created for rendering a multi-step form with validation and a progress bar.

It requires the following custom React component created for this example.

  1. GeneralInfo – to collect basic information, first and last names.
  2. ContactInfo – to collect phone or WhatsApp numbers.
  3. PersonalInfo – to collect a person’s date of birth and gender.
  4. ConfirmInfo – is a last step to register confidential information and confirm registration.

All information is stored in the formData by using the corresponding handleChange hook.

Additionally, this JSX has a Toast container to display success or error responses on the user-entered data.

There is a step navigation interface that helps to move along the registration steps. The step navigation helps to verify the data before clicking confirmation.

src/components/RegisterForm.jsx

import { useState } from "react";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import ProgressBar from "./ProgressBar";
import GeneralInfo from "./FormSteps/GeneralInfo";
import ContactInfo from "./FormSteps/ContactInfo";
import PersonalInfo from "./FormSteps/PersonalInfo";
import Confirmation from "./FormSteps/Confirmation";
import "../../public/assests/css/RegisterForm.css";
const RegisterForm = () => { const [step, setStep] = useState(1); const [formData, setFormData] = useState({ first_name: "", last_name: "", email: "", phone: "", dob: "", gender: "", username: "", password: "", terms: false, }); const nextStep = () => setStep(prev => prev + 1); const prevStep = () => setStep(prev => prev - 1); const handleChange = (e) => { const { name, value, type, checked } = e.target; setFormData({ ...formData, [name]: type === "checkbox" ? checked : value, }); };
return (
<div className="container"> <header>Register With Us</header> <ProgressBar step={step} /> <div className="form-outer"> {step === 1 && <GeneralInfo formData={formData} handleChange={handleChange} nextStep={nextStep} />} {step === 2 && <ContactInfo formData={formData} handleChange={handleChange} nextStep={nextStep} prevStep={prevStep} />} {step === 3 && <PersonalInfo formData={formData} handleChange={handleChange} nextStep={nextStep} prevStep={prevStep} />} {step === 4 && <Confirmation formData={formData} handleChange={handleChange} prevStep={prevStep} setFormData={setFormData} setStep={setStep} />} </div> <ToastContainer position="top-center" autoClose={3000} hideProgressBar={false} newestOnTop closeOnClick pauseOnHover/>
</div>
);
};
export default RegisterForm;

Form progress bar with numbered in-progress state of registration


When a multi-step form interface is used, the progress bar and prev-next navigation controls are very important usability.

This example provides both of these controls which will be useful to learn how to make this for other similar cases.

The progress bar contains circled, numbered nodes represent each step. This node is a container that denotes the title and the step number. It checks the useState for the current step and highlights the node accordingly.

The conditional statements load the CSS className ‘active’ dynamically when loading the progress bar to the UI.

All the completed steps are highlighted by a filled background and shows clarity on the current state.

src/components/ProgressBar.jsx

const ProgressBar = ({ step }) => {
return (
<div className="progress-bar"> <div className={`step ${step >= 1 ? "active" : ""}`}> <p>General</p> <div className={`bullet ${step > 1 ? "active" : ""}`}> <span className="black-text">1</span> </div> </div> <div className={`step ${step >= 2 ? "active" : ""}`}> <p>Contact</p> <div className={`bullet ${step > 2 ? "active" : ""}`}> <span className="black-text">2</span> </div> </div> <div className={`step ${step >= 3 ? "active" : ""}`}> <p>Personal</p> <div className={`bullet ${step > 3 ? "active" : ""}`}> <span className="black-text">3</span> </div> </div> <div className={`step ${step >= 4 ? "active" : ""}`}> <p>Confirm</p> <div className="bullet"> <span className="black-text">4</span> </div> </div>
</div>
);
};
export default ProgressBar;

React Form components collecting types of user information


We have seen all 4 sub-form components created for this React example. Those component purposes are described in the explanation of the parent React container.

Each form component accepts the formData, handleChange, nextStep references. The parent component has the scope of reading all the sub-form field data. It supplies the data with the corresponding handleChange hook to each step.

The main RegisterForm JSX contains conditional statements to check the current step. Then, it load the corresponding sub form components based on the in-progressing step managed in a React useState.

Step 1 – Collecting general information


react registered multi step form

src/components/FormSteps/GeneralInfo.jsx

import { useState } from "react";
const GeneralInfo = ({ formData, handleChange, nextStep }) => { const [errors, setErrors] = useState({}); const validate = () => { const newErrors = {}; if (!formData.first_name.trim()) newErrors.first_name = "First name is required"; if (!formData.last_name.trim()) newErrors.last_name = "Last name is required"; setErrors(newErrors); return Object.keys(newErrors).length === 0; }; return ( <div className="page slidepage"> <div className="title">General Information</div> <div className="field"> <div className="label">First Name</div> <input type="text" name="first_name" value={formData.first_name} on‌Change={handleChange} className={errors.first_name ? "is-invalid" : ""} /> {errors.first_name && <div className="ribbon-alert">{errors.first_name}</div>} </div> <div className="field"> <div className="label">Last Name</div> <input type="text" name="last_name" value={formData.last_name} on‌Change={handleChange} className={errors.last_name ? "is-invalid" : ""} /> {errors.last_name && <div className="ribbon-alert">{errors.last_name}</div>} </div> <div className="field nextBtn"> <button type="button" on‌Click={() => validate() && nextStep()}> Continue </button> </div> </div> );
};
export default GeneralInfo;

Step 2: Collecting contact information


React Contact Info Form

src/components/FormSteps/ContactInfo.jsx

import { useState } from "react";
const ContactInfo = ({ formData, handleChange, nextStep, prevStep }) => { const [errors, setErrors] = useState({}); const validate = () => { const newErrors = {}; const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!formData.email.trim()) newErrors.email = "Email is required"; else if (!emailRegex.test(formData.email)) newErrors.email = "Enter a valid email address"; if (formData.phone.length < 10) newErrors.phone = "Phone number must be at least 10 digits"; setErrors(newErrors); return Object.keys(newErrors).length === 0; }; return ( <div className="page"> <div className="title">Contact Information</div> <div className="field"> <div className="label">Email Address</div> <input type="text" name="email" value={formData.email} on‌Change={handleChange} className={errors.email ? "is-invalid" : ""} /> {errors.email && <div className="ribbon-alert">{errors.email}</div>} </div> <div className="field"> <div className="label">WhatsApp Number</div> <input type="number" name="phone" value={formData.phone} on‌Change={handleChange} className={errors.phone ? "is-invalid" : ""} /> {errors.phone && <div className="ribbon-alert">{errors.phone}</div>} </div> <div className="field btns"> <button type="button" on‌Click={prevStep}>Back</button> <button type="button" on‌Click={() => validate() && nextStep()}>Continue</button> </div> </div> );
};
export default ContactInfo;

Step3 – Collecting personal information


react personal info form

src/components/FormSteps/PersonalInfo.jsx

import { useState } from "react";
const PersonalInfo = ({ formData, handleChange, nextStep, prevStep }) => { const [errors, setErrors] = useState({}); const validate = () => { const newErrors = {}; if (!formData.dob) newErrors.dob = "Please select your date of birth"; if (!formData.gender) newErrors.gender = "Please select your gender"; setErrors(newErrors); return Object.keys(newErrors).length === 0; };
return ( <div className="page"> <div className="title">Personal Information</div> <div className="field"> <div className="label">DOB</div> <input type="date" name="dob" value={formData.dob} on‌Change={handleChange} className={errors.dob ? "is-invalid" : ""} /> {errors.dob && <div className="ribbon-alert">{errors.dob}</div>} </div> <div className="field"> <div className="label">Gender</div> <select name="gender" value={formData.gender} on‌Change={handleChange} className={errors.gender ? "is-invalid" : ""} > <option value="">Select Gender</option> <option>Male</option> <option>Female</option> <option>Other</option> </select> {errors.gender && <div className="ribbon-alert">{errors.gender}</div>} </div> <div className="field btns"> <button type="button" on‌Click={prevStep}>Back</button> <button type="button" on‌Click={() => validate() && nextStep()}>Continue</button> </div> </div>
);
};
export default PersonalInfo;

Step 4 – Collecting user consent and confidential information


react confirm info form

src/components/FormSteps/Confirmation.jsx

import { useState } from "react";
import { toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import axios from "axios";
import SERVER_SIDE_API_ROOT from "../../config";
const Confirmation = ({ formData, handleChange, prevStep, setFormData, setStep }) => { const [errors, setErrors] = useState({}); const handleSubmit = async (e) => { e.preventDefault(); const newErrors = {}; if (!formData.username) newErrors.username = "Username is required"; if (!formData.password) newErrors.password = "Password is required"; else if (formData.password.length < 6) newErrors.password = "Password must be at least 6 characters"; if (!formData.terms) newErrors.terms = "You must agree to the terms"; setErrors(newErrors); if (Object.keys(newErrors).length > 0) return; try { const res = await axios.post(`${SERVER_SIDE_API_ROOT}/multi-step-form.php`, formData); if (res.data.success) { toast.success(res.data.message || "User registered successfully!"); setFormData({ first_name: "", last_name: "", email: "", phone: "", dob: "", gender: "", username: "", password: "", terms: false, }); setStep(1); setErrors({}); } else { toast.error(res.data.message || "Registration failed!"); } } catch (err) { console.error(err); toast.error("Error while saving user data."); } }; const renderError = (field) => errors[field] ? <div className="ribbon-alert">{errors[field]}</div> : null;
return ( <div className="page"> <div className="title">Confirm</div> <div className="field"> <div className="label">Username</div> <input type="text" name="username" value={formData.username} on‌Change={handleChange} className={errors.username ? "is-invalid" : ""} /> {renderError("username")} </div> <div className="field"> <div className="label">Password</div> <input type="password" name="password" value={formData.password} on‌Change={handleChange} className={errors.password ? "is-invalid" : ""} /> {renderError("password")} </div> <div className="field-terms"> <label> <input type="checkbox" name="terms" checked={formData.terms} on‌Change={handleChange} />{" "} I agree with the terms. </label> {renderError("terms")} </div> <div className="field btns"> <button type="button" on‌Click={prevStep}>Back</button> <button type="submit" on‌Click={handleSubmit}>Register</button> </div> </div>
);
};
export default Confirmation;

PHP endpoint processing multi-step form data


It is a usual PHP file which not need to describe if you are already familiar with how the PHP user registration works. It reads the form data posted by the front-end multi-step React form.

With this form data, it builds the database insert query to save the user-entered information to the backend.

This example has the server-side validation for a few fields. If the validation process catches any problem with the submitted data, then it composes an error response to the React frontend.

Mainly, it validates email format and password-strength (minimally by its length). Password strength checking has no limitations. Based on the application sensitivity we are free to add as much validation as possible which is good for a security point of view.

Note: The SQL script for the user database is in the downloadable source code attached with this tutorial in multi-step-form-validation-api/users.sql.

multi-step-form-validation-api/multi-step-form.php

<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Content-Type");
header("Access-Control-Allow-Methods: POST");
header("Content-Type: application/json");
include 'db.php';
$data = json_decode(file_get_contents("php://input"), true);
$firstName = $data["first_name"] ?? "";
$lastName = $data["last_name"] ?? "";
$email = $data["email"] ?? "";
$phone = $data["phone"] ?? "";
$dob = $data["dob"] ?? "";
$gender = $data["gender"] ?? "";
$username = $data["username"] ?? "";
$password = $data["password"] ?? "";
if (!$firstName || !$email || !$password) { echo json_encode(["success" => false, "message" => "Required fields missing"]); exit;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo json_encode(["success" => false, "message" => "Invalid email"]); exit;
}
if (strlen($password) < 6) { echo json_encode(["success" => false, "message" => "Password too short"]); exit;
}
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);
$stmt = $conn->prepare("INSERT INTO users (first_name, last_name, email, phone, dob, gender, username, password) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssssssss", $firstName, $lastName, $email, $phone, $dob, $gender, $username, $hashedPassword);
if ($stmt->execute()) { echo json_encode(["success" => true, "message" => "User registered successfully"]);
} else { echo json_encode(["success" => false, "message" => "DB insert failed"]);
}
?>

How to set up this application


The below steps help to set up this example to run in your environment.

  1. Download the source code into your React project directory.
  2. Copy the multi-step-form-validation-api into your PHP root.
  3. Create a database multistep_form_validation_db and import the user.sql
  4. Configure database details with db.php
  5. Configure the PHP endpoint URL in React in src/config.js
  6. Run npm install and then, npm run dev.
  7. Copy the dev server URL and run it to render the React Multi-step form.

Conclusion:


So, we have seen a simple React example to understand how to create and manage the state of a multi-step form. By splitting the mail and sub form components we had a structural code base that is more feasible for enhancements.

The navigation between steps gives a scope for verification before confirm the signup. And the progress bar indicates the state in progress at a quick glance.

Definitely, the PHP validation and database processing can have add-on features to make the backend more solid. If you have a requirement to create a multi-step form in React, share your specifications in the comments.

Download

Vincy
Written by Vincy, a web developer with 15+ years of experience and a Masters degree in Computer Science. She specializes in building modern, lightweight websites using PHP, JavaScript, React, and related technologies. Phppot helps you in mastering web development through over a decade of publishing quality tutorials.

↑ Back to Top



https://www.sickgaming.net/blog/2025/11/...gress-bar/

Print this item

  [Tut] ChatGPT 5.1 vs Gemini Banana Pro – Which Creates the Best Fake Monet?
Posted by: xSicKxBot - 12-08-2025, 03:51 PM - Forum: Python - No Replies

[Tut] ChatGPT 5.1 vs Gemini Banana Pro – Which Creates the Best Fake Monet?

I just finished this video comparing which AI model is better in building a Monet clone image:





This is the first image generated by ChatGPT 5.1:


This one nails the sunny summer vibe with those bright colors, but it’s honestly way too orange and saturated to pass for a real Monet. The generic ‘ART’ and ‘CAFFE’ signs look kind of fake, like something you’d find on a jigsaw puzzle rather than in a museum. It’s a pretty picture, but it feels more like modern home decor than a 19th-century masterpiece.


This is the second image generated by Google Gemini Banana Pro:


This one is much closer to the real deal, capturing that classic hazy look and the specific blue shadows that Monet actually used. It falls apart a bit when you zoom in on the weird, gibberish text and the blurry faces, which are dead giveaways for AI. Still, if you squint, this one definitely wins for feeling the most like an actual historical painting.

The post ChatGPT 5.1 vs Gemini Banana Pro – Which Creates the Best Fake Monet? appeared first on Be on the Right Side of Change.



https://www.sickgaming.net/blog/2025/12/...ake-monet/

Print this item

  [Tut] How to Build a React Data Table with Server-Side Pagination, Sorting and Search
Posted by: xSicKxBot - 12-08-2025, 03:51 PM - Forum: PHP Development - No Replies

[Tut] How to Build a React Data Table with Server-Side Pagination, Sorting and Search

by Vincy. Last modified on October 29th, 2025.

The React TanStack table is a great tool for displaying an elegant view of data table. It provides enriched features to build list with impressive user experience.

This tutorial uses Server-side data fetching and rendering, searching and sorting features.

A shopping cart product table is created in the backend. It has basic details to be listed in a tabular form. The React app connects to the PHP API to connect this database to fetch the rows.

The React TanStack data table shows these data rows in the front end as shown below.

react data table db rows

Setting up the React TanStack table example code


This command is used to install the React TanStack data table library.

npm install @tanstack/react-table

This will add the following library reference to the application’s package config.

npm install @tanstack/react-table "dependencies": { "@tanstack/react-table": "^8.21.3", ... ... },

If you are going to run this example in your environment, follow the below steps to set up. It has all the build required for the React TanStack data table rendering.

  1. Download and extract the React project bundle.
  2. Go to the React project directory by cd react-data-table-server-side-pagination-sorting-search
  3. Run npm install to create node_modules.
  4. Copy /api/react-product-table-api/ to your PHP root and configure in React JSX.
  5. Create database db_shopping_cart and import sql/database.sql

Then, start the dev server by using npm run dev.

How to initiate React TanStack data table?


This is to initiate React TabStack library using useReactTable. It adds the raw data reference to the TanStack library row column object to render data.

Part of TanStack.jsx

import { useEffect, useState, useCallback } from "react";
import axios from "axios";
import { useReactTable, getCoreRowModel, getSortedRowModel, flexRender,
} from "@tanstack/react-table";
import "./TanStack.css"; const TanStack = () =&gt; { const [data, setData] = useState([]); const [search, setSearch] = useState(""); const [page, setPage] = useState(1); const [limit, setLimit] = useState(5); const [total, setTotal] = useState(0); const [sortBy, setSortBy] = useState("id"); const [order, setOrder] = useState("asc"); ... //Fetch Data ... useEffect(() =&gt; { fetchData(); }, [fetchData]); const columns = [ { header: "S.No", accessorKey: "sno", cell: (info) =&gt; (page - 1) * limit + info.row.index + 1, }, { header: "Title", accessorKey: "title", cell: (info) =&gt; info.getValue(), }, { header: "Price", accessorKey: "price", cell: (info) =&gt; `$${info.getValue()}`, }, { header: "Category", accessorKey: "category", cell: (info) =&gt; info.getValue(), }, ]; const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel(), getSortedRowModel: getSortedRowModel(), }); ... ...
}

Designing the table layout and components


There are three major UI parts in this React data table example.

  1. The tabular view.
  2. Search bar.
  3. Footer pagination component.

1. The tabular view


react tanstack table filter

Table header - Part of TanStack.jsx

<th key={header.id} className={alignClass} on‌Click={() => key !== "sno" && handleSort(key) } style={{ cursor: key === "sno" ? "default" : "pointer", }}
>
{flexRender(header.column.columnDef.header, header.getContext())} {key !== "sno" && sortBy === key && (order === "asc" ? ( <img src="/icons/up.svg" alt="asc" style={{ width: "14px", height: "14px", marginLeft: "5px", verticalAlign: "middle", }} /> ) : ( <img src="/icons/down.svg" alt="desc" style={{ width: "14px", height: "14px", marginLeft: "5px", verticalAlign: "middle", }} /> ))}
</th>

This section has the TanStack script for iterating the table row array using table.gerRowModel() reference.

The flexRender function loads the table cell data in a row.

Table body rows in TanStack.jsx

<tbody> {table.getRowModel().rows.length > 0 ? ( table.getRowModel().rows.map((row) => ( <tr key={row.id}> {row.getVisibleCells().map((cell) => { const key = cell.column.columnDef.accessorKey; const alignClass = key === "price" ? "price" : key === "sno" ? "center" : ""; return ( <td key={cell.id} className={alignClass}> {flexRender(cell.column.columnDef.cell, cell.getContext())} </td> ); })} </tr> )) ) : ( <tr> <td colSpan={columns.length}>No data found</td> </tr> )}
</tbody>

2. Search Container


It is a usual HTML input that sets the search keyword on-change. When the search is on, it resets the current-page value back to 1.

Search input JSX in TanStack.jsx

<div className="search-container"> <img src="/icons/search.svg" alt="search" className="search-icon" /> <input type="text" placeholder="Search by title..." value={search} on‌Change={(e) => { setSearch(e.target.value); setPage(1); }} className="search-input" />
</div>

3. Pagination


This component returns JSX with numbered buttons with a previous-next pagination link to move the row pointer back and forth.

Pagination JSX

<div className="pagination-container"> <button className="pagination-btn" on‌Click={() => setPage((prev) => Math.max(prev - 1, 1))} disabled={page === 1} > <img src="/icons/back.svg" alt="Previous" className="pagination-icon" /> Prev </button> <span className="pagination-info"> Page {page} of {totalPages || 1} </span> <button className="pagination-btn" on‌Click={() => setPage((prev) => (prev < totalPages ? prev + 1 : prev))} disabled={page >= totalPages} > Next <img src="/icons/forward.svg" alt="Next" className="pagination-icon" /> </button> <select value={limit} on‌Change={(e) => { setLimit(Number(e.target.value)); setPage(1); }} className="pagination-select" > {[5, 10, 20, 50].map((num) => ( <option key={num} value={num}> {num} / page </option> ))} </select>
</div>

paginated results with react data table

Fetching Data from the Server API


This is the place to configure the server-side API URL to connect to the database for displaying dynamic grid. It sets the data array for the TanStack initiation.

This example has a single endpoint that receives all the search, sort and pagination inputs. The following React useCallback() passes these parameters to the API.

The React callback hook sets the raw data for the TanStack’s getCoreRowModel block to build a table row instance.

Part of TanStack.jsx

const fetchData = useCallback(async () => { try { const res = await axios.get("http://localhost/react-product-table-api/products.php", { params: { search, page, limit, sortBy, order }, }); const fetchedData = res.data.data || res.data.products || []; setData(fetchedData); setTotal(res.data.total || 0); } catch (err) { console.error("Error fetching data:", err); }
}, [search, page, limit, sortBy, order]);

Below PHP script shows how to process a request from the allowed React origin. This PHP service prepares the SELECT query based on the search keyword, current page and sorting column & order passed from the React frontend.

react-product-table-api/products.php

<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");
require_once "db.php"; $page = $_GET['page'] ?? 1;
$limit = $_GET['limit'] ?? 5;
$search = $_GET['search'] ?? '';
$sortBy = $_GET['sortBy'] ?? 'id';
$order = $_GET['order'] ?? 'asc';
$offset = ($page - 1) * $limit; $allowedSort = ['id', 'title', 'price', 'category'];
$allowedOrder = ['asc', 'desc']; if (!in_array($sortBy, $allowedSort)) $sortBy = 'id';
if (!in_array(strtolower($order), $allowedOrder)) $order = 'asc'; $sql = "SELECT * FROM products WHERE title LIKE ? ORDER BY $sortBy $order LIMIT ?, ?";
$stmt = $conn->prepare($sql);
$searchParam = "%$search%";
$stmt->bind_param("sii", $searchParam, $offset, $limit);
$stmt->execute();
$result = $stmt->get_result(); $data = [];
while ($row = $result->fetch_assoc()) { $data[] = $row;
} $countSql = "SELECT COUNT(*) AS total FROM products WHERE title LIKE ?";
$countStmt = $conn->prepare($countSql);
$countStmt->bind_param("s", $searchParam);
$countStmt->execute();
$countResult = $countStmt->get_result()->fetch_assoc(); echo json_encode([ "products" => $data, "total" => $countResult["total"]
]);
?>

Conclusion


This example built a front end React data table with search, sort and pagination features. The TanStack table library provides more features apart these three features. For example, it has column ordering, row selection, resizing and more. But, we covered the prime features of this library that are need in majority of the frontend tables.

References

  1. TanStack table installation guidelines
  2. Data table design patterns

Download

Vincy
Written by Vincy, a web developer with 15+ years of experience and a Masters degree in Computer Science. She specializes in building modern, lightweight websites using PHP, JavaScript, React, and related technologies. Phppot helps you in mastering web development through over a decade of publishing quality tutorials.

↑ Back to Top



https://www.sickgaming.net/blog/2025/10/...nd-search/

Print this item

  [Tut] How to ship an AI-powered project in 1 hour per day ?
Posted by: xSicKxBot - 12-07-2025, 11:31 PM - Forum: Python - No Replies

[Tut] How to ship an AI-powered project in 1 hour per day ?

A Skool group member just shared that they have a super busy schedule, bought an annual plan to explore ideas, but still struggle to ship something.

Here’s a simple 4-step process that works for me – shipping dozens of projects in the last few months:


1. Pick one small project. Keep it tiny and real:

  • Simple static website, calculator, value proposition, or
  • Tiny web app with one core feature

? One project, one month.


2. Set up once

  • Create a GitHub repo
  • Connect it to the OpenAI Codex agent: https://chatgpt.com/codex
  • (Optional) Connect GitHub to a host (Heroku/Netlify/Vercel – I use Heroku) so every push auto-deploys.

3. Make a tiny-task list. Create a Google Sheet with small, 1-hour tasks, e.g.:

  • Add an about page
  • Improve mobile layout
  • Add Google Analytics
  • Change theme color and styles
  • Add a contact form

4. Your daily 1-hour habit. Each day:

  • Pick one task
  • Ask the Codex agent to implement it (in natural language)
  • Test, tweak, iterate, commit, push

You’re not hand-coding everything – you’re simply orchestrating AI. Do this CONSISTENTLY for a month and you’ll be amazed how much you’ve shipped. ?

? If you want to accelerate your progress shipping genuinely valuable project every single month, check out my inexpensive community:


? SHIP! – One Project Per Month

The post How to ship an AI-powered project in 1 hour per day ? appeared first on Be on the Right Side of Change.



https://www.sickgaming.net/blog/2025/11/...%9f%9a%80/

Print this item

  [Tut] Send Email from React Using EmailJS (No Backend Required)
Posted by: xSicKxBot - 12-07-2025, 11:31 PM - Forum: PHP Development - No Replies

[Tut] Send Email from React Using EmailJS (No Backend Required)

by Vincy. Last modified on November 13th, 2025.

EmailJS is a cloud service that supports to enable the frontend to send email without any backend. All we need is to create an EmailJS account and configure it to the frontend application.

This tutorial shows the step-by-step procedure to learn how to enable email sending in a React application using EmialJS.

Send Email From React Using EmailJS

Steps to allow EmailJS to send mail


1. Signup with EmailJS service


First signup and login with EmailJS dashboard. It’s a free and enables mail sending via various services supported.

Select Email Sending Service

2. Choose service provider via Add New Service -> Select Service


It supports various services like Gmail, Yahoo and etc. It also have settings to configure custom SMTP server  with this online solution.
Permit EmailJS To Access Mail Account

3. Design mail template by Email Templates -> Create New Template -> Select Template


There are various built-in templates in the EmailJS dashboard. I selected the “Contact Us” template for this example.

Template edit interface has the option to change the design and the content. It allows to add dynamic variables as part of the mail content.

When calling the EmailJS service, the request will have values to replace this variables. This feature will help to send a personalized email content.

Copy the Template ID once created an email template.

Design EmailJS Template

4. Get EmailJS API Public Key


Added Service ID, Template ID the EmailJS Public Key  is also need to initiate the library class from the frontend React App.

Navigate via Account using the left menu to open the API keys section. Copy Public Key from the EmailJS dashboard.

Get EmailJS Account Public Key

Initiate EmailJS library to React App


Create a React app and install the EmailJS library to it using this command.

npm install emailjs-com

This example code contains this library installed. So, just run npm install to bring the dependancies into your node_modules.

Then, import the emailjs-com to the React JSX and initiate the EmailJS service as shown below. This script shows how the emailjs instance is used in the form handle submit.

import emailjs from "emailjs-com"; const handleSubmit = (e) => { e.preventDefault(); const SERVICE_ID = "Your Serivce ID"; const TEMPLATE_ID = "Your Template ID"; const PUBLIC_KEY = "EmailJS API Public key here"; emailjs .send(SERVICE_ID, TEMPLATE_ID, formData, PUBLIC_KEY) .then(() => { toast.success("Email sent successfully!", { position: "top-center" }); setFormData({ name: "", email: "", message: "" }); }) .catch(() => { toast.error("Failed to send email. Please try again.", { position: "top-center", }); }); };

Example React form to send email


This example provides component for the email sending form fields. The fields UI code is moved to a separate file and made as a component. It is imported into the parent container in the EmailForm component.

It renders Name, Email and Message fields. Each fields is validated with a handleChange hook.

react send mail form

src/components/EmailFormFields.jsx

const EmailFormFields = ({ formData, handleChange }) => {
return ( <> <div className="form-group"> <label className="form-label">Name</label> <input type="text" name="name" value={formData.name} on‌Change={handleChange} className="form-input" required /> </div> <div className="form-group"> <label className="form-label">Email</label> <input type="email" name="email" value={formData.email} on‌Change={handleChange} className="form-input" required /> </div> <div className="form-group"> <label className="form-label">Message</label> <textarea name="message" value={formData.message} on‌Change={handleChange} className="form-input" rows="6" required ></textarea> </div> </>
);
};
export default EmailFormFields;

React JSX to load EmailJS and EmailFormFields Component


This JSX defines the handleChange and handleSubmit hooks for validation and mail sending respectively.

The form container includes the <EmailFormFields />, Submit button and a <ToastContainer />.

After sending email via emailjs, the handleSubmit action resets the form and make it ready for the next submit.

When submitting the form, the handleSubmit function sends the formData with the API keys and IDs. Configure your EmailJS keys and IDs to this React script to make this example to send email.

src/components/EmailForm.jsx

import { useState } from "react";
import emailjs from "emailjs-com";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import "../../public/assets/css/phppot-style.css";
import EmailFormFields from "./EmailFormFields"; const EmailForm = () => { const [formData, setFormData] = useState({ name: "", email: "", message: "", }); const handleChange = (e) => { const { name, value } = e.target; setFormData((prev) => ({ ...prev, [name]: value })); }; const handleSubmit = (e) => { e.preventDefault(); const SERVICE_ID = "Your Serivce ID"; const TEMPLATE_ID = "Your Template ID"; const PUBLIC_KEY = "EmailJS API Public key here"; emailjs .send(SERVICE_ID, TEMPLATE_ID, formData, PUBLIC_KEY) .then(() => { toast.success("Email sent successfully!", { position: "top-center" }); setFormData({ name: "", email: "", message: "" }); }) .catch(() => { toast.error("Failed to send email. Please try again.", { position: "top-center", }); }); }; return ( <div className="form-wrapper"> <h2 className="form-title">Contact Us</h2> <form on‌Submit={handleSubmit} className="payment-form"> <EmailFormFields formData={formData} handleChange={handleChange} /> <button type="submit" className="submit-btn"> Send </button> </form> <ToastContainer /> </div> );
};
export default EmailForm;

Note: Form data is in an associate array format, where the array keys matches the email template variables. For example, if the email template body in the EmailJS dashboard contains Hi {{name}}, then the form data will have the key-value as name: submitted-name to replace the variable.

The receive email signature and the mail body design will be as configured in the EmailJS dashboard. The following diagram shows the received email output.

React Received Web Mail

Conclusion


Thus, we have created a frontend in React for sending email without any backend set up. I hope, you find EmailJS very simple to integrate into an application. And its registration process is very simple. And, the features to customize the email body is very useful to have a thematic email template for different applications.

Download

Vincy
Written by Vincy, a web developer with 15+ years of experience and a Masters degree in Computer Science. She specializes in building modern, lightweight websites using PHP, JavaScript, React, and related technologies. Phppot helps you in mastering web development through over a decade of publishing quality tutorials.

↑ Back to Top



https://www.sickgaming.net/blog/2025/11/...-required/

Print this item

  [Tut] Best Free Books for Distributed Systems PhD Students (Must Read!)
Posted by: xSicKxBot - 12-07-2025, 06:46 AM - Forum: Python - No Replies

[Tut] Best Free Books for Distributed Systems PhD Students (Must Read!)

Distributed systems form the backbone of modern large-scale computing, from cloud platforms to distributed databases and large clusters.

As a PhD student, you need resources that go beyond the basics, combining strong theoretical foundations with practical insights. And ideally, they should be freely accessible.

The following five books are all legally available online at no cost and are well-suited to accompany you through graduate-level research in distributed systems.

Distributed Systems (4th Edition) — Maarten van Steen & Andrew S. Tanenbaum



This modern classic offers a broad and rigorous introduction to distributed systems, covering architectures, communication, naming, coordination, replication, fault tolerance, and security. The 4th edition updates many examples to reflect today’s large-scale systems and is widely used in advanced undergraduate and graduate courses. A personalized digital copy is available for free from the authors’ website.

Access the free digital edition

Distributed Systems for Fun and Profit — Mikito Takada



Short, opinionated, and surprisingly deep, this book is great when you want to quickly grasp the core concepts behind real-world distributed systems. It walks through consistency models, time and ordering, replication strategies, and the design of systems like Dynamo and Bigtable, always with an eye toward what matters in practice. Its informal style makes it perfect as a first pass or as a companion to more formal texts.

Read the book online for free

The Datacenter as a Computer: Designing Warehouse-Scale Machines (3rd Edition) — Luiz André Barroso, Urs Hölzle, Parthasarathy Ranganathan



If you’re doing a PhD, you’ll likely care about how your algorithms and systems behave at data-center scale. This open-access book treats an entire datacenter as a single “warehouse-scale computer” and explains how to design, operate, and optimize such systems. It’s particularly valuable for understanding the hardware, energy, and reliability constraints behind large distributed services such as those run by major cloud providers.

Download the open-access book (PDF and more)

Operating Systems: Three Easy Pieces — Remzi H. Arpaci-Dusseau & Andrea C. Arpaci-Dusseau



While technically an operating-systems book, OSTEP is essential background for anyone doing serious work in distributed systems. Its deep treatment of concurrency, synchronization, and persistence provides the building blocks that distributed algorithms and storage systems rely on. The clear structure, numerous exercises, and freely available PDFs make it ideal for self-study alongside more specialized distributed-systems material.

Access the free online textbook and PDFs

Distributed Algorithms — Jukka Suomela



These lecture notes form a full-fledged graduate-level textbook on distributed algorithms, focusing on rigorous models and proofs. Topics include locality, symmetry breaking, graph problems, and complexity in distributed settings, making it an excellent bridge between theory and the systems-oriented books above. If your PhD work touches consensus, graph algorithms on networks, or lower bounds in distributed computing, this text is a highly relevant free resource.

Download the lecture-notes textbook as PDF


Also check out my other free book articles:

? 42 Best Free AI Books (HTML/PDF)



https://www.sickgaming.net/blog/2025/11/...must-read/

Print this item

  [Tut] React JWT Authentication Tutorial with PHP Backend (Login, Register & Protecte
Posted by: xSicKxBot - 12-07-2025, 06:46 AM - Forum: PHP Development - No Replies

[Tut] React JWT Authentication Tutorial with PHP Backend (Login, Register & Protecte

by Vincy. Last modified on November 28th, 2025.

The JWT authentication is a secure way of implementing a web login process without session management. This tutorial is for implementing React JWT authentication with PHP. It has the following steps to understand the process easily.

Additionally, this example code provides a user registration code to create new user to the database. With the registration and login code you are getting a base for your websites authentication module from this tutorial.

  1. React login form submits the registered username and password.
  2. PHP backend script validates the login details with the database.
  3. PHP login success case generates JWT signed encoded user profile data.
  4. React frontend receives the JWT token and stores to localStorage.
  5. React validates the existence of the token with the ProtectedRoutes component.
  6. If the ProtectedRoutes failed to find the JWT token, it denies the access.

React Jwt Authentication Php Backend Login Register

React User Registration


This registration code helps to create data for your login process. Also, with registration this authentication example will be a more complete version to deploy in your application.

This example has a registration form with very few fields. React builds the formData state when the user enters the data. On submit, it passes the entered data to the PHP page register-action.php. It stores the user login name, email and the password to the database.

In the below JSX script, the formData, success/error state variables are managed. The handleSubmit hook handles the client-side form validation. This hook posts the data to the server once the validation returns true.

Part of RegisterForm.jsx with React states and hooks

import axios from "axios";
import { useNavigate } from "react-router-dom";
import SERVER_SIDE_API_ROOT from "../config";
import "../styles/style.css";
const RegisterForm = () => { const [formData, setFormData] = useState({ username: "", email: "", password: "", confirmPassword: "", }); const [errorMessage, setErrorMessage] = useState(""); const [successMessage, setSuccessMessage] = useState(""); const navigate = useNavigate(); const handleSubmit = async (e) => { e.preventDefault(); const { username, email, password, confirmPassword } = formData; if (!username || !email || !password || !confirmPassword) { setErrorMessage("Please fill in all fields"); setSuccessMessage(""); return; } const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(email)) { setErrorMessage("Please enter a valid email address"); return; } if (password.length < 6) { setErrorMessage("Password must be at least 6 characters"); return; } if (password !== confirmPassword) { setErrorMessage("Passwords do not match"); setSuccessMessage(""); return; } try { const res = await axios.post( `${SERVER_SIDE_API_ROOT}/registration-action.php`, { username, email, password }, { headers: { "Content-Type": "application/json" } } ); console.log("Server response:", res.data); if (res.data.status === "success") { setSuccessMessage(res.data.message); setErrorMessage(""); setFormData({ username: "", email: "", password: "", confirmPassword: "", }); setTimeout(() => { navigate("/login"); }, 2000); } else { setErrorMessage(res.data.message || "Registration failed"); setSuccessMessage(""); } } catch (err) { console.error("Axios Error:", err); setErrorMessage("Server error or CORS issue"); setSuccessMessage(""); }
};

react jwt registration

Returning Form UI code with RegisterForm.jsx

<div className="admin-wrapper"> <div className="card-container" style={{ maxWidth: "400px", margin: "95px auto" }}> <h2>User Registration</h2> <form on‌Submit={handleSubmit}> <div> <label>Username:</label> <input value={formData.username} on‌Change={(e) => setFormData({ ...formData, username: e.target.value }) }/> </div> <div> <label>Email:</label> <input type="email" value={formData.email} on‌Change={(e) => setFormData({ ...formData, email: e.target.value }) } /> </div> <div> <label>Password:</label> <input type="password" value={formData.password} on‌Change={(e) => setFormData({ ...formData, password: e.target.value }) } /> </div> <div> <label>Confirm Password:</label> <input type="password" value={formData.confirmPassword} on‌Change={(e) => setFormData({ ...formData, confirmPassword: e.target.value, }) }/> </div> {errorMessage && ( <div className="alert alert-danger" role="alert"> {errorMessage} </div> )} {successMessage && ( <div className="alert alert-success" role="alert"> {successMessage} </div> )} <button type="submit">Register</button> <p style={{ textAlign: "center", marginTop: "10px" }}> Already have an account?{" "} <a href="/login" style={{ color: "#232323", fontWeight: "600",textDecoration: "none" }}> Login here </a> </p> </form> </div> </div>
);
};
export default RegisterForm;

PHP backend handles the registration request and stores the entered password in an encrypted form. It validates the user email uniqueness. If the entered email is already in the database, then this code rejects the user’s insertion.

react-jwt-login-register-api/registration-action.php

<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Content-Type, Authorization");
header("Access-Control-Allow-Methods: POST, OPTIONS");
header("Content-Type: application/json"); if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { http_response_code(200); exit; }
include "db.php";
$input = file_get_contents("php://input");
$data = json_decode($input);
if ( !isset($data->username) || !isset($data->email) || !isset($data->password)
) { echo json_encode(["status" => "error", "message" => "Invalid input"]); exit;
}
$username = mysqli_real_escape_string($conn, $data->username);
$email = mysqli_real_escape_string($conn, $data->email);
$password = password_hash($data->password, PASSWORD_BCRYPT);
$check = $conn->query("SELECT * FROM users WHERE email='$email'");
if ($check->num_rows > 0) { echo json_encode(["status" => "error", "message" => "Email already exists"]); exit;
}
$sql = "INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')";
if ($conn->query($sql) === TRUE) { echo json_encode(["status" => "success", "message" => "Registration successful"]);
} else { echo json_encode(["status" => "error", "message" => $conn->error]);
}
?>

React login JWT authentication


If the user submits the correct username and password, the client receives success response from the server. The response will contain a JWT signed user profile data array.

In the client-side, the jwt-decode is used to decode the JWT response. The jwt-decode is the JavaScript library which can read and decode the JWT encoded string.

Run the following command to install this library into the application repository.

npm install jwt-decode [OR] yarn add jwt-decode

react jwt login

In the below script, if the response status is success it sets the JWT authentication token to a JavaScript localStorage. Then, it redirects to the dashboard. The dashboard is a protected page that can be accessed if a user is JWT-authenticated.

src/components/LoginForm.jsx

import React, { useState } from "react";
import { Link } from "react-router-dom";
import SERVER_SIDE_API_ROOT from "../config";
import "../styles/style.css";
import axios from "axios"; const LoginForm = () => { const [formData, setFormData] = useState({ username: "", password: "", }); const [errorMessage, setErrorMessage] = useState(""); const handleLogin = (e) => { e.preventDefault(); const { username, password } = formData; if (!username || !password) { setErrorMessage("Please enter both username and password"); return; } axios.post(`${SERVER_SIDE_API_ROOT}/login-action.php`, { username, password, }) .then((res) => { if (res.data.status === "success") { localStorage.setItem("token", res.data.token); setErrorMessage(""); setTimeout(() => { window.location.href = "/dashboard"; }, 1000); } else { setErrorMessage(res.data.message); } }) .catch((err) => { setErrorMessage("Server error: " + err.message); });
};
return (
<div className="admin-wrapper"> <div className="card-container" style={{ maxWidth: "400px", margin: "154px auto" }}> <h2>Login</h2> <form on‌Submit={handleLogin}> <div> <label>Username:</label> <input value={formData.username} on‌Change={(e) => setFormData({ ...formData, username: e.target.value })} /> </div> <div> <label>Password:</label> <input type="password" value={formData.password} on‌Change={(e) => setFormData({ ...formData, password: e.target.value }) } /> </div> {errorMessage && ( <div className="alert alert-danger" role="alert"> {errorMessage} </div> )} <button type="submit">Login</button> <p style={{ textAlign: "center", marginTop: "10px" }}> Don’t have an account?{" "} <Link to="/registerform" style={{ color: "#232323", fontWeight: "600", textDecoration: "none" }}> Register here </Link> </p> </form> </div>
</div>
);
};
export default LoginForm;

In PHP the firebase/php-jwt library is installed by using this composer command. Once the logged-in details matched, this library is used to generate the JWT token with the profile array.

composer require firebase/php-jwt

react-jwt-login-register-api/login-action.php

<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Content-Type, Authorization");
header("Access-Control-Allow-Methods: POST, OPTIONS");
header("Content-Type: application/json"); include "db.php";
require 'vendor/autoload.php'; use Firebase\JWT\JWT;
use Firebase\JWT\Key; $secret_key = "MY_SECRET_KEY_12345"; if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { http_response_code(200); exit;
}
$data = json_decode(file_get_contents("php://input"));
if (!isset($data->username) || !isset($data->password)) { echo json_encode(["status" => "error", "message" => "Missing credentials"]); exit;
}
$username = $conn->real_escape_string($data->username);
$password = $data->password;
$result = $conn->query("SELECT * FROM users WHERE username = '$username' LIMIT 1");
if ($result->num_rows === 0) { echo json_encode(["status" => "error", "message" => "Invalid Username or Password"]); exit;
}
$user = $result->fetch_assoc();
if (!password_verify($password, $user['password'])) { echo json_encode(["status" => "error", "message" => "Invalid password"]); exit;
}
$payload = [ "iss" => "http://localhost", "aud" => "http://localhost", "iat" => time(), "exp" => time() + (60 * 60), "user" => [ "id" => $user['id'], "username" => $user['username'], "email" => $user['email'] ]
];
$jwt = JWT::encode($payload, $secret_key, 'HS256');
echo json_encode([ "status" => "success", "message" => "Login successful", "token" => $jwt
]);
?>

Protected Route Component that validates JWT token to permit


This component validates if the localStorage has the JWT token. If not, then it will stop the user from accessing a requested page. Instead, it redirects to the login page.

src/components/ProtectedRoute.js

import { Navigate } from "react-router-dom"; const ProtectedRoute = ({ children }) => { const token = localStorage.getItem("token"); if (!token) { return <Navigate to="/login" replace />; } return children;
}; export default ProtectedRoute;

Dashboard with profile information


The React main App component imports the ProtectedRoutes to bring the validation process at the top layer. This ProtectedRoutes wrapper around the Dashboard will help to permit only a JWT-authenticated user to the dashboard.

This React dashboard script gets the user details from the decoded JWT token. Then, those details are rendered to the UI as shown below.

A simple header is created for this dashboard view with a logout option. On clicking logout, it clears the localStorage and redirects to the login page.

react jwt dashboard

src/pages/Dashboard.jsx

import React, { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { jwtDecode } from "jwt-decode";
import "../styles/style.css"; const Dashboard = () => { const [user, setUser] = useState(null); const navigate = useNavigate(); useEffect(() => { const token = localStorage.getItem("token"); if (!token) { navigate("/login"); return; } try { const decoded = jwtDecode(token); setUser(decoded.user); } catch (error) { console.error("Invalid token:", error); localStorage.removeItem("token"); navigate("/login"); } }, [navigate]); if (!user) return <p>Loading...</p>; const handleLogout = () => { localStorage.removeItem("token"); navigate("/login"); }; return ( <div className="dashboard-wrapper"> <nav className="navbar"> <div className="navbar-left"> <h2>Dashboard</h2> </div> <div className="navbar-right"> <button className="logout-btn" on‌Click={handleLogout}> <img src="./logout.svg" alt="Logout" className="logout-icon" /> </button> </div> </nav> <div className="card"> <img src="/profile.jpg" alt="" className="profile-pic" /> <h2>Welcome, {user.username}</h2> <p> <strong>Email:</strong> {user.email} </p> </div> </div> );
};
export default Dashboard;

conclusion


With this login authentication base, you can have a good start to create a React JWT login. The user registration involves PHP and MySQL connection to generate backend data for this login. It can be enhanced by adding server-side JWT validation to improve the security. The concept of securing application pages with protected routes helps to reuse the wrapper for more components.

References:

  1. About JWT (JSON Web Token)
  2. PHP JWT backend library to encode decode JWT token
  3. Client side JWT decoding library

Download

Vincy
Written by Vincy, a web developer with 15+ years of experience and a Masters degree in Computer Science. She specializes in building modern, lightweight websites using PHP, JavaScript, React, and related technologies. Phppot helps you in mastering web development through over a decade of publishing quality tutorials.

↑ Back to Top



https://www.sickgaming.net/blog/2025/10/...ed-routes/

Print this item

  News - Fallout Creator Rejoins Obsidian, Has A New Squirrel Friend
Posted by: xSicKxBot - 12-07-2025, 05:14 AM - Forum: Lounge - No Replies

News - Fallout Creator Rejoins Obsidian, Has A New Squirrel Friend

Fallout creator Tim Cain has returned to Obsidian, but what is he working on? He's not allowed to say, and says you shouldn't even try to guess. Cain also shared an update about his personal life and a new friendship with a squirrel.

In a YouTube video, Cain said he recently relocated from Seattle to southern California, and one of the first things that happened was a squirrel ran up to him with no fear. "She just sat there and looked at me, and I shrugged and I'm like, 'What do you want from me? I don't know you.'" Cain fed the critter some walnuts and continues to feed the creature every day when he leaves and comes back home.

This is how Cain started the video, before getting into his return to Obsidian. He said he's now back at the studio, in-person and full-time. While he has returned to Obsidian, you'll also see his name appear in the credits of an upcoming unspecified game that he did contract work for before coming back to Obsidian, he said.

Continue Reading at GameSpot

https://www.gamespot.com/articles/fallou...01-10abi2f

Print this item

 
Latest Threads
[Tut] How to Use ChatGPT ...
Last Post: xSicKxBot
7 hours ago
[Tut] React Charts and Gr...
Last Post: xSicKxBot
7 hours ago
(Indie Deal) New Giveaway...
Last Post: xSicKxBot
8 hours ago
(Free Game Key) Steam - W...
Last Post: xSicKxBot
8 hours ago
[Tut] This Finviz Screene...
Last Post: xSicKxBot
Yesterday, 09:54 AM
[Tut] Integrate Google Ma...
Last Post: xSicKxBot
Yesterday, 09:54 AM
Forza Horizon 5 Game Save...
Last Post: bozsmuymuy
Yesterday, 03:36 AM
[Tut] Restoring Images wi...
Last Post: xSicKxBot
12-10-2025, 05:15 PM
[Tut] How to Build a Resp...
Last Post: xSicKxBot
12-10-2025, 05:15 PM
[Tut] Modelling TSLA. How...
Last Post: xSicKxBot
12-10-2025, 12:48 AM

Forum software by © MyBB Theme © iAndrew 2016