Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 181
0 Users 1 Guests Online

Bug Report

Ok, so there is bound to be some bugs and glitches in your user system. Well this lets people submit the errors to you.

Let's call this: bugreport.php
PHP Code
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
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
switch($_GET[act]){ 
    
default: 
if(!
$_POST['br']){

    

echo 
"<center>


<form onSubmit='return ValidateForm()' name='frmSample' action='bugreport.php?act=thanks' method='post'>
<table id='dan'><tr><td colspan='2'><span  id='t'>Bug Report</span></td></tr>
<tr><td>Your Name</td><td><input type='text' name='username'></td></tr>
<tr><td>Your Email</td><td><input type='text' name='email' onchange=\"CheckItems(this.value, 'email');\"></td></tr>
<tr><td>Were you logged in?</td><td><select style='width:146px;' name='logged'>
<option value='yes'>Yes, I was logged in</option>
<option value='no'>No, I was a guest/logged out.</option>
</select></td></tr>

<tr><td>Category of Bug</td><td>
<select style='width:146px;' name='category'>
<optgroup label='User Settings'>
<option value='PM Setting'>PM Setting</option>
<option value='Profile Setting'>Profile Setting</option>
<option value='Friendlist Setting'>Friendlist Setting</option>
<option value='Profile Design'>Profile Design</option>

<optgroup label='Message Panel'>
<option value='composemsgs'>Composing Messages</option>
<option value='savingmsgs'>Saving Messages</options>
<option value='readingmsgs'>Reading Messages</options>
<option value='replyingmsgs'>Replying to Message</options>
<option value='inbox'>Inbox (saved/sent/regular)</option>

<optgroup label='Other'>
<option value='editingprofiles'>Editing My Profile</option>
<option value='changepass'>Changing Pass</option>
<option value='points'>Points/Bank</option>
<option value='Friendlist'>Friendlist</option>
<option value='Blocklist'>Blocklist</option>
<option value='Other'>Other</option>
</select>
</td>
</tr>
<tr><td colspan='1'>Comments</td></tr><tr><td colspan='2'><textarea onclick=\"this.value='';\" rows='5' style='width:276px' name='message'>Please be as specific as possible. What you did to cause this bug and where.</textarea></td></tr><tr><td align='right'><span style='position:relative;left:148px;' ><input type='submit'value='Submit!' name='br'></span></td></tr>
</table>
</form>

</center>"
;

}
break;

case 
'thanks':

$username $_POST[username];
$email $_POST[email];
$cat $_POST[category];
$text $_POST[message];
$log $_POST[logged];
$date date("F j, Y"); //the date sent
if ($username == NULL || $email == NULL || $text == NULL) {
    
    echo 
"You forgot to fill in a field! <a href='bugreport.php'>Go back.</a>";
    
    }else{

    
$mail mail("EMAIL TO SEND BUGS TO""Bug Report by $username""Reported by: $username
Where it happened: 
$cat
Were they logged in? 
$log
Report Sent on: 
$date

Comments:

$text""From: $email");

echo 
"
<h2>Thank you for your help!</h2>
Thanks for sending in the bug report. We appreciate your reports as it helps keep SITENAME bug and error free! Have a nice day. <a href='bugreport.php'>Go Back.</a>"
;
}
break;
}
?>


Now you're going to have to edit things like who to send the emails and and bug category.

Now... for a bonus add this JavaScript script in between your <head></head>.

Code

<script language = "Javascript">
/**
* DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
*/

function echeck(str) {

var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}

return true
}

function ValidateForm(){
var emailID=document.frmSample.email

if ((emailID.value==null)||(emailID.value=="")){
alert("Please Enter your Email ID")
emailID.focus()
return false
}
if (echeck(emailID.value)==false){
emailID.value=""
emailID.focus()
return false
}
return true
}
</script>


What does this do? It makes sure the user puts an email; like an email validation.

Well thats about it. Enjoy. Post errors/bugs here (how ironic) if you have any. Which I doubt there should be any problems.

LIVE PREVIEW: http://sodadome.com/bugreport.php

(Yes, you can test it out. I won't mind.)
UrbanTwitch
Views:
2395
Rating:
Posted on Saturday 16th August 2008 at 10:30 PM
UrbanTwitch
UrbanTwitch
Take

$mail = mail("EMAIL TO SEND BUGS TO", "Bug Report by $username", "Reported by: $username

and replace with:

$mail = mail("email@here.com", "Bug Report by $username", "Reported by: $username
Posted on Saturday 16th August 2008 at 05:01 PM
Vic Vance
Vic Vance
Urrm where is the email going how can I make the email code to me on my hotmail???? Help
Posted on Tuesday 12th August 2008 at 07:29 AM
Dalez
Dalez
Adam, i followed the tut, but it still does not work, but thanks for the link!
Posted on Monday 11th August 2008 at 07:04 PM
Adam981
Adam981
@ dalez & anyone else that needs to use sendmail on XAMPP http://i.justrealized.com/2008/05/02/how-to-use-sendmail-in-xampp/
Posted on Monday 11th August 2008 at 06:16 PM
UrbanTwitch
UrbanTwitch
Dalez, you want Badge System?
Posted on Monday 11th August 2008 at 05:58 PM
Dalez
Dalez
Yeah, but i don't :P And i search on google, but its all for linux.
Posted on Monday 11th August 2008 at 05:48 PM
UrbanTwitch
UrbanTwitch
Meh, nothing impossible. ITs just hard to think of how to do it.
Posted on Monday 11th August 2008 at 05:48 PM
Dalez
Dalez
I am the host :P I am hosting off of my computer, and i need to know how to make send mail work, so that i can use this script ^^
Posted on Monday 11th August 2008 at 05:44 PM
ilyas-shezad
ilyas-shezad
Hmmm ive neever had to do it on an XAMPP server, contact your host and ask them about it.
Posted on Monday 11th August 2008 at 05:42 PM
Dalez
Dalez
How do i make sendmail work on Windows XAMPP? Please i need to know ^^