Question : PHP Cookies

Hello,

I am using an htaccess file to redirect a search query into a seo friendly address. When I use the normal search string the cookies are set but when I use the seo version they are not.

The confusion is that I am using the code below and the second line works, it does set the cookie where I can pull it up on that page but the top part does not set the cookie in the browser.

I would love some incite.

Thanks!
1:
2:
setcookie ("priceMax", mysql_real_escape_string($_GET['dollars1']), time() + 129600);
$_COOKIE['priceMax'] = mysql_real_escape_string($_GET['dollars1']);

Answer : PHP Cookies

If you schedule it to start at the beginning of each day, this will exit the loop at 5pm, and send you the email.  I have made a couple of other minor changes.

I don't like the "wait for one hour" that is built into the script......this could mean you don't get the final notification until 6pm, so I have changed the sleep to only one minute, but the script will only check for the file date change when the minute value of the current time is 00, which is on the hour.

To account for the time it might take for the file to be checked, I have made the end time 5:05:00 PM.

So, in short, this will run all day until 5:05:00 PM, checking the file date every hour.  Because it checks the file date on the hour, you should start the scheduled task at 9:01:00 AM each morning.

Regards,

Rob.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
strComputer = "."
strFile = "C:\program files\dir\name.txt"
dteEndTime = "5:05:00 PM"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where Name = '" & Replace(strFile, "\", "\\") & "'")

For Each objFile In colFiles
    strOriginalTimestamp = objFile.LastModified
Next

strSubject = "Monitoring script started"
strFrom = "from.com"
strTo = "name.com"
strBody = "The monitoring script has started at " & Now
strServer = "name"
SendEmail strSubject, strFrom, strTo, strBody, strServer

Do While CDate(Time) < CDate(dteEndTime)
	' Sleep for one minute
	Wscript.Sleep 60000
    If CDate(Time) < CDate(dteEndTime) Then
	    ' Check if the current time is on the hour
	    If Right("0" & Minute(Time), 2) = "00" Then 
		    'Wscript.Sleep 3600000
		    Set colFiles = objWMIService.ExecQuery _
		        ("Select * from CIM_Datafile Where Name = '" & Replace(strFile, "\", "\\") & "'")
		
		    For Each objFile In colFiles
		        strLatestTimestamp = objFile.LastModified
		    Next 
		
			ProcessScript 
		    If strLatestTimestamp = strOriginalTimestamp Then
				strSubject = "File Date Has Not Changed"
				strFrom = "from.com"
				strTo = "name.com"
				strBody = "The file has not changed since " & strLatestTimeStamp
				strServer = "name"
				SendEmail strSubject, strFrom, strTo, strBody, strServer
			Else
		        strOriginalTimestamp = strLatestTimeStamp
			End If
		End If
	End If
Loop

' This will trigger when the current time passes the 
strSubject = "Monitoring script ended"
strFrom = "from.com"
strTo = "name.com"
strBody = "The monitoring script has ended at " & Now
strServer = "name"
SendEmail strSubject, strFrom, strTo, strBody, strServer

Sub SendEmail(strSubject, strFrom, strTo, strBody, strServer)
	Set objEmail = CreateObject("CDO.Message")
	On Error Resume Next     
	objEmail.Subject = strSubject
	objEmail.From = strFrom
	objEmail.To = strTo
	objEmail.TextBody = strBody
	objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
	objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strServer
	objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
	objEmail.Configuration.Fields.Update
	objEmail.Send
	Err.Clear
	On Error GoTo 0
End Sub
Random Solutions  
 
programming4us programming4us