mirror of
https://github.com/FranP-code/Login-Form.git
synced 2025-10-12 23:52:47 +00:00
Mejoradas las comprobaciones y la logica. Creadas las cookies. Cambiado la pagina de Notion por un link. Creados los scripts
This commit is contained in:
24
scripting/dataToMySQL.php
Normal file
24
scripting/dataToMySQL.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require '../logic/sql/connection.php';
|
||||
require './generateData.php';
|
||||
|
||||
$cantidadDeDatos = 7;
|
||||
$minCH = 7;
|
||||
$maxCH = 19;
|
||||
|
||||
$data = generateData($cantidadDeDatos, $minCH, $maxCH);
|
||||
$data2 = generateData($cantidadDeDatos, $minCH, $maxCH);
|
||||
|
||||
for ($i=0; $i < count($data); $i++) {
|
||||
$userUp = $connect -> prepare('insert into users (user, pass) values (?, ?)');
|
||||
$userUp -> bindParam(1, $data[$i], PDO::PARAM_STR);
|
||||
$data2H = hash('sha256', $data2[$i]);
|
||||
$userUp -> bindParam(2, $data2H, PDO::PARAM_STR);
|
||||
$userUp -> execute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
24
scripting/generateData.php
Normal file
24
scripting/generateData.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
function generateData($amount, $minCH, $maxCH) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
// Credits https://www.geeksforgeeks.org/generating-random-string-using-php/
|
||||
$ArrayResult= array();
|
||||
|
||||
for ($i=0; $i < $amount; $i++) {
|
||||
$result= '';
|
||||
for ($f=0; $f < rand($minCH, $maxCH) ; $f++) {
|
||||
$result = $result . $characters[rand(0, strlen($characters) - 1)];
|
||||
}
|
||||
|
||||
array_push($ArrayResult, $result);
|
||||
|
||||
}
|
||||
|
||||
return $ArrayResult;
|
||||
|
||||
}
|
||||
|
||||
generateData(9, 8, 14);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user