WebSite X5Help Center

 
Fabrizio S.
Fabrizio S.
User

Gestione accessi attraverso database  it

Autore: Fabrizio S.
Visite 1548, Followers 1, Condiviso 0  

Buongiorno a tutti,

come da titolo avrei bisogno di inserire una pagina di accesso utenti che sia però gestita da un server SQL all'interno del quale posso aggiungere utenti e password, sapete in che modo è possibile?

Grazie 1000

Postato il
4 RISPOSTE
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... non ho il programma, ma penso che dovrai tu costruirti un codice appositamente per lo scopo; ...intanto prova a dare una occhata qui:

http://help.websitex5.com/it/v11/evo/impostazioni_database.htm?zoom_highlightsub=database

http://help.websitex5.com/it/v11/evo/gestione_dati.htm?zoom_highlightsub=database

... nella v.11-PRO impostato il Database, è possibile impostare la registrazione automatica degli Utenti...

.

ciao

Leggi di più
Postato il da  ‪ KolAsim ‪ ‪
Fabrizio S.
Fabrizio S.
User
Autore

Grazie Kolsim,

una domanda. Sai dove Website va a controllare user e password utenti? Penso che se cambiassi il "link" di riferimento e lo facessi puntare al server SQL dovrei aver risolto... forse...

Leggi di più
Postato il da Fabrizio S.
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... purtroppo, come detto all'inizio, io non posso, ...ma penso in qualche file PHP di quelli generati o nel DB del pannello admin in rete...

... magari qualche esperto potrebbe consigliarti meglio...

.

ciao

Leggi di più
Postato il da  ‪ KolAsim ‪ ‪
Fabrizio S.
Fabrizio S.
User
Autore

Ok grazie KolAsim... in attesa ho trovato il codice php che dovrebbe essere questo:

<?php

$serverName = "tcp:ProvideServerName.database.windows.net,1433";

$userName = 'ProvideUserName@ProvideServerName';

$userPassword = 'ProvidePassword'; $dbName = "TestDB"; $table = "tablePHP";

$connectionInfo = array("Database"=>$dbName, "UID"=>$userName, "PWD"=>$userPassword, "MultipleActiveResultSets"=>true);

sqlsrv_configure('WarningsReturnAsErrors', 0);

$conn = sqlsrv_connect( $serverName, $connectionInfo);

if($conn === false)

{ FatalError("Failed to connect...");

}

CreateTable($conn, $table, "Col1 int primary key, Col2 varchar(20)");

$tsql = "INSERT INTO [$table] (Col1, Col2) VALUES (1, 'string1'), (2, 'string2')";

$stmt = sqlsrv_query($conn, $tsql);

if ($stmt === false)

{

FatalError("Failed to insert data into test table: ".$tsql);

}

sqlsrv_free_stmt($stmt);

$tsql = "SELECT Col1, Col2 FROM [$table]";

$stmt = sqlsrv_query($conn, $tsql);

if ($stmt === false)

{

FatalError("Failed to query test table: ".$tsql);

}

else

{

while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_NUMERIC))

{

echo "Col1: ".$row[0]."\n";

echo "Col2: ".$row[1]."\n";

}

sqlsrv_free_stmt($stmt);

}

sqlsrv_close($conn);

function CreateTable($conn, $tableName, $dataType)

{

$sql = "CREATE TABLE [$tableName] ($dataType)";

DropTable($conn,$tableName);

$stmt = sqlsrv_query($conn, $sql);

if ($stmt === false)

{

FatalError("Failed to create test table: ".$sql);

}

sqlsrv_free_stmt($stmt);

}

function DropTable($conn, $tableName)

{

$stmt = sqlsrv_query($conn, "DROP TABLE [$tableName]");

if ($stmt === false)

{

}

else

{

sqlsrv_free_stmt($stmt);

}

}

function FatalError($errorMsg)

{

Handle_Errors();

die($errorMsg."\n");

}

function Handle_Errors()

{

$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);

$count = count($errors);

if($count == 0)

{

$errors = sqlsrv_errors(SQLSRV_ERR_ALL);

$count = count($errors);

} if($count > 0)

{

for($i = 0; $i < $count; $i++)

{ echo $errors[$i]['message']."\n";

}

}

}

?>

a questo punto dove lo posso inserire?

Grazie :-)

Leggi di più
Postato il da Fabrizio S.