📄 account.php
字号:
if($adTitle != "") { for($i=1;$i<=5;$i++) { $thumb = getThumb(${"adImage".$i}); $image = ${"adImage".$i}; $small = str_replace(".jpg","_small.jpg",$image); @unlink("{$insPath}images/listings/$thumb"); @unlink("{$insPath}images/listings/$image"); @unlink("{$insPath}images/listings/$small"); } $result = query("DELETE FROM {$class_prefix}ads WHERE ad_id=$adID",$class_link); $displayTitle = $Languages['account']['addeletehead']; $displayData = $Languages['account']['addeleteconf']; } else { $displayData = $Languages['account']['noownership']; } updateCounts(); updateRSS(); break; case "add": $displayTitle = $Languages['account']['menupost']; //Which step are we on switch($step) { case "1": //Choose ad type $adCategory = intval(protect($adCategory)); $result = query("SELECT category_ad_types FROM {$class_prefix}categories WHERE category_id=$adCategory",$class_link); list($catAdTypes) = mysql_fetch_row($result); $catArray = explode(",",$catAdTypes); while(list(,$val) = each($catArray)) { if($val != "") { $typeList .= "<option value=\"$val\">{$adTypes[$val]}</option>"; } } $displayData =<<<ENDDATA <table width="100%" border="0" cellspacing="1" cellpadding="3"> <form method="post" action="account.php" onReset="javascript:history.go(-1);"> <input type="hidden" name="action" value="add"> <input type="hidden" name="adCategory" value="$adCategory"> <input type="hidden" name="step" value="2"> <tr> <td align="center"> {$Languages['account']['addwhichcat']}<br> <select name="adType">$typeList</select><br> <input type="submit" value="{$Languages['account']['process']}"> </td> </tr> </form> </table>ENDDATA; break; case "2": //Collect ad data $adCategory = intval(protect($adCategory)); $adType = intval(protect($adType)); //Get ad definition $result = query("SELECT type_required,type_use,option1,def_option1,option2,def_option2,option3,def_option3,option4,def_option4,option5,def_option5,option6,def_option6,option7,def_option7,option8,def_option8,option9,def_option9,option10,def_option10 FROM {$class_prefix}ad_types WHERE type_id=$adType",$class_link); list($typeRequired,$typeUse,$typeOption1,$typeOption1Def,$typeOption2,$typeOption2Def,$typeOption3,$typeOption3Def,$typeOption4,$typeOption4Def,$typeOption5,$typeOption5Def,$typeOption6,$typeOption6Def,$typeOption7,$typeOption7Def,$typeOption8,$typeOption8Def,$typeOption9,$typeOption9Def,$typeOption10,$typeOption10Def) = mysql_fetch_row($result); //Get category definition $result = query("SELECT category_optional_1,category_optional_1_def,category_optional_2,category_optional_2_def,category_optional_3,category_optional_3_def,category_optional_4,category_optional_4_def,category_optional_5,category_optional_5_def FROM {$class_prefix}categories WHERE category_id=$adCategory",$class_link); list($catOption1,$catOption1Def,$catOption2,$catOption2Def,$catOption3,$catOption3Def,$catOption4,$catOption4Def,$catOption5,$catOption5Def) = mysql_fetch_row($result); $catOption1 = stripslashes($catOption1); $catOption1Def = stripslashes($catOption1Def); $catOption2 = stripslashes($catOption2); $catOption2Def = stripslashes($catOption2Def); $catOption3 = stripslashes($catOption3); $catOption3Def = stripslashes($catOption3Def); $catOption4 = stripslashes($catOption4); $catOption4Def = stripslashes($catOption4Def); $catOption5 = stripslashes($catOption5); $catOption5Def = stripslashes($catOption5Def); $typeOption1 = stripslashes($typeOption1); $typeOption1Def = stripslashes($typeOption1Def); $typeOption2 = stripslashes($typeOption2); $typeOption2Def = stripslashes($typeOption2Def); $typeOption3 = stripslashes($typeOption3); $typeOption3Def = stripslashes($typeOption3Def); $typeOption4 = stripslashes($typeOption4); $typeOption4Def = stripslashes($typeOption4Def); $typeOption5 = stripslashes($typeOption5); $typeOption5Def = stripslashes($typeOption5Def); $typeOption6 = stripslashes($typeOption6); $typeOption6Def = stripslashes($typeOption6Def); $typeOption7 = stripslashes($typeOption7); $typeOption7Def = stripslashes($typeOption7Def); $typeOption8 = stripslashes($typeOption8); $typeOption8Def = stripslashes($typeOption8Def); $typeOption9 = stripslashes($typeOption9); $typeOption9Def = stripslashes($typeOption9Def); $typeOption10 = stripslashes($typeOption10); $typeOption10Def = stripslashes($typeOption10Def); //Setup ad fields $adDef .=<<<ENDITEM <tr> <td>{$Languages['account']['adsscreentitle']}: <input type="text" name="newTitle" value="$adTitle" style="width:350px;"></td> </tr>ENDITEM; if(($typeUse & 2) != 0) { for($i=1;$i<=count($Languages['global']['condition'])-1;$i++) { $condList .= "<option value=\"$i\">{$Languages['global']['condition'][$i]}</option>"; } $adDef .=<<<ENDITEM <tr> <td>{$Languages['account']['adsscreencond']}: <select name="newCondition"><option></option>$condList</select></td> </tr>ENDITEM; if(($typeRequired & 2) != 0) { $adJava .=<<<ENDJAVA if(form.newCondition.selectedIndex == 0) { alert("{$Languages['account']['adderror1']}"); return false; }ENDJAVA; } } if(($typeUse & 4) != 0) { $adDef .=<<<ENDITEM <tr> <td>{$Languages['account']['adsscreenprice']}: <input type="text" name="newPrice" value="$adPrice"></td> </tr>ENDITEM; if(($typeRequired & 4) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newPrice.value) == "") { alert("{$Languages['account']['adderror2']}"); return false; }ENDJAVA; } } if(($typeUse & 8) != 0) { $adDef .=<<<ENDITEM <tr> <td> {$Languages['account']['adsscreendesc']}:<br> <textarea name="newDesc" style="width:400px; height:200px;">$adDescription</textarea> </td> </tr>ENDITEM; if(($typeRequired & 8) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newDesc.value) == "") { alert("{$Languages['account']['adderror3']}"); return false; }ENDJAVA; } } if(($typeUse & 16) != 0) { $adDef .=<<<ENDITEM <tr> <td>{$Languages['account']['adsscreencity']}: <input type="text" name="newCity" value="$adCity"></td> </tr>ENDITEM; if(($typeRequired & 16) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newCity.value) == "") { alert("{$Languages['account']['adderror4']}"); return false; }ENDJAVA; } } if(($typeUse & 32) != 0) { $adDef .=<<<ENDITEM <tr> <td>{$Languages['account']['adsscreenstate']}: <input type="text" name="newState" value="$adState"></td> </tr>ENDITEM; if(($typeRequired & 32) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newState.value) == "") { alert("{$Languages['account']['adderror5']}"); return false; }ENDJAVA; } } if(($typeUse & 64) != 0) { $adDef .=<<<ENDITEM <tr> <td>{$Languages['account']['adsscreenpostal']}: <input type="text" name="newPostal" value="$adPostal"></td> </tr>ENDITEM; if(($typeRequired & 64) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newPostal.value) == "") { alert("{$Languages['account']['adderror6']}"); return false; }ENDJAVA; } } if(($typeUse & 128) != 0) { $adDef .=<<<ENDITEM <tr> <td>{$Languages['account']['adsscreencountry']}: <input type="text" name="newCountry" value="$adCountry"></td> </tr>ENDITEM; if(($typeRequired & 128) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newCountry.value) == "") { alert("{$Languages['account']['adderror7']}"); return false; }ENDJAVA; } } //Loop through custom ad type fields $type = 1; for($i=512;$i<=262144;$i=$i*2) { if(($typeUse & $i) != 0) { $customTitle = ${"typeOption".$type}; $customFieldData = explode("|",${"typeOption".$type."Def"}); unset($value); $value = $customFieldData[2]; switch($customFieldData[0]) { case 1: //Standard input $adDef .=<<<ENDPRINT <tr> <td>$customTitle: <input type="text" name="newTypeOptional{$type}"></td> </tr>ENDPRINT; if(($typeRequired & $i) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newTypeOptional{$type}.value) == "") { alert("{$Languages['account']['adderror8']} $customTitle"); return false; }ENDJAVA; } break; case 2: //Textarea input $adDef .=<<<ENDPRINT <tr> <td>$customTitle:<br><textarea name="newTypeOptional{$type}"></textarea></td> </tr>ENDPRINT; if(($typeRequired & $i) != 0) { $adJava .=<<<ENDJAVA if(trim(form.newTypeOptional{$type}.value) == "") { alert("{$Languages['account']['adderror8']} $customTitle"); return false; }ENDJAVA; } break; case 3: //Select $options = ""; for($ii=1;$ii<=$customFieldData[1];$ii++) { $displayOption = stripslashes($customFieldData[$ii + 2]); if($ii == $value) { $options .= "<option value=\"$ii\" selected>$displayOption</option>"; } else { $options .= "<option value=\"$ii\">$displayOption</option>"; } } $adDef .=<<<ENDPRINT <tr> <td>$customTitle: <select name="newTypeOptional{$type}"><option></option>$options</select></td> </tr>ENDPRINT; if(($typeRequired & $i) != 0) { $adJava .=<<<ENDJAVA if(form.newTypeOptional{$type}.selectedIndex == 0) { alert("{$Languages['account']['adderror9']} $customTitle"); return false; }ENDJAVA; } break; case 4: //Radio buttons $buttons = ""; for($ii=1;$ii<=$customFieldData[1];$ii++) { $displayOption = stripslashes($customFieldData[$ii + 2]); if($ii == $value) { $buttons .= "<input type=\"radio\" name=\"newTypeOptional{$type}\" value=\"$ii\" checked>$displayOption "; } else { $buttons .= "<input type=\"radio\" name=\"newTypeOptional{$type}\" value=\"$ii\">$displayOption "; } } $adDef .=<<<ENDPRINT <tr> <td>$customTitle: $buttons</td> </tr>ENDPRINT; if(($typeRequired & $i) != 0) { $adJava .=<<<ENDJAVA if(form.newTypeOptional{$type}.selectedIndex == 0) { alert("{$Languages['account']['adderror9']} $customTitle"); return false; }ENDJAVA; } break; case 5: //Checkbox $checkBoxes = ""; $check = explode(",",$value); for($ii=1;$ii<=$customFieldData[1];$ii++) { $displayOption = stripslashes($customFieldData[$ii + 2]); if(in_array($ii,$check)) { $checkBoxes .= "<input name=\"newTypeOptional{$type}[]\" type=\"checkbox\" value=\"$ii\" checked>$displayOption</input> "; } else { $checkBoxes .= "<input name=\"newTypeOptional{$type}[]\" type=\"checkbox\" value=\"$ii\">$displayOption</input> "; } } $adDef .=<<<ENDPRINT <tr> <td>$customTitle: $checkBoxes</td> </tr>ENDPRINT; if(($typeRequired & $i) != 0) { $adJava .=<<<ENDJAVA var retVal = false; var chks = document.addForm.elements['newTypeOptional{$type}[]']; for (var i=0;i<chks.length;i++){ if (chks[i].checked){ retVal = true; break; } } if(retVal != true) { alert ("{$Languages['account']['adderror9']} $customTitle"); return false; }ENDJAVA; } break; } } $type++; } //Loop through category fields for($i=1;$i<=5;$i++) { $customTitle = ${"catOption".$i}; unset($value); $value = $customFieldData[2]; $customFieldData = explode("|",${"catOption".$i."Def"});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -