HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=18)
-   -   Anti Spam Forms (http://www.howtoforge.com/forums/showthread.php?t=12021)

alexillsley 11th April 2007 13:44

Anti Spam Forms
 
Hi,
Im trying to make a form which submits isp_kunde/edit.php to update the spam filter however for some reason my form doent work:confused:

Heres the normal form:
Code:

<form action="edit.php" onsubmit="return checkform(this)" method="post" name="myform" target="">
  <table width="100%" border="0" cellspacing="0" cellpadding="10">
              <tr>
                <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                     
            <td></td>
                    </tr>
                   
                    <tr>
                     
            <td><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td rowspan="3" height="16" width="6" bgcolor="#CCCCCC"><img src="../../design/default/tab/tab_active_l.gif" width="6" height="16"></td>
              <td height="1" bgcolor="#E4E4E4"><img src="../../design/default/tab/x.gif" width="1" height="1"></td>
              <td rowspan="3" width="6" bgcolor="#CCCCCC"><img src="../../design/default/tab/tab_active_r.gif" width="6" height="16"></td>
                  <td rowspan="3" height="16" width="6" bgcolor="#CCCCCC"><img src="../../design/default/tab/tab_active_l.gif" width="6" height="16"></td>
              <td height="1" bgcolor="#E4E4E4"><img src="../../design/default/tab/x.gif" width="1" height="1"></td>
              <td rowspan="3" width="6" bgcolor="#CCCCCC"><img src="../../design/default/tab/tab_active_r.gif" width="6" height="16"></td>
                  <td rowspan="3" height="16" width="6" bgcolor="#EEEEEE"><img src="../../design/default/tab/tab_active_l.gif" width="6" height="16"></td>
              <td height="1" bgcolor="#E4E4E4"><img src="../../design/default/tab/x.gif" width="1" height="1"></td>
              <td rowspan="3" width="6" bgcolor="#EEEEEE"><img src="../../design/default/tab/tab_active_r.gif" width="6" height="16"></td>
                 
                  <td><img src="../../design/default/tab/x.gif" width="1" height="1"></td>
                </tr>
                <tr>
                  <td height="14" bgcolor="#CCCCCC">
                    <div align="center"><a href="javascript:changeDeck(0)" class="link8"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">User & Email</font></a></div>
                  </td><td height="14" bgcolor="#CCCCCC">
                    <div align="center"><a href="javascript:changeDeck(1)" class="link8"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Advanced Settings</font></a></div>
                  </td><td height="14" bgcolor="#EEEEEE">
                    <div align="center"><a href="javascript:changeDeck(2)" class="link8"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Spamfilter & Antivirus</font></a></div>
                  </td>
                  <td height="14"><img src="../../design/default/tab/x.gif" width="1" height="1"></td>
                </tr>
              </table></td>
                    </tr>
                    <tr>
                      <td bgcolor="#E0E0E0">
                        <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#E0E0E0">
                          <tr>
                            <td bgcolor="#EEEEEE">
                              <table width="100%" border="0" cellspacing="0" cellpadding="2">
                                <tr>
                                  <td width="23%">&nbsp;</td>
                                  <td width="77%">&nbsp;</td>
                                </tr>
                                <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Spamfilter:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><input type="checkbox" name="form[user_spamfilter]" value="1" ></td><td class="normal" valign="top"> <a href="#" onClick="javascript:window.open('https://server1.*********:81/multidoc/help/index.php?doctype_id=1014&deck_id=2&element_id=0','hlp','width=300,height=300');"><img src="../../design/default/icons/help14.gif" border="0" height="16" width="14" /></a></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Antivirus:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><input type="checkbox" name="form[antivirus]" value="1" ></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Spam Strategy:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><select name="form[spam_strategy]"  ><option value="accept" SELECTED>accept</option><option value="discard">discard</option></select></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Spam Hits:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><input type="text" name="form[spam_hits]" size="10" maxlength="255" value="5.0" class="text"></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
            <td colspan="2" class=""><hr noshade size="1"></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Rewrite Subject:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><input type="checkbox" name="form[spam_rewrite_subject]" value="1" ></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Subject:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><input type="text" name="form[spam_subject_tag]" size="30" maxlength="255" value="***SPAM***" class="text"></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
            <td colspan="2" class=""><hr noshade size="1"></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Use Uribl:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><input type="checkbox" name="form[use_uribl]" value="1" ></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Spam Whitelist:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><textarea name="form[spam_whitelist]" cols="30" rows="10"></textarea></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
            <td colspan="2" align="center"><table width="95%"><tr><td class="t2" align="left">spam_whitelist_txt</td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
        <td width="31%" class="normal" valign="middle"><nobr><b>&nbsp; Spam Blacklist:</b></nobr></td>
        <td width="69%" class="normal" valign="top"><table><tr><td class="normal" valign="top"><textarea name="form[spam_blacklist]" cols="30" rows="10"></textarea></td><td class="normal" valign="top"></td></tr></table></td>
        </tr>
        <tr bgcolor="#EEEEEE">
            <td colspan="2" align="center"><table width="95%"><tr><td class="t2" align="left">spam_blacklist_txt</td></tr></table></td>
        </tr>
       
                                <tr>
                                  <td width="23%">&nbsp;</td>
                                  <td width="77%">&nbsp;</td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td height="46">
                        <div align="center">
                <input type="submit" name="speichern" value=" Save " class="button">
                &nbsp;&nbsp; <input type="submit" name="abbrechen" value=" Cancel " class="button" onClick="window.location.href = '../frame_start.php?';return false;">
                &nbsp;&nbsp;&nbsp;<input type="submit" name="abbrechen" value=" Delete " class="button" onClick="window.location.href = 'delete.php?tree_id=27&';return false;" target="_top">
              </div>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
  <input type="hidden" name="s" value="********">
  <input type="hidden" name="gid_old" value="1">
  <input type="hidden" name="doctype_id" value="1014">
  <input type="hidden" name="next_type" value="">
  <input type="hidden" name="tree_id" value="27">
  <input type="hidden" name="doc_id" value="8">
  <input type="hidden" name="deck_id" value="2">
  <input type="hidden" name="next_deck_id" value="2">
  <input type="hidden" name="next_doctype_id" value="1013">
  <input type="hidden" name="next_tree_id" value="25">
  <input type="hidden" name="caller_tree_id" value="25">
  <input type="hidden" name="fertig" value="1">
</form>


alexillsley 11th April 2007 13:45

And heres my form

Code:

<form action="edit.php?s=************" method="POST">

<tr><td><b>Anti virus: </b></td>
<td><input type="checkbox" name="form[antivirus]" ></td></tr>


<tr><td><b>Spam Filter: </b></td>
<td><input type="checkbox" name="form[user_spamfilter]" ></td></tr>

<tr><td><b>Spam Strategy: </b></td>
<td><select name="form[spam_strategy]"  ><option value="accept" selected>accept</option>
<option value="discard" >discard</option></select></td></tr>

<tr><td><b>Spam Hits: </b></td>
<td><input type="text" name="form[spam_hits]" size="10" maxlength="255" value="5.0" class="text"></td></tr>

<tr><td><br></br></td></tr>

<tr><td><b>Rewrite Subject: </b></td>
<td><input type="checkbox" name="form[spam_rewrite_subject]"  >

</td>

<tr><td><b>Subject: </b></td>
<td><input type="text" name="form[spam_subject_tag]" size="30" maxlength="255" value="***SPAM***" class="text"></td></tr>

<tr><td><br></br></td></tr>

<tr><td><b>Use URIBL: </b></td>
<td><input type="checkbox" name="form[use_uribl]"  ></td></tr>


<tr><td><b>Spam White List: </b></td>
<td><textarea name="form[spam_whitelist]" cols="30" rows="10"></textarea></td></tr>


<tr><td><b>Spam Blacklist: </b></td>
<td><textarea name="form[spam_blacklist]" cols="30" rows="10"></textarea></td></tr>

<input type="hidden" name="tree_id" value="27">
<input type="hidden" name="doc_id" value="8" >
<input type="hidden" name="next_tree_id" value="25">
<input type="hidden" name="caller_tree_id" value="25">

<input type="hidden" name="gid_old" value="1">
<input type="hidden" name="doctype_id" value="1014">
<input type="hidden" name="next_type" value="">
<input type="hidden" name="deck_id" value="2">
<input type="hidden" name="next_deck_id" value="2">
<input type="hidden" name="next_doctype_id" value="1013">
<input type="hidden" name="fertig" value="1">

<tr><td></td><td><input type="submit" value="Apply Settings"></td></tr>

</table>
</form>

Can you see whats wrong with myne?

All the check boxes dont save

Thanks,
Alex

falko 12th April 2007 16:42

You must change the form using the form editor under Management.

alexillsley 13th April 2007 22:13

I would like to make the form myself:)

till 13th April 2007 22:49

You can not use the ISPConfig scripts when you do not build the form with the form designer, you will have to write all scripts incl. mysql database handling manually.

alexillsley 14th April 2007 01:59

The form submits to the normal form that handles spam. I have included the nesserary files in that form . And for some reason it doesnt save the checkboxes only the text fields :confused:

falko 14th April 2007 14:19

I don't know how checkboxes are handled by ISPConfig now, but the problem is that a checkbox is submitted only if it is checked. For example, if a chackbox is checked, it would submit "1". Now you'd expect that it submits "0" if it isn't checked, but that's not the case; nothing gets submitted, as if the checkbox didn't exist.

A workaround would be to use a drop-down menu with the values "No" and "Yes" instead of checkboxes.

alexillsley 15th April 2007 20:40

Thanks but i got it working with check boxes :)


All times are GMT +2. The time now is 01:19.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.