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. <?php
  2. switch($_GET[act]){
  3.  
  4. default:
  5. if(!$_POST['br']){
  6.  
  7.  
  8.  
  9. echo "<center>
  10.  
  11.  
  12. <form onSubmit='return ValidateForm()' name='frmSample' action='bugreport.php?act=thanks' method='post'>
  13. <table id='dan'><tr><td colspan='2'><span id='t'>Bug Report</span></td></tr>
  14. <tr><td>Your Name</td><td><input type='text' name='username'></td></tr>
  15. <tr><td>Your Email</td><td><input type='text' name='email' onchange=\"CheckItems(this.value, 'email');\"></td></tr>
  16. <tr><td>Were you logged in?</td><td><select style='width:146px;' name='logged'>
  17. <option value='yes'>Yes, I was logged in</option>
  18. <option value='no'>No, I was a guest/logged out.</option>
  19. </select></td></tr>
  20.  
  21. <tr><td>Category of Bug</td><td>
  22. <select style='width:146px;' name='category'>
  23. <optgroup label='User Settings'>
  24. <option value='PM Setting'>PM Setting</option>
  25. <option value='Profile Setting'>Profile Setting</option>
  26. <option value='Friendlist Setting'>Friendlist Setting</option>
  27. <option value='Profile Design'>Profile Design</option>
  28.  
  29. <optgroup label='Message Panel'>
  30. <option value='composemsgs'>Composing Messages</option>
  31. <option value='savingmsgs'>Saving Messages</options>
  32. <option value='readingmsgs'>Reading Messages</options>
  33. <option value='replyingmsgs'>Replying to Message</options>
  34. <option value='inbox'>Inbox (saved/sent/regular)</option>
  35.  
  36. <optgroup label='Other'>
  37. <option value='editingprofiles'>Editing My Profile</option>
  38. <option value='changepass'>Changing Pass</option>
  39. <option value='points'>Points/Bank</option>
  40. <option value='Friendlist'>Friendlist</option>
  41. <option value='Blocklist'>Blocklist</option>
  42. <option value='Other'>Other</option>
  43. </select>
  44. </td>
  45. </tr>
  46. <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>
  47. </table>
  48. </form>
  49.  
  50. </center>";
  51.  
  52. }
  53. break;
  54.  
  55. case 'thanks':
  56.  
  57. $username = $_POST[username];
  58. $email = $_POST[email];
  59. $cat = $_POST[category];
  60. $text = $_POST[message];
  61. $log = $_POST[logged];
  62. $date = date("F j, Y"); //the date sent
  63. if ($username == NULL || $email == NULL || $text == NULL) {
  64.  
  65. echo "You forgot to fill in a field! <a href='bugreport.php'>Go back.</a>";
  66.  
  67. }else{
  68.  
  69. $mail = mail("EMAIL TO SEND BUGS TO", "Bug Report by $username", "Reported by: $username
  70. Where it happened: $cat
  71. Were they logged in? $log
  72. Report Sent on: $date
  73.  
  74. Comments:
  75.  
  76. $text", "From: $email");
  77.  
  78. echo "
  79. <h2>Thank you for your help!</h2>
  80. 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>";
  81. }
  82. break;
  83. }
  84. ?>


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>.

PHP Code
  1. <script language = "Javascript">
  2. /**
  3.  * DHTML email validation script. Courtesy of SmartWebby.com (https://www.smartwebby.com/dhtml/)
  4.  */
  5.  
  6. function echeck(str) {
  7.  
  8. var at="@"
  9. var dot="."
  10. var lat=str.indexOf(at)
  11. var lstr=str.length
  12. var ldot=str.indexOf(dot)
  13. if (str.indexOf(at)==-1){
  14. alert("Invalid E-mail ID")
  15. return false
  16. }
  17.  
  18. if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
  19. alert("Invalid E-mail ID")
  20. return false
  21. }
  22.  
  23. if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
  24. alert("Invalid E-mail ID")
  25. return false
  26. }
  27.  
  28. if (str.indexOf(at,(lat+1))!=-1){
  29. alert("Invalid E-mail ID")
  30. return false
  31. }
  32.  
  33. if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
  34. alert("Invalid E-mail ID")
  35. return false
  36. }
  37.  
  38. if (str.indexOf(dot,(lat+2))==-1){
  39. alert("Invalid E-mail ID")
  40. return false
  41. }
  42.  
  43. if (str.indexOf(" ")!=-1){
  44. alert("Invalid E-mail ID")
  45. return false
  46. }
  47.  
  48. return true
  49. }
  50.  
  51. function ValidateForm(){
  52. var emailID=document.frmSample.email
  53.  
  54. if ((emailID.value==null)||(emailID.value=="")){
  55. alert("Please Enter your Email ID")
  56. emailID.focus()
  57. return false
  58. }
  59. if (echeck(emailID.value)==false){
  60. emailID.value=""
  61. emailID.focus()
  62. return false
  63. }
  64. return true
  65. }
  66. </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.)
UrbanTwitch's Avatar
Views:
3,972
Rating:
Posted on Saturday 16th August 2008 at 10:30 PM
UrbanTwitch
UrbanTwitch's Avatar
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
VicVance
VicVance's Avatar
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's Avatar
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's Avatar
@ dalez & anyone else that needs to use sendmail on XAMPP https://i.justrealized.com/2008/05/02/how-to-use-sendmail-in-xampp/
Posted on Monday 11th August 2008 at 06:16 PM
UrbanTwitch
UrbanTwitch's Avatar
Dalez, you want Badge System?
Posted on Monday 11th August 2008 at 05:58 PM
Dalez
Dalez's Avatar
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's Avatar
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's Avatar
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's Avatar
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's Avatar
How do i make sendmail work on Windows XAMPP? Please i need to know ^^