This project control how many times a user can register for a webinar using a email or a IP address or both. This api endpoint is works like a middleman.
- Limit registration by email address
- Limit registration by IP address
- Client's IP in custom filed added automatically
- CURL
Make a new folder eg: webinar, then add these file inside.
server_root
│ ...
│
└─── webinar
│ limit.php
│ user.json
now your api endpoint is: https://your-domain/webinar/limit.php
Here I'm using form from this project. Just change submit url located in app.js.
// ...
axios
.post(`https://api.joinnow.live/webinars/${webinarShortId}/registration`, data, {
contentType: 'application/json'
})
// ...
to
// ...
axios
.post(`https://your-domain/webinar/limit.php`, data, {
contentType: 'application/json'
})
// ...
add your webinar short id in limit.php
<?php
//...
$webinarShortId = ""; // Webinar short id
<?php
//...
$validateWithEMail = true; // email duplication handling
<?php
//...
$validateWithIP = false; // IP address duplication handling
<?php
//...
$validateWithIP = false; // IP address duplication handling
<?php
// ...
echo json_encode([
"message" => "you are already registered in this event, please check your email!",
]); // Email matched message
// ...
<?php
// ...
echo json_encode([
"message" => "you are already registered in this event, please check your email!",
]); // IP matched message
// ...
change ip_address to something else on both condition.
<?php
// ...
# Add ip address to custom filed
if (isset($data->customFields)) {
$data->customFields->ip_address = $ip;
} else {
$data->customFields = [
"ip_address" => $ip,
];
}
// ...
When you want to clear users list or using with different webinar, replace user.json with this
[]
graph LR
A[Registration form]
B(limit.php)
C(Get required data)
D[Check ip and email]
E[Check registration limit]
F[Append request ip in custom filed]
G[StealthSeminar api]
H((Condition))
I(Return response)
J[Update user data]
K[Duplication error message]
A -- POST --> B
B --> C
B --> D
B --> E
D --> H
C --> H
E --> H
H -- valid --> F
H -- invalid --> K
F -- POST --> G
G -- Get data --> I
I -- user.json --> J