Mirabilweb
a- a+

Creare un sistema per inserire news (Parte IV)

Pagina 4 di 8

Adesso che abbiamo creatol’interfaccia che visualizza le news, passiamo allarealizzazione dell’area per l’amministratore.Creiamo una nuova cartella, che chiameremo admin (fig.4), e inseriamoci dentro il file index.asp:

 

 

<%‘SE LA VARIABILE MODO E’ UGUALE A CONTROLLA ESEGUE IL CONTROLLO USER E PWDmodo=Request.QueryString("modo")If modo="controlla" then username=Request.Form("username")password=Request.Form("password") ‘MODIFICARE RISPETTIVAMENTE CON USERNAME E PASSWORDIf username="admin" and password="123" then ‘SE LA CONDIZIONE E’ VERA IMPOSTA LA SESSION LOGGATO E TI PORTA IN HOME.ASPsession("loggato")="si"Response.Redirect "home.asp"‘ALTRIMENTI TI VISUALIZZA LA PAGINA DI LOGINelseResponse.Redirect "index.asp" end ifelse%><html> <head><title>Creazione Sistema per la gestione delle news</title></head> <body> <p align="center"><font size="2" face="Verdana"><b>Creazione Sistema per lagestione delle news</b></font></p><p align="left"><font size="2" face="Verdana">Immetti Username e Password perentrare nell'amministrazione news:</font></p> <form method="POST" action="index.asp?modo=controlla">  <div align="center">    <center>    <table border="0" cellpadding="0" cellspacing="0"><tr>  <td><font size="2" face="Verdana">Username:&nbsp;</font></td>  <td><font size="2" face="Verdana"><input type="text" name="username" size="20"></font></td></tr><tr>  <td><font size="2" face="Verdana">Password:</font></td>  <td><font size="2" face="Verdana"><input type="text" name="password" size="20"></font></td></tr><tr>  <td colspan="2">    <p align="center"><font size="2" face="Verdana"><input type="submit" value="Invia" name="B1"><input type="reset" value="Reimposta" name="B2"></font></td></tr>    </table>    </center>  </div>  <p align="left">&nbsp;</p></form><p align="left">&nbsp;</p> <p align="left">&nbsp;</p> <p align="right"><a href="http://www.mirabilweb.tk"><font size="2" face="Verdana"><b>byMirabil Web Computer - Tutto sui PC!</b></font></a></p> </body></html><%end if%>

 

In questa pagina asp, si trova unmodulo che compilato viene inviato alla paginaindex.asp?modo=controlla,ossiaalla stessa pagina. Nella pagina index.asp, nelleprime righe è stato inserito un “breve scriptasp” che controlla la QueryString modo e se essaè uguale a controlla, esegue il controllousername e password…

 

La pagina home.asp,conterrà il seguente codice asp:

 

 

<%‘SE LA SESSION LOGGATO E’ UGUALE A “SI” VISUALIZZA LA PAGINA….If session("loggato")="si" then%><html> <head><title>Creazione Sistema per la gestione delle news</title></head> <body> <p align="center"><font size="2" face="Verdana"><b>Creazione Sistema per lagestione delle news</b></font></p><p align="left"><font size="2" face="Verdana">Le operazioni che puoi eseguire:</font></p> <ul>  <li>    <p align="left"><b><font size="2" face="Verdana"><a href="aggiungi1.asp">Aggiungi    News</a></font></b></li>  <li>    <p align="left"><b><font size="2" face="Verdana"><a href="news.asp">Modifica/Elimina    News</a></font></b></li>  <li>    <p align="left"><b><font size="2" face="Verdana"><a href="esci.asp">Esci</a></font></b></li></ul> <p align="right"><a href="http://www.mirabilweb.tk"><font size="2" face="Verdana"><b>byMirabil Web Computer - Tutto sui PC!</b></font></a></p> </body></html><%‘…. ALTRIMENTI TI PORTA NELLA PAGINA INDEX.ASPelseResponse.Redirect "index.asp"end if%>

Continua>>>