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
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>.
<script language = "Javascript">
/**
* DHTML email validation script. Courtesy of SmartWebby.com (https://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: https://sodadome.com/bugreport.php
(Yes, you can test it out. I won't mind.)
$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