[help] with reporting errors[solved]

Posts 15 of 5 · Page 1 of 1
[help] with reporting errors[solved]
Here is my Vb.net code

[highlight=vb.net]
Imports System.Net
Imports System.IO
Public Class errorfrm

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox1.Text = "" Then

MsgBox("YOU MUST INCLUDE WHAT YOU WERE DOING AND WHAT ERROR YOU GOT!")
Else

Dim Request As HttpWebRequest
Dim Response As HttpWebResponse
Dim Strem As Stream
Request = WebRequest.Create("mysite.com/app/Errors/get_data.php?Name=" + frmMain.txtLid.Text + "?Message=" + TextBox1.Text + "?Os=" + GetWinVer() + "?Ss=" + TextBox2.Text)
Response = Request.GetResponse
Strem = Response.GetResponseStream
Dim srs = New StreamReader(Strem)
Dim strResponse As String = srs.ReadToEnd
Response.Close()
MsgBox("Thank You For Submiting your error we will reveiw it and try to fix it.")
Me.Hide()
End If

Catch ex As Exception
End Try
End Sub

Public Function GetWinVer() As String
' Thanks Nexgen and blubb just what i needed..
Return My.Computer.Info.OSFullName
End Function
End Class
[/highlight]


now here is my php

[html]

<?php

$Name = htmlspecialchars($_GET['Name']);
$Message = htmlspecialchars($_GET['Message']);
$Ss = htmlspecialchars($_GET['Ss']);
$Os = htmlspecialchars($_GET['Os']);
$ip = $_SERVER['REMOTE_ADDR'];
$dtime = date('r');
if($Name == ""){
$Name = "guest";
}

if($Ss == ""){
$Ss= "None";
}


$entry_line = "$dtime \n username: $name \n Error: $Message \n Os: $Os \n ScreenShotLink: $Ss \n Ip:$ip \n \n --\n";
$fp = fopen("ErrorReports.txt", "a");
fputs($fp, $entry_line);
fclose($fp);
?>



[/html]

i used it and filled in all info except Screen Shot and here is the result.

Code:
Sun, 06 Feb 2011 19:38:00 -0500 
 username:  
 Error:  
 Os:  
 ScreenShotLink: None 
 Ip:99.66.69.33 
 
 --

what am i doing wrong? why wont it write to my file?
Assisting via MSN, will post solution here when one is found and the OP is back online.
Code:
Request = WebRequest.Create("mysite.com/app/Errors/get_data.php?Name=" + frmMain.txtLid.Text + "?Message=" + TextBox1.Text + "?Os=" + GetWinVer() + "?Ss=" + TextBox2.Text)
produces something like
Code:
freedompeace.net/get_data.php?Name=freedompeace?Message=HiThere...
PHP will take the last question mark and use variables after that.

Rather than
Code:
url.com/php?var1=a?var2=b
You need to use an AMPERSAND to indicate breaks between variables

Code:
url.com/php?var1=a&var2=b
Also, make sure you escape any characters like spaces etc...
Quote Originally Posted by freedompeace View Post
Code:
Request = WebRequest.Create("mysite.com/app/Errors/get_data.php?Name=" + frmMain.txtLid.Text + "?Message=" + TextBox1.Text + "?Os=" + GetWinVer() + "?Ss=" + TextBox2.Text)
produces something like
Code:
freedompeace.net/get_data.php?Name=freedompeace?Message=HiThere...
PHP will take the last question mark and use variables after that.

Rather than
Code:
url.com/php?var1=a?var2=b
You need to use an AMPERSAND to indicate breaks between variables

Code:
url.com/php?var1=a&var2=b
Also, make sure you escape any characters like spaces etc...

Doh, freedom has it lol.
thanks Blubb and freedom and jason

/request close

solved using freedom's code
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?