Condividi:        

pc-facile news script

Problemi di HTML? Di PHP, ASP, .NET, JSP, Perl, SQL, JavaScript, Visual Basic..?
Vuoi realizzare programmi in C, C++, Java, Ruby o Smalltalk, e non sai da che parte cominciare?
Entra qui e troverai le risposte!

Moderatori: Anthony47, Triumph Of Steel, archimede

pc-facile news script

Postdi styleintimo » 02/06/05 21:24

Salve,sono nuovissimo del sito,o scaricato news1.2 appena messo in rete mi da'questo errore

Server.MapPath() error 'ASP 0173 : 80004005'

Invalid Path Character

/pcf_news.asp, line 63

An invalid character was specified in the Path parameter for the MapPath method

mi potreste aiutare visto che di asp ne capisco poco.
grazie in anticipo,vi riporto la stringa dell'errore

Function Check_News
Dim fso,MyFile,intOra,intMin,inSe,OraAttuale,Diff,LastUpdate,ntrim
file = server.mappath(local_file) set fso = Server.CreateObject("Scripting.FileSystemObject")
'## Check if file exist ##
If fso.fileExists(file) Then '## It Exists, ok
Set Myfile = fso.GetFile(file)
LastUpdate = FormatDateTime(Myfile.DateLastModified,3) '## LastUpdate of the local file
intOra = DatePart("h", time() ) '## Get Hours
If (intOra < 10) Then
intOra = "0" & intOra
End If
intMin = DatePart("n", time() ) '## Get Minutes
If (intMin < 10) Then
intMin = "0" & intMin
End If
intSec = DatePart("s", time() ) '## Get Seconds
If (intSec < 10) Then
intSec = "0" & intSec
styleintimo
Newbie
 
Post: 6
Iscritto il: 02/06/05 14:24
Località: Priolo Gargallo

Sponsor
 

Postdi Triumph Of Steel » 02/06/05 22:21

posta anche il valore di

local_file

magari il problema è li!
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00

Postdi styleintimo » 03/06/05 13:34

Ciao,tutto il codice e li' la riga dove mi dice che c'e' l'errore e solo questa:

file = server.mappath(local_file)

N.b o notato che l'antivirus mi a bloccato il file,e stato spedito a verifica e la risposta e stata questa

This file has been detected because it contains an instruction which attempts to download and install a malicious program on your computer by using a security breach in Internet Explorer.

Tradotto in italiano maccheronico e questo

Questo archivio si ha scoperto perché contiene un'istruzione che tenta di scaricare ed installare un programma malevolo sul Suo computer usando una rottura di sicurezza in Internet Explorer.

come mi devo comportare?
Ciao
styleintimo
Newbie
 
Post: 6
Iscritto il: 02/06/05 14:24
Località: Priolo Gargallo

Postdi Triumph Of Steel » 03/06/05 14:15

intendevo questo:
Codice: Seleziona tutto
local_file   = "news.txt"


hai seguito le istruzioni?
di caricare anche il file news.txt (anche se inizialmente vuoto) e dargli i permessi d scrittura?
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00

Postdi styleintimo » 03/06/05 21:57

Ciao,ti allego il file che cercavi

local_file = "news.txt"
styleintimo
Newbie
 
Post: 6
Iscritto il: 02/06/05 14:24
Località: Priolo Gargallo

Postdi styleintimo » 03/06/05 21:58

styleintimo ha scritto:Ciao,ti allego il file che cercavi

local_file = "news.txt"

o dato anche i permessi di scrittura
styleintimo
Newbie
 
Post: 6
Iscritto il: 02/06/05 14:24
Località: Priolo Gargallo

Postdi Triumph Of Steel » 03/06/05 22:32

se il file "news.txt" è nella stessa cartella del file "pcf_news.asp", prova a togliere la parte di "server.MapPath", e lasciare solo:

Codice: Seleziona tutto
file = local_file

è una prova.. vedi se va..
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00

Postdi archy » 06/06/05 09:48

prova a commentare il codice dopo la riga

file = server.mappath(local_file)

e metti una semplice

response.write "file=" & file

così controlli l'effetivo contenuto della variabile magari manca qualche \
archy
Newbie
 
Post: 4
Iscritto il: 01/06/05 20:03

Postdi styleintimo » 06/06/05 11:07

ciao,o provato come dici tu ma mi da questo errore
Server.MapPath() error 'ASP 0172 : 80004005'

Invalid Path

/pcf_news.asp, line 63

The Path parameter for the MapPath method must be a virtual path. A physical path was used.

ti posto tutta la pagina
<%
'pc-facile.com News Version 1.2

'##################################################################
'### code by []==ThoR® for Pc-Facile ###
'## thx to Paolo ###
'##################################################################
'Modificate i seguenti parametri di configurazione dove necessario'
'-----------------------------------------------------------------'
Dim local_file,timeout,cache_time,news_number,ntrim,remote_file,remote_url
Session.LCID = 1040 'Time Format
local_file = "D:\Inetpub\webs\styleintimoit\news.txt" 'Percorso del file news.txt sul vostro server. È necessario il percorso assoluto.
timeout = 10 'Timeout in caso di problemi al server di !pc-facile - non modificare a meno di necessità
cache_time = 1800 'Numero di secondi che devono intercorrere tra gli aggiornamenti della cache.
'NON abbassare questo valore sotto i 1800 secondi di default
news_number = 10 'Numero di news che si vogliono esporre sul proprio sito - il massimo è 10
ntrim = 1000 'Accorcia titoli troppo lunghi a $trim caratteri.
'Se non si vuole usufruire di questa opzione usare un numero molto alot: eg 1000
'##################################################################
'## Questi due non devono essere modificati per il corretto funzionamento delle news
'## a meno che non specificato dal WebMaster di Pc-Facile
remote_url = "http://www.pc-facile.com/"
remote_file = remote_url & "news.txt" 'Percorso del file news.txt su !pc-facile - da non modificare
'------------------------'
'Configurazione terminata'

Dim i,IDNews,ListNews,TimeNews,DateNews,ShortTitle
Check_News
Dim ListHTML
ListHTML = ReadNews

For i=0 To news_number - 1
ListNews = Split(ListHTML(i),";:;")
IDNews = ListNews(0)
TitNews = ListNews(1)
If (ntrim < 80) Then
ShortTitle = Left(TitNews, ntrim) & "..."
Else
ShortTitle = Left(TitNews, ntrim)
End If
TimeNews = ListNews(2)
DateNews = ListNews(3)
'##################################
'### Inizio Layout ###
'##################################
Response.Write "<strong>&middot;</strong>&nbsp;"
Response.Write "<a href=""http://www.pc-facile.com/" & IDNews & """ title=""" & TitNews & """ target=""_blank"" >"
Response.Write "" & ShortTitle & ""
Response.Write "</a>"
Response.Write "<br>"
'##################################
'### Fine Layout ###
'##################################

Next

'-------------------------------------------------------------
' ATTENZIONE!!! NON modificare nulla oltre questo punto!
'-------------------------------------------------------------

Function Check_News
Dim fso,MyFile,intOra,intMin,inSe,OraAttuale,Diff,LastUpdate,ntrim
file = server.mappath(local_file)response.write "file=" & file
set fso = Server.CreateObject("Scripting.FileSystemObject")
'## Check if file exist ##
If fso.fileExists(file) Then '## It Exists, ok
Set Myfile = fso.GetFile(file)
LastUpdate = FormatDateTime(Myfile.DateLastModified,3) '## LastUpdate of the local file
intOra = DatePart("h", time() ) '## Get Hours
If (intOra < 10) Then
intOra = "0" & intOra
End If
intMin = DatePart("n", time() ) '## Get Minutes
If (intMin < 10) Then
intMin = "0" & intMin
End If
intSec = DatePart("s", time() ) '## Get Seconds
If (intSec < 10) Then
intSec = "0" & intSec
End If
OraAttuale = intOra & "." & intMin & "." & intSec '## Now
Diff = OraAttuale - LastUpdate '## Check if old
If (Diff > cache_time) Then
RefreshNews (news_number)
End If
else
'## file not found ##'
RefreshNews (news_number)
end if
set fso = nothing
End Function

Function ReadNews
Dim fso,MyFile,intOra,intMin,inSe,OraAttuale,Diff,LastUpdate
Dim news_number
file = server.mappath(local_file)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set Myfile = fso.OpenTextFile(file, 1)
counter = 1
content = ""
Dim content2(10)
numArr = 0
If (news_number > 10) Then '## Max 10 News, or Error!
content2 = "Impostare un massimo di 10 News!"
Else
Do While NOT Myfile.AtEndOfStream
Myline = Myfile.ReadLine
content2(numArr) = Myline
numArr = numArr + 1
Loop
End If
Myfile.Close
set Myline = nothing
set fso = nothing
ReadNews = content2
End Function


Function RefreshNews (newNum)
Dim oStream,NewFile,res,objTextFile,objFSO
file = server.mappath(local_file)
'Response.Write "<br><br>Aggiornamento<br><br>"
Set FSO = Server.CreateObject("Scripting.FileSystemObject") '## Object For File
Set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP") '## Object For URL
Set myStream = Server.CreateObject("ADODB.Stream") '## Object For Stream
Set Myfile = FSO.CreateTextFile(file, True) '## CreateFile, or overwrite it

objXmlHttp.open "GET", remote_file, False '## Open URL
objXmlHttp.SetRequestHeader "Content-type", "text/html" '## Send some Headers
objXmlHttp.setRequestHeader "Connection", "Keep-Alive" '## Send some Headers
objXmlHttp.send '## Send URL

If objXmlHttp.readyState <> 4 then '## Wait up timeout
objXmlHttp.waitForResponse timeout
End If

If objXmlHttp.status <> 200 Then '## Check for URL Error
' Error loading file
Myfile.WriteLine "Errore nel caricamento delle news remote" '## Write an error to file
Else
'## Response From Server ##
Response.Write "<xmp>" '## Patch for VBCrlf <xmp> doesn't process code
strHTML = objXmlHttp.responseText '## Put Response, in var
Response.Write "</xmp>" '## Close Patch <xmp>
'## Write to local file ##
Myfile.WriteLine server.HTMLEncode(strHTML) '## Write news to file
End If
Myfile.Close

Set objXmlHttp = Nothing
set FSO = Nothing
End Function
%>
styleintimo
Newbie
 
Post: 6
Iscritto il: 02/06/05 14:24
Località: Priolo Gargallo

Postdi archy » 06/06/05 12:07

scusa ma local_file è l'effetivo nome del file? oppure è una variabile che contiene il nome del file?
io comunque uso la seguente espressione :

Server.MapPath("\mdb-database\Db.mdb")

dove mdb-database è una directory che si trova in c:\inetpub\wwwroot

quindi dovresti passare a server.mappath il percorso del tuo file a partire da c:\inetpub\wwwroot
archy
Newbie
 
Post: 4
Iscritto il: 01/06/05 20:03

Postdi Triumph Of Steel » 06/06/05 21:26

local_file = "D:\Inetpub\webs\styleintimoit\news.txt"

sbagliato!
devi mettere solo news.txt, e lo script deve essere nella stessa cartella dello script!
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00


Torna a Programmazione


Topic correlati a "pc-facile news script":

Sito pc-facile
Autore: gimart
Forum: Discussioni
Risposte: 3
Script batteria < 30%
Autore: GiuCi
Forum: Software Windows
Risposte: 7

Chi c’è in linea

Visitano il forum: Nessuno e 8 ospiti