Jump to content

lordphate

Members
  • Posts

    154
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lordphate's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Your right, the message was base64 encoded, so I used fwrite($fh,print_r(base64_decode($message),TRUE)); Your code works w00t Thanks!!
  2. I tried this, and sadly it didn't work I'm not sure why it's not working. For some reason it's just not picking it up
  3. Hi Everyone, I'm building a script to pull a URL from an email being read by a PHP script using php://stdin Currently I have the ability to check for email addresses (which works with no problems), and basic Regex stuff like : if(preg_match("/\b5.5.0\b/i",$message)) { ... and preg_match_all("/\bFrom [\w\.-]+@[\w\.-]+\.\w{2,4}\b/i",$headers,$emails); however when it comes down to retrieving a URL from the message I can't get past it if(preg_match('/https?\:\/\/[^\" ]+/i',$message,$url)) { Any ideas on what i'm doing wrong ? here is a sample email: Click the link below to fill out the request: https://words.morewords.domain.tld/word/addme?a=email@domain.tld&id=1n4Hlb4iO3Nl34g1 Thanks in advance!!
  4. I do not have sample records, I have NO access to the database. This is all through an API (which is out of my control as well). $approvedCondition = array( 'QueryText' => "SELECT * FROM ContactCustomProfileField WHERE ContactID NOT IN (SELECT ContactID FROM ContactCustomProfileField WHERE FieldID=4964744)", 'PageSize' => 1, 'PageNumber' => 1 ); $approvedRequest = new soapval('request', 'QueryRequest', $approvedCondition, false, 'tns'); $approvedParam = array('request' => $approvedRequest); $approvedResponse = $client->call('Query', array('parameters' => $approvedParam)); $approvedResult = $approvedResponse['QueryResult']; foreach ($approvedResult[Records][Record] as $approved){ $republicCondition = array( 'QueryTexxt' => "SELECT * FROM ContactCustomProfileField WHERE ContactID={$approved} AND FieldID=4953960 AND Value LIKE '%' ORDER BY DateUpdated DESC", 'PageSize' => 20, 'PageNumber' => $_GET["page"]+1 ); $republicRequest = new soapval('request', 'QueryRequest', $republicCondition, false, 'tns'); $republicParam = array('request' => $republicRequest); $republicResponse = $client->call('Query', array('parameters' => $republicParam)); $republicResult = $republicResponse[QueryResult][Records][Record]; print_r($republicResponse);exit; foreach($republicResult as $republican) { //---Get The Profile---// $profileCondition = array( 'QueryText' => "SELECT * FROM ContactProfile WHERE ContactID=$republican[ContactID]", 'PageSize' => 100, 'PageNumber' => 1 ); $profileRequest = new soapval('request', 'QueryRequest', $profileCondition, false, 'tns'); $profileParam = array('request' => $profileRequest); $profileResponse = $client->call('Query', array('parameters' => $profileParam)); $profile = $profileResponse["QueryResult"]["Records"]["Record"]; ... I even tried two separate queries
  5. Hi Everyone I'm having an issue where I am trying to retrieve only profiles that have not been approved. I cannot edit the DB, so I cannot rework that portion at all (otherwise i would have rebuilt the DB to begin with). The table is formed like: ContactID (int) FieldID (int) Value (string) DateUpdated (timestamp) ----- Here is my query: "SELECT * FROM ContactCustomProfileField WHERE ContactID NOT EXISTS (SELECT ContactID FROM ContactCustomProfileField WHERE FieldID=4964744) AND FieldID=4953960 AND Value LIKE '%' ORDER BY DateUpdated DESC"; I also tried: SELECT * FROM ContactCustomProfileField WHERE ContactID NOT IN (SELECT ContactID FROM ContactCustomProfileField WHERE FieldID=4964744) AND FieldID=4953960 AND Value LIKE '%' ORDER BY DateUpdated DESC FieldID 4964744 is the "Approved" field. It is only inserted during the approval process. Before the approval process that field (for that particular ContactID) is not in the database. Once approved or denied, a insertion is made that makes FieldID 4964744 for the ContactID with the Value of 'Approved' or 'Denied' Any Ideas ? Thanks!
  6. Maybe i could use this instead: include(DOC_ROOT."/themes/".$GLOBALS["THEME"]."/system/article_categories.inc.php"); while(list($key,$val) = each($categories)) { $category["name"] = $val; $category["id"] = $key $categories[] = $category; }//while
  7. Okay so i'm doing an articles script and i want just categories, and i want it file based [the categories] so i figured i'd do something like $categories[0] = "Category 1"; $categories[1] = "Category 2"; now for my main script can i do include(DOC_ROOT."/themes/".$GLOBALS["THEME"]."/system/article_categories.inc.php"); foreach($categories as $cat) { $category["name"] = $cat; $category["id"] = current($categories); } I know this may be a really easy question, but i've had like 2 hours of sleep this week AND getting married tomorrow lol...thanks guys ?
  8. Umm truthfully i have NO idea what you mean...i'm such a n00b at javascript
  9. Hey Guys, this also includes a bit of PHP, but i'm having issues with the javascript part: function module_categories(){ admin_validate(); $theme = $GLOBALS["Get"]->val("theme"); if(empty($theme)) $theme = $GLOBALS["THEME"]; $data["theme"] = $theme; $data["title_id"] = "38"; $data["module"] = $module; $data["modules"] = admin_get_modules(); $data["link"] = "index.php?section=cars_categories&theme=".$data["theme"]; $data["section"] = "setup"; $data["subsection"] = 4; include(DOC_ROOT."/themes/".$data["theme"]."/system/cars.inc.php"); $jscode = ""; while(list($key,$val) = each($categories)){ $jscode.= "HS_Categories[".$key."] = \"".hs_ereg_replace('"','\"',$val)."\";\n"; }//while while(list($key,$val) = each($subcategories)){ $jscode.= "HS_SubCategories[".$key."] = new Array;\n"; while(list($k,$v) = each($val)){ $jscode.= "HS_SubCategories[".$key."][".$k."] = \"".hs_ereg_replace('"','\"',$v)."\";\n"; }//while }//while while(list($key2,$val2) = each($subsubcategories)){ $jscode.= "HS_SubSubCategories[".$key2."] = new Array;\n"; while(list($k2,$v2) = each($val2)){ $jscode .= "HS_SubSubCategories[".$key2."][".$k2."] = new Array;\n"; while(list($k3,$v3) = each($v2)){ $jscode.= "HS_SubSubCategories[".$key2."][".$k2."][".$k3."] = \"".hs_ereg_replace('"','\"',$v3)."\";\n"; } }//while }//while $data["javascript"] = <<<JAVASCRIPTCODE <script language="JavaScript"> <!-- var HS_Categories = new Array; var HS_SubCategories = new Array; var HS_SubSubCategories = new Array; var Category = 0; var SubCategory = 0; var SubSubCategory = 0; function HS_InitCategories(){ $jscode }//HS_InitCategories function HS_PopulateSubCategoriesSimple(){ var FormHandler = document.classifieds_search; Category = FormHandler.category.options[FormHandler.category.selectedIndex].value; for(var i=FormHandler.subcategory.options.length-1; i>=0; i--){ FormHandler.subcategory.options[i] = null; }//for FormHandler.subcategory.options[0] = new Option("Please, select...","0"); var k=1; for(var Item in HS_SubCategories[Category]){ FormHandler.subcategory.options[k] = new Option(HS_SubCategories[Category][item],Item); k++; }//for }//HS_PopulateSubCategoriesSimple function HS_PopulateSubCategories(){ var FormHandler = document.cls_categories; Category = FormHandler.categories.options[FormHandler.categories.selectedIndex].value; for(var i=FormHandler.subcategories.options.length-1; i>=0; i--){ FormHandler.subcategories.options[i] = null; }//for var k=0; for(var Item in HS_SubCategories[Category]){ if(HS_SubCategories[Category][item] != "EMPTY"){ FormHandler.subcategories.options[k] = new Option(HS_SubCategories[Category][item],Item); k++; }//if }//for FormHandler.edit_category.value = HS_Categories[Category]; FormHandler.edit_subcategory.value = ""; HS_SubCategory = 0; }//HS_PopulateSubCategories function HS_EditSubCategory(){ if(Category){ var FormHandler = document.cls_categories; SubCategory = FormHandler.subcategories.options[FormHandler.subcategories.selectedIndex].value; FormHandler.edit_subcategory.value = HS_SubCategories[Category][subCategory]; }//if }//HS_EditSubCategory function HS_PopulateSubSubCategoriesSimple(){ var FormHandler = document.classifieds_search; Category = FormHandler.category.options[FormHandler.category.selectedIndex].value; SubCategory = FormHandler.subcategory.options[FormHandler.subcategory.selectedIndex].value; for(var i=FormHandler.subsubcategory.options.length-1; i>=0; i--){ FormHandler.subsubcategory.options[i] = null; }//for FormHandler.subsubcategory.options[0] = new Option("Please, select...","0"); var k=1; for(var Item in HS_SubSubCategories[Category][subCategory]){ FormHandler.subsubcategory.options[k] = new Option(HS_SubSubCategories[Category][subCategory][item],Item); k++; }//for }//HS_PopulateSubSubCategoriesSimple function HS_PopulateSubSubCategories(){ var FormHandler = document.cls_categories; Category = FormHandler.categories.options[FormHandler.categories.selectedIndex].value; SubCategory = FormHandler.subcategories.options[FormHandler.subcategories.selectedIndex].value; for(var i=FormHandler.subsubcategories.options.length-1; i>=0; i--){ FormHandler.subsubcategories.options[i] = null; }//for var k=0; for(var Item in HS_SubSubCategories[Category][subCategory]){ if(HS_SubSubCategories[Category][subCategory][item] != "EMPTY"){ FormHandler.subsubcategories.options[k] = new Option(HS_SubSubCategories[Category][subCategory][item],Item); k++; }//if }//for FormHandler.edit_category.value = HS_Categories[Category]; FormHandler.edit_subcategory.value = HS_SubCategories[Category][subCategory]; FormHandler.edit_subsubcategory.value = ""; HS_SubSubCategory = 0; }//HS_PopulateSubSubCategories function HS_EditSubSubCategory(){ if(SubCategory){ var FormHandler = document.cls_categories; SubSubCategory = FormHandler.subsubcategories.options[FormHandler.subsubcategories.selectedIndex].value; FormHandler.edit_subsubcategory.value = HS_SubSubCategories[Category][subCategory][subSubCategory]; }//if }//HS_EditSubCategory function HS_AddCategory(){ var FormHandler = document.cls_categories; var CategoryName = FormHandler.new_category.value; var CatID = HS_Categories.length+1; HS_Categories[CatID] = CategoryName; HS_SubCategories[CatID] = new Array; FormHandler.categories.options[FormHandler.categories.options.length] = new Option(CategoryName,CatID); FormHandler.new_category.value = ""; }//HS_AddCategory function HS_AddSubCategory(){ if(Category){ var FormHandler = document.cls_categories; var SubCategoryName = FormHandler.new_subcategory.value; var SubCatID = HS_SubCategories[Category].length+1; HS_SubCategories[Category][subCatID] = SubCategoryName; FormHandler.subcategories.options[FormHandler.subcategories.options.length] = new Option(SubCategoryName,SubCatID); FormHandler.new_subcategory.value = ""; }//if }//HS_AddSubCategory function HS_AddSubSubCategory(){ if(SubCategory){ var FormHandler = document.cls_categories; var SubSubCategoryName = FormHandler.new_subsubcategory.value; var SubSubCatID = HS_SubSubCategories[Category][subCategory].length+1; HS_SubSubCategories[Category][subCategory][subSubCatID] = SubSubCategoryName; FormHandler.subsubcategories.options[FormHandler.subsubcategories.options.length] = new Option(SubSubCategoryName,SubSubCatID); FormHandler.new_subsubcategory.value = ""; }//if }//HS_AddSubCategory function HS_UpdateCategory(){ if(Category){ var FormHandler = document.cls_categories; var CategoryName = FormHandler.edit_category.value; HS_Categories[Category] = CategoryName; var Selected = FormHandler.categories.selectedIndex; FormHandler.categories.options[selected] = new Option(CategoryName,Category); FormHandler.categories.selectedIndex = Selected; }//if }//HS_UpdateCategory function HS_UpdateSubCategory(){ if(Category && SubCategory){ var FormHandler = document.cls_categories; var SubCategoryName = FormHandler.edit_subcategory.value; HS_SubCategories[Category][subCategory] = SubCategoryName; var Selected = FormHandler.subcategories.selectedIndex; FormHandler.subcategories.options[selected] = new Option(SubCategoryName,SubCategory); FormHandler.subcategories.selectedIndex = Selected; }//if }//HS_UpdateSubCategory function HS_UpdateSubSubCategory(){ if(Category && SubCategory && SubSubCategory){ var FormHandler = document.cls_categories; var SubSubCategoryName = FormHandler.edit_subsubcategory.value; HS_SubSubCategories[Category][subCategory][subSubCategory] = SubSubCategoryName; var Selected = FormHandler.subsubcategories.selectedIndex; FormHandler.subsubcategories.options[selected] = new Option(SubSubCategoryName,SubSubCategory); FormHandler.subsubcategories.selectedIndex = Selected; }//if }//HS_UpdateSubCategory function HS_DeleteCategory(){ if(Category){ var FormHandler = document.cls_categories; HS_Categories[Category] = "EMPTY"; FormHandler.categories.options[FormHandler.categories.selectedIndex] = null; FormHandler.edit_category.value = ""; FormHandler.edit_subcategory.value = ""; Category = 0; SubCategory = 0; for(var i=FormHandler.subcategories.options.length; i>=0; i--){ FormHandler.subcategories.options[i] = null; }//for }//if }//HS_DeleteCategory function HS_DeleteSubCategory(){ if(Category && SubCategory){ var FormHandler = document.cls_categories; HS_SubCategories[Category][subCategory] = "EMPTY"; FormHandler.subcategories.options[FormHandler.subcategories.selectedIndex] = null; FormHandler.edit_subcategory.value = ""; SubCategory = 0; }//if }//HS_DeleteSubCategory function HS_DeleteSubSubCategory(){ if(Category && SubCategory && SubSubCategory){ var FormHandler = document.cls_categories; HS_SubSubCategories[Category][subCategory][subSubCategory] = "EMPTY"; FormHandler.subsubcategories.options[FormHandler.subsubcategories.selectedIndex] = null; FormHandler.edit_subsubcategory.value = ""; SubSubCategory = 0; }//if }//HS_DeleteSubCategory function HS_UpdateData(){ var CatsLine = ""; var SubCatsLine = ""; var SubSubCatsLine = ""; var TotalCats = 0; var Rules = new Array(); var Error = 0; var FormHandler = document.cls_categories; for(var Item in HS_Categories){ if(HS_Categories[item] != "EMPTY"){ CatsLine+= Item+"|"+HS_Categories[item]+"==|=="; Rules[item] = 0; TotalCats++; for(var SubItem in HS_SubCategories[item]){ SubCatsLine+= Item+"|"+SubItem+"|"+HS_SubCategories[item][subItem]+"==|=="; if(HS_SubCategories[item][subItem] != "EMPTY") Rules[item] = 0; }//for for(var SubSubItem in HS_SubSubCategories[item][subItem]){ SubSubCatsLine+= Item+"|"+SubItem+"|"+SubSubItem+"|"+HS_SubSubCategories[item][subItem][subSubItem]+"==|=="; if(HS_SubSubCategories[subItem][subSubItem] != "EMPTY") Rules[subItem] = 0; }//for }//if else{ for(var SubItem in HS_SubCategories[item]){ SubCatsLine+= Item+"|"+SubItem+"|EMPTY==|=="; }//for for(var SubSubItem in HS_SubSubCategories[item]){ SubSubCatsLine+= Item+"|"+SubSubItem+"|EMPTY==|=="; }//for }//else }//for for(var Rule in Rules){ if(Rules[Rule] == 0){ Error = 1; }//if }//for if(TotalCats == 0) Error = 2; FormHandler.res_categories.value = CatsLine; FormHandler.res_subcategories.value = SubCatsLine; FormHandler.res_subsubcategories.value = SubSubCatsLine; FormHandler.submit(); }//HS_UpdateData //--> </script> JAVASCRIPTCODE; $data["onload"] = "HS_InitCategories();"; $data["categories"] = $categories; $data["subcategories"] = $subcategories; $data["subsubcategories"] = $subsubcategories; $layout[0] = "cars_categories"; admin_output($layout,$data); }//module_categories the error i'm getting is: Error: HS_SubSubCategories[item] is undefined at this area for(var SubSubItem in HS_SubSubCategories[item][subItem]){ SubSubCatsLine+= Item+"|"+SubItem+"|"+SubSubItem+"|"+HS_SubSubCategories[item][subItem][subSubItem]+"==|=="; if(HS_SubSubCategories[subItem][subSubItem] != "EMPTY") Rules[subItem] = 0; }//for Any one have any clue
  10. Hey Everyone I'm looking for some advice about how to go about doing a facebook-like photo captions, they use a single form [from what i can tell] and allow you to add captions to a maximum of 60 photos [i think this is just a set limit for them, never could upload more than 60 in a single album]. http://www.arshem.net/facebook-captions.jpg -- WARNING BIG IMAGE 800k How would you go about making the form for that ? Here's what i was THINKING, but not sure FORM CODE $form = ' <form name="photo_caption" action="index.php" method="post"> <input type="hidden" name="handler" value="gallery"> <input type="hidden" name="action" value="edit_caption"> foreach($photos as $photo) { $form .= '<textarea cols=40 rows=4 name="caption[]" id="'.$photo["pho_id"].'">'; } $form .= '<input type="submit" value="Edit Captions">'; echo $form; think that will work so far ? [$photos will be a variable set after the photos are uploaded] Here is the php [and yes i'm not double checking my code, i'll recheck when i'm actually coding it for my site]. foreach($_POST["caption"] as $caption) { mysql_query("UPDATE gallery SET caption='".$caption."',update='".time()."' WHERE pho_id='".$_POST["pho_id"]); }//foreach I have a feeling i can't do $_POST["pho_id"]..what could i use instead ? Thanks! Brandon
  11. Hey everyone, I had a quick question, what would be the best way to implode dynamically generated textfields [generated through ajax]. The dynamic textfield would have a "name"+ count <input type="textfield" name="textfield0"... Basically i'm wanting to implode each "textfield#" seperated by || or something close to that. I was thinking a foreach ? But then i can't figure out how to get the number of textfields Any help would be appreciated [bTW i'm not looking for the actual answer, just a suggestion on how to go about doing this, i'm trying to learn ajax, and it's through me for a loop ]
  12. Hey Always <script type="text/javascript"> var http = false; if(navigator.appName == "Microsoft Internet Explorer") { http = new ActiveXObject("Microsoft.XMLHTTP"); } else { http = new XMLHttpRequest(); } function replace() { http.open("GET", "hello.html", true); http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('pageone').innerHTML = http.responseText; } } http.send(null); } function replace2() { http.open("GET", "statistics.html", true); http.onreadystatechange=function() { if(http.readyState == 4) { document.getElementById('pageone').innerHTML = http.responseText; } } http.send(null); } </script></head> <body> <p><a href="javascript:replace()">page one</a></p> <p><a href="javascript:replace2()">page one</a></p> <div id="pageone"> Hello, world! </div> </body>
  13. Hey Kane, If you are using a CMS, then you may have some issues with the "pre-existing" code, however not all CMS's are a PITA Basically you would need to edit the form, when you have a <textarea> box you would need to assign an ID to it, for example <textarea id="box1" name="box1"> you could then use ajax to use getelementbyid('box1') or something similar to find the box that you need to "submit without refreshing". You will need more than just an id and the 1 piece of code i've given you, i suggest looking at http://www.malsup.com/jquery/form/ they are not using the "id" in the <form> tag. I hope this helps Remember to mark it Solved if it does
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.