PHP - Move Forward/backward In Array
Hello. I have built a web page that is a gallery of pictures populated using an array. Now I would like to create a new web page that shows an enlarged version of a given thumbnail from the gallery. It would be nice once someone loads a photo on the details page if they could simply navigate forward/backwards one photo, instead of having to go back to the gallery to choose the next picture. Had I designed things using a database, then I know how to do this, but alas, this is a simple solution. Is there an easy way to leverage the array that I created - which contains a listing of all file-names from my photo directory - and somehow use HTML/PHP to navigate forward/backward one photo? Here is the array that I build containing all photos from my directory...
<?php $path = "../WORKSPACE/images/"; $files = array(); // Check for Directory. if (is_dir($path)){ // Open Directory-Handle. $handle = opendir($path); if($handle){ // Iterate through Directory items. // Return name of next item in Directory (i.e. File or Folder). while(($file = readdir($handle)) !== FALSE){ if($file != '.' && $file != '..' && preg_match("#^[^\.].*$#", $file)){ // Not Directory, Not Hidden File // Add to array. $files[] = $file; // Simple array. } } closedir($handle); } } var_dump($files); exit(); ?>
Thanks!
Similar TutorialsI have an array with 192 items in it (0-191) and I want to rearrange them into a multidimensional array with 24 sets of 8. If I wasn't very clear there, here's an abbreviated version of what I want: $arr1 = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23); $arr2 = array(array(0, 1, 2, 3, 4, 5, 6, 7), array(8, 9, 10, 11, 12, 13, 14, 15), array(16, 17, 18, 19, 20, 21, 22, 23)); Thank you in advance! Hello, I am trying to get a list of elements from my Database and I need to save it in a JavaScript array. Here is what I've been trying to do. Code: [Select] mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $query="SELECT idCountries, Country_Name FROM countries order by Country_Name "; $result = mysql_query ($query); $x=1; echo "<script type='text/javascript'>"; echo "var SelAry=[];"; echo "SelAry[0] = ['select', '0'];"; while($nt=mysql_fetch_array($result)) { echo "SelAry[$x]=['$nt[idCountries]', '$nt[Country_Name]']; "; $x++; } echo "</script>"; I am open to any suggestion. Thank you in advance. hello, i have a code that downloads a file....i want it to forward the user to a newurl.com when they click download here is my code header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file exit(); i want that code to forward to /index.php Hi, My site was recently "hacked" in the sense that Google was made to crawl a rogue page and came to believe it was the original site. This caused a catastrophic decline in Google position and decline in traffic. In researching the issue, it seemed that the solution was to install a forward-confirmed reverse DNS on the site. Yet I've found little information on how to actually implement this. I'm working on a code example I found, but I'm unsure exactly how to apply this even assuming I can get it to work. For those interested in this issue the original site is www.tickerfind.com , the duplicate site is www.handj.net. If you Google "tickerfind.com" you can get the cache, and from this you can see that Google thinks the site is found at handj.net. One of the puzzling things about the sample code (http://smbrown.wordpress.com/2009/04/29/verify-googlebot-forward-reverse-dns/) is that it appears to be determining whether the bot is "good" or "bad", yet I thought the issue was not the bot itself but where it was retrieving the pages to scan. Somehow I thought it would be a "prevention of redirection" type code. So first, I suppose my question is: Am I on the right track. And if so then I can dig into the code. But I'd certainly need to understand why it works. Thanks, Jeff Hi, I created a form and the trying to forward it to testphp.php. However, it is forwarding but not displaying the score according to the drop down test. If I set any of drop down option to No, then 10 must minus from the total. However, the output is always zero irrespective of the input. Code: [Select] <html> <head> <title>Billing IE</title> </head> <body > <form id="audit_billing_IE" name="audit_billing_IE" method="post" action="testphp.php"> <table> <tr> <td background-color="green"> Evaluator Name </td> <td> <input type="text" name=evaluator_name id="evaluator_name"/> </td> </tr> <tr> <td> Agent Name </td> <td> <input type="text" name=user_name id="user_name"/> </td> </tr> <tr> <td> Processing Date </td> <td> <input type="text" name="processing_date" id="processing_date"/> </td> </tr> <tr> <td> Review Date </td> <td colspan="3"> <input type="text" name="review_date" id="review_date"/> </td> </tr> <tr> <td> Contact ID </td> <td colspan='3'> <input type="text" name=contact_ID id="contact_ID"/> </td> </tr> <tr> <td> Voice/Non Voice </td> <td colspan='3'> <input type="text" name=audit_type id="audit_type"/> </td> </tr> <tr> <td> A/C #/Case # </td> <td colspan='3'> <input type="text" name=case_no id="case_no"/> </td> </tr> <tr> <td> Product </td> <td colspan='3'> <input type="text" name=product_name1 id="product_name"/> </td> </tr> <tr> <td> Call duration</td> <td colspan='3'> <input type="text" name=product_name2 id="product_name"/> </td> </tr> <tr> <td> Errors </td> <td colspan='3'> <input type="text" name=product_name3 id="product_name"/> </td> </tr> <tr> <td> Parameter A </td> <td colspan='3'> <input type="text" name=product_name4 id="product_name"/> </td> </tr> <tr> <td> Parameter B </td> <td colspan='3'> <input type="text" name=product_name5 id="product_name"/> </td> </tr> <tr> <td> Parameter C </td> <td colspan='3'> <input type="text" name=product_name6 id="product_name"/> </td> </tr> <tr> <td> Parameter D </td> <td colspan='3'> <input type="text" name=product_name7 id="product_name"/> </td> </tr> <tr> <td> Parameter E </td> <td colspan='3'> <input type="text" name=product_name8 id="product_name"/> </td> </tr> <tr> <td> Parameter F </td> <td colspan='3'> <input type="text" name=product_name9 id="product_name"/> </td> </tr> <tr> <td> Parameter G </td> <td colspan='3'> <input type="text" name=product_name10 id="product_name"/> </td> </tr> <tr> <td> Parameter H </td> <td colspan='3'> <input type="text" name=product_name11 id="product_name"/> </td> </tr> <tr> <td> Parameter I </td> <td colspan='3'> <input type="text" name=product_name12 id="product_name"/> </td> </tr> <tr> <td> Parameter J </td> <td colspan='3'> <input type="text" name=product_name13 id="product_name"/> </td> </tr> <tr> <td> Total Possible Points for Audit </td> <td colspan='3'> <input type="text" name=product_name14 id="product_name"/> </td> </tr> <tr> <td> Total Points Obtained for the Audit </td> <td colspan='3'> <input type="text" name=product_name15 id="product_name"/> </td> </tr> <tr> <td> Assessment Score </td> <td colspan='3'> <input type="text" name=product_name16 id="product_name"/> </td> </tr> <tr align="centre"> <th> <span style="color:white" BGcolor="Blue"><b> PARAMETERS </span> </th> <th> <span style="color:white"><b> TOGGLE </span> </th> <th> <span style="color:white"><b> COMMENTS </span></th> <th> <span style="color:white"><b> SCORES </span> </th> </tr> <tr> <td colspan="4" bgcolor="CCCC66" align="left"> <b> A. Credit approval </b> </td> </tr> <tr> <td> Procedure </td> <td> <select name=Para_A_A1 id = "Para_A_A1" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A1_comment id="Para_A_A1_comment"/> </td> <td align="center"> <input type="text" name=Para_A_A1_score id="Para_A_A1_score"/> </td> </tr> <tr> <td> Days Calculation (Service issue case)</td> <td> <select name=Para_A_A2 id = "Para_A_A2" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A2_comment id="Para_A_A2_comment"/> </td> <td> <input type="text" name=Para_A_A2_score id="Para_A_A2_score"/> </td> </tr> <tr> <td> Credit request </td> <td> <select name=Para_A_A3 id = "Para_A_A3" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A3_comment id="Para_A_A3_comment"/> </td> <td> <input type="text" name=Para_A_A3_score id="Para_A_A3_score"/> </td> </tr> <tr> <td> closure </td> <td> <select name=Para_A_A4 id = "Para_A_A4" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A4_comment id="Para_A_A4_comment"/> </td> <td> <input type="text" name=Para_A_A4_score id="Para_A_A4_score"/> </td> </tr> <tr> <td> Comments / interaction </td> <td> <select name=Para_A_A5 id = "Para_A_A5" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A5_comment id="Para_A_A5_comment"/> </td> <td> <input type="text" name=Para_A_A5_score id="Para_A_A5_score"/> </td> </tr> <tr> <td> TEXT updation </td> <td> <select name=Para_A_A6 id = "Para_A_A6" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A6_comment id="Para_A_A6_comment"/> </td> <td> <input type="text" name=Para_A_A6_score id="Para_A_A6_score"/> </td> </tr> <tr> <td> <input name="submit" type="submit" id="submit" value="Submit Details" /> <input name="Reset" type="reset" value="Reset"> </td> </tr> </div> </table> </form> </div> </div> </body> </html> Below is the testphp.php Code: [Select] <?php $question1 = $_POST['Para_A_A1']; $question2 = $_POST['Para_A_A2']; $question3 = $_POST['Para_A_A3']; $question4 = $_POST['Para_A_A4']; $question5 = $_POST['Para_A_A5']; $question6 = $_POST['Para_A_A6']; { $numberofansweredquestions = 0; $score = 0; if ($question1 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question1 == "NO") { $numberofansweredquestions++; } if ($question2 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question2 == "NO") { $numberofansweredquestions++; } if ($question3 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question3 == "NO") { $numberofansweredquestions++; } if ($question4 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question4 == "NO") { $numberofansweredquestions++; } if ($question5 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question5 == "NO") { $numberofansweredquestions++; } if ($question6 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question6 == "NO") { $numberofansweredquestions++; } $maxscore = $numberofansweredquestions * 10; echo "The score is: " . $score . "/" . $maxscore . ""; } ?> I stepped away from teaching myself php for a few months, and I want to work more on the site I'd started. But I found a glitch and have forgotten enough to not know what to do. I have a form, that is filled out. I want it to enter the info into a mysql database and then forward to a new page, using the ID to submit to a second table. If I set the form action to the new page, it goes to the new page, but never submits any info to the database. If I set the form action to itself, it does put the information into the database. I'm not sure what problem this might indicate. Forgive me for dropping in the entire code, but I'm at a loss and learning how important it is to have notes. (and I seem to have forgotten how to put code into a box? is it div class="codeheader"? <html> <title>submit a new plant form </title> <link rel="stylesheet" type="text/css" href="gaiapedia_styles.css"> <body> <?php if (isset($_POST['submitted'])) { $errors = array(); if (empty($_POST['scientific_name'])) { $errors[] = 'you forgot to enter the scientific name'; } else { $sn = trim($_POST['scientific_name']); } if (empty($_POST['common_name_english'])) { $errors[] = 'you forgot to enter the common name'; } else { $cne = trim($_POST['common_name_english']); } $description4 = trim($_POST['common_names_spanish']); $description5 = trim($_POST['common_names_french']); $description6 = trim($_POST['common_name_chinese']); $description7 = trim($_POST['taxonomic_domain']); $description8 = trim($_POST['taxonomic_subkingdom']); $description9 = trim($_POST['taxonomic_superdivision']); $description10 = trim($_POST['taxonomic_phylum_divis']); $description11 = trim($_POST['taxonomic_class']); $description12 = trim($_POST['taxonomic_order']); $description13 = trim($_POST['taxonomic_suborder']); $description14 = trim($_POST['taxonomic_family']); $description15 = trim($_POST['taxonomic_tribe']); $description16 = trim($_POST['taxonomic_genus']); $description17 = trim($_POST['taxonomic_subgenus']); $description18 = trim($_POST['taxonomic_section']); $description19 = trim($_POST['taxonomic_series']); $description20 = trim($_POST['taxonomic_division']); $description21 = trim($_POST['taxonomic_species']); $description22 = trim($_POST['taxonomic_variety']); $description23 = trim($_POST['taxonomic_form']); $description24 = trim($_POST['itis_serial_number']); $description25 = trim($_POST['paraphyletic_grade']); $description26 = trim($_POST['clade1']); $description27 = trim($_POST['subclade1']); $description28 = trim($_POST['subclade2']); $description29 = trim($_POST['subclade3']); $description30 = trim($_POST['subclade4']); $description31 = trim($_POST['subclade_order']); $description32 = trim($_POST['subclade_family']); $description33 = trim($_POST['earliest_date_known']); if (empty($errors)) { require_once ('sqlconnectfile.php'); $query = "INSERT INTO plantae (scientific_name, common_name_english, common_names_spanish, common_names_french, common_name_chinese, taxonomic_domain, taxonomic_subkingdom, taxonomic_superdivision, taxonomic_phylum_divis, taxonomic_class, taxonomic_subclass, taxonomic_order, taxonomic_suborder, taxonomic_family, taxonomic_tribe, taxonomic_genus,taxonomic_subgenus, taxonomic_section, taxonomic_series, taxonomic_division, taxonomic_species, taxonomic_variety, taxonomic_form, itis_serial_number, paraphyletic_grade, clade1, subclade1, subclade2, subclade3, subclade4, subclade_order, subclade_family, latest_date_known, earliest_date_known) VALUES ('$sn', '$cne', '$description4', '$description5', '$description6', '$description7', '$description8', '$description9', '$description10', '$description11', '$description12', '$description13', '$description14', '$description15', '$description16', '$description17', '$description18', '$description19', '$description20', '$description21', '$description22', '$description23', '$description24', '$description25', '$description26', '$description27', '$description28', '$description29', '$description30', '$description31', '$description32', '$description33', '$description34', '$description35')"; $result = @mysql_query ($query); if ($result) { if(isset($_POST['scientific_name'])) { $plant_id=mysql_insert_id(); } exit(); } else { echo 'system error. No plant added'; echo '<p>' . mysql_error() . '<br><br>query:' . $query . '</p>'; exit(); } mysql_close(); } else { echo 'error. the following error occured <br>'; foreach ($errors as $msg) { echo " - $msg<br>\n"; } } // end of if } // end of main submit conditional ?> <form action="insertaplant1.php" method="post"><fieldset><legend><b>Enter your new plant here</b></legend> blahblah <br><br> Plant name<br> <table bgcolor=#FFEC8B width=590> <tr><td> Scientific Name:<br> <input type="text" name="scientific_name" value="<?php if(isset($_POST['scientific_name'])) echo $_POST['scientific_name']; ?>" /><br> <font color=red>*Required field</font><br> </td> <td>Common Names:<br> <input type="text" name="common_name_english" value="<?php if(isset($_POST['common_name_english'])) echo $_POST['common_name_english']; ?>" /><br><br> </td> <td>Common Name, Spanish:<br> <input type="text" name="common_names_spanish" value="<?php if(isset($_POST['common_names_spanish'])) echo $_POST['common_names_spanish']; ?>" /><br><br> </td><tr> <td>Common Names, French:<br> <input type="text" name="common_names_french" value="<?php if(isset($_POST['common_names_french'])) echo $_POST['common_names_french']; ?>" /><br><br> </td> <td>Common names, Chinese:<br> <input type="text" name="common_name_chinese" value="<?php if(isset($_POST['common_name_chinese'])) echo $_POST['common_name_chinese']; ?>" /><br><br> </td> <td>Taxonomic domain:<br> <input type="text" name="taxonomic_domain" value="<?php if(isset($_POST['taxonomic_domain'])) echo $_POST['taxonomic_domain']; ?>" /><br><br> </td></tr><table> <br> <b>Taxonomy, traditional</b><br> <table bgcolor=#EEDD82 width=590> <tr><td>Kingdom:<br><b>Plantae</b><br> </td> <td>Subkingdom:<br> <SELECT NAME="taxonomic_subkingdom" value="<?php if(isset($_POST['taxonomic_subkingdom'])) echo $_POST['taxonomic_subkingdom']; ?>" > <OPTION VALUE="unknown">unknown <OPTION VALUE="Tracheobionta - vascular plants">Tracheobionta - vascular plants <OPTION VALUE="Embryobionta - embryophytes">Embryobionta - embryophytes </SELECT><br><br> </td> <td>Superdivision:<br> <input type="text" name="taxonomic_superdivision" value="<?php if(isset($_POST['taxonomic_superdivision'])) echo $_POST['taxonomic_superdivision']; ?>" /><br><br> </td></tr> <tr><td>Division/phylum:<br> <input type="text" name="taxonomic_phylum_divis" value="<?php if(isset($_POST['taxonomic_phylum_divis'])) echo $_POST['taxonomic_phylum_divis']; ?>" /><br><br> </td> <td>Class:<br> <input type="text" name="taxonomic_class" value="<?php if(isset($_POST['taxonomic_class'])) echo $_POST['taxonomic_class']; ?>" /><br><br> </td> <td>Subclass:<br> <input type="text" name="taxonomic_subclass" value="<?php if(isset($_POST['taxonomic_subclass'])) echo $_POST['taxonomic_subclass']; ?>" /><br><br> </td></tr> <tr><td>Order:<br> <input type="text" name="taxonomic_order" value="<?php if(isset($_POST['taxonomic_order'])) echo $_POST['taxonomic_order']; ?>" /><br><br> </td> <td>Suborder:<br> <input type="text" name="taxonomic_suborder" value="<?php if(isset($_POST['taxonomic_suborder'])) echo $_POST['taxonomic_suborder']; ?>" /><br><br> </td> <td>Subfamily:<br> <input type="text" name="taxonomic_family" value="<?php if(isset($_POST['taxonomic_family'])) echo $_POST['taxonomic_family']; ?>" /><br><br> </td></tr> <tr><td>Tribe:<br> <input type="text" name="taxonomic_tribe" value="<?php if(isset($_POST['taxonomic_tribe'])) echo $_POST['taxonomic_tribe']; ?>" /><br><br> </td> <td>Genus:<br> <input type="text" name="taxonomic_genus" value="<?php if(isset($_POST['taxonomic_genus'])) echo $_POST['taxonomic_genus']; ?>" /><br><br> </td> <td>Subgenus:<br> <input type="text" name="taxonomic_subgenus" value="<?php if(isset($_POST['taxonomic_subgenus'])) echo $_POST['taxonomic_subgenus']; ?>" /><br><br> </td></tr> <tr><td>Section:<br> <input type="text" name="taxonomic_section" value="<?php if(isset($_POST['taxonomic_section'])) echo $_POST['taxonomic_section']; ?>" /><br><br> </td> <td>Series:<br> <input type="text" name="taxonomic_series" value="<?php if(isset($_POST['taxonomic_series'])) echo $_POST['taxonomic_series']; ?>" /><br><br> </td> <td>Variety:<br> <input type="text" name="taxonomic_variety" value="<?php if(isset($_POST['taxonomic_variety'])) echo $_POST['taxonomic_variety']; ?>" /><br><br> </td></tr> <tr><td>Form:<br> <input type="text" name="taxonomic_form" value="<?php if(isset($_POST['taxonomic_form'])) echo $_POST['taxonomic_form']; ?>" /><br><br> </td> <td>Itis Serial Number:<br> <input type="text" name="itis_serial_number" value="<?php if(isset($_POST['itis_serial_number'])) echo $_POST['itis_serial_number']; ?>" /><br><br> </td> <td>Paraphyletic grade:<br> <input type="text" name="paraphyletic_grade" value="<?php if(isset($_POST['paraphyletic_grade'])) echo $_POST['paraphyletic_grade']; ?>" /><br><br> </td></tr> </table> <br> <b>APG Plant Taxonomy (based on evolutionary tree)</b><br> <table bgcolor=#E3CF57 width=590> <tr><td>Clade1:<br> <input type="text" name="clade1" value="<?php if(isset($_POST['clade1'])) echo $_POST['clade1']; ?>" /><br><br> </td> <td>subclade1:<br> <input type="text" name="subclade1" value="<?php if(isset($_POST['subclade1'])) echo $_POST['subclade1']; ?>" /><br><br> </td> <td>subclade2:<br> <input type="text" name="subclade2" value="<?php if(isset($_POST['subclade2'])) echo $_POST['subclade2']; ?>" /><br><br> </td></tr> <tr><td>subclade3:<br> <input type="text" name="subclade3" value="<?php if(isset($_POST['subclade3'])) echo $_POST['subclade3']; ?>" /><br><br> </td> <td>subclade4:<br> <input type="text" name="subclade4" value="<?php if(isset($_POST['subclade4'])) echo $_POST['subclade4']; ?>" /><br><br> </td> <td>subclade_order:<br> <input type="text" name="subclade_order" value="<?php if(isset($_POST['subclade_order'])) echo $_POST['subclade_order']; ?>" /><br><br> </td> </tr> <tr><td colspan=3>subclade_family:<br> <input type="text" name="subclade_family" value="<?php if(isset($_POST['subclade_family'])) echo $_POST['subclade_family']; ?>" /><br> </td><tr> </table> <br> <b>Plant Timeline</b><br> <table bgcolor=#CDAD00 width=590> <tr><td>earliest_date_known:<br> <input type="text" name="earliest_date_known" value="<?php if(isset($_POST['earliest_date_known'])) echo $_POST['earliest_date_known']; ?>" /><br><br> </td> <td colspan=2>latest_date_known:<br> <input type="text" name="latest_date_known" value="<?php if(isset($_POST['latest_date_known'])) echo $_POST['latest_date_known']; ?>" /><br><br> </td> </tr> </table> </fieldset><br><br> <input type="hidden" name="submitted" value="TRUE"> <input type="hidden" name="submitted_forward" value='$sn'> <input type="submit" /> </form> Form forward is not working in below code. Once I click on submit button, it is not forwarding the results to codetesting.php. <html> <head> </head> <body> <form method="post" action="codetesting.php"> <select name="Para"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </form> <input type="submit" name="submit" value="Submit"> </body> </html> I use the links in php like this: index.php?content=filename
So I want to use it in future like:
http://example.com/2014/link-name/post-head-name/I dont have the idea how can I do that? Can anybody help me how to do that in PHP? I have a html form that collect information such as [name], [address], [email] (amongst others) and once you hit the submit button all the data you send to "thank_you.php" which dumps all the data from fields to the predefined database, as wwell as it telly you thank you for registering. What code do I need in order for "thank_you.php" to send [name] and [email] fields automatically in the background to other page on different server (such as www.otherdomain.com/storage.php)? Is such a think possible? So I built a form and if anyone puts // in the text area field named Code: [Select] name="background" it won't work... it fails. This prevents users from entering website URLs, which is an issue since the form is related to website design. I think I have everything else working just fine. Any ideas how I can change this so it will work and allow // ? There may be other things that cannot be entered or maybe a security risk I am missing... here is the code... Code: [Select] <?php // version 2.2 // All placeholders that are used such as {yourEmail@yourDomain.com}, {yourSolve360Token}, {ownership}, // {categoryId}, {templateId} should be replaced with real values without the {} brackets. // REQUIRED Edit with the email address you login to Solve360 with define('USER', 'me@me.com'); // REQUIRED Edit with token, Workspace > My Account > API Reference > API Token define('TOKEN', 'itentionallydeleted'); // Get request data $requestData = array(); parse_str($_SERVER['QUERY_STRING'], $requestData); // Configure service gateway object require 'Solve360Service.php'; $solve360Service = new Solve360Service(USER, TOKEN); // // Preparing the contact data // $contactFields = array( // field name in Solve360 => field name as specified in html form 'firstname' => 'firstname', 'lastname' => 'lastname', 'businessemail' => 'businessemail', 'cellularphone' => 'cellularphone', 'background' => 'background', ); // kill form if spammers use the siteURL field if ( $_GET['url'] != '' || $_GET['firstname'] == 'Your Name' || $_GET['businessemail'] == 'Email Address' ) {header("Location: http://www.openpotion.com/new/error");} else { $contactData = array( // OPTION Apply category tag(s) and set the owner for the contact to a group // You will find a list of IDs for your tags, groups and users in Workspace > My Account > API Reference // To enable this option, uncomment the following: // Specify a different ownership i.e. share the item 'ownership' => 18634876, // Add categories 'categories' => array( 'add' => array('category' => array(18660073)) ), ); // adding not empty fields foreach ($contactFields as $solve360FieldName => $requestFieldName) { if ($requestData[$requestFieldName]) { $contactData[$solve360FieldName] = $requestData[$requestFieldName]; } } // // Saving the contact // // Check if the contact already exists by searching for a matching email address. // If a match is found update the existing contact, otherwise create a new one. // $contacts = $solve360Service->searchContacts(array( 'filtermode' => 'byemail', 'filtervalue' => $contactData['businessemail'], )); if ((integer) $contacts->count > 0) { $contactId = (integer) current($contacts->children())->id; $contactName = (string) current($contacts->children())->name; $contact = $solve360Service->editContact($contactId, $contactData); } else { $contact = $solve360Service->addContact($contactData); $contactName = (string) $contact->item->name; $contactId = (integer) $contact->item->id; } if (isset($contact->errors)) { // Mail yourself if errors occur mail( USER, 'Error while adding contact to Solve360', 'Error: ' . $contact->errors->asXml() ); die ('System error'); } else { // Mail yourself the result mail( USER, 'A new sales lead has been posted to Solve360', 'Contact "' . $contactName . '" https://secure.solve360.com/contact/' . $contactId . ' was posted to Solve360', 'From: noreply@openpotion.com' . PHP_EOL . 'Reply-To: ' . $contactData['businessemail'] . PHP_EOL . 'X-Mailer: PHP/' . phpversion() ); } // // OPTION Adding a activity // /* * You can attach an activity to the contact you just posted * This example creates a Note, to enable this feature just uncomment the following request * */ /* // Preparing data for the note $noteData = array( 'details' => nl2br($requestData['note']) ); $note = $solve360Service->addActivity($contactId, 'note', $noteData); // Mail yourself the result mail( USER, 'Note was added to "' . $contactName . '" contact in Solve360', 'Note with id ' . $note->id . ' was added to the contact with id ' . $contactId ); // End of adding note activity */ // // OPTION Inserting a template of activities // /* * You can also insert a template directly into the contact you just posted * You will find a list of IDs for your templates in Workspace > My Account > API Reference * To enable this feature just uncomment the following request * */ /* // Start of template request $templateId = {templateId}; $template = $solve360Service->addActivity($contactId, 'template', array('templateid' => $templateId)); // Mail yourself the result mail( USER, 'Template was added to "' . $contactName . '" contact in Solve360', 'Template with id ' . $templateId . ' was added to the contact with id ' . $contactId ); // End of template request */ header("Location: http://www.website.com/thank-you"); } ?> Thanks a ton in advance! Jason [attachment deleted by admin] how to arrange a port forward via ssh-tunnel i need to do that on a domain with this syntax https://www2.mydomain.org:2211/ i am on opensuse guess that i firstly have to activate the ssh This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317019.0 Hi everyone. I have a records table and a communications table. i have a query insert a new CaseActionNumber in the communications table and increase the value by 1. i need the page to show information from the records table with the autonumber, but also find the last (max) value for CaseActionNumber for that person based on the $idnumber. for ex. in the records table i'll have: idnumber namelast_1 namefirst_1 etc 1 john smith 2 peter parker communications table commid idnumber caseactionnumber etc 1 1 001 2 1 002 3 2 001 4 2 002 5 2 003 I need the query below to find the idnumber plus the max(casactionnumber) for that person. sometimes my query finds the max caseactionnumber, othertimes it displays the idnumber with 001 not the max caseactionnumber. i'm not sure what i'm doing wrong so i'd appreciate some help on this issue. thank you. Code: [Select] <?php // query db $IDNumber = $_GET['IDNumber']; $result = mysql_query("SELECT records.NameFirst_1, records.NameLast_1, Max(Communications.CaseActionNumber) AS MaxCaseActionNumber, records.IDNumber, records.CaseOwnerSelect, records.CompanyName, records.CompanyReferenceNumber, records.CompanyBranch, Communications.ConversionType, Communications.Contact, Communications.ContactFrom, Communications.ContactTelephone, Communications.ContactEmail, Communications.ContactFax, Communications.CallDate, Communications.CallTime, Communications.ActionTextField, Communications.CallTime, Communications.ActionTextField FROM records right JOIN Communications ON records.IDNumber = '$IDNumber' GROUP BY records.NameFirst_1, records.NameLast_1, records.IDNumber, records.CaseOwnerSelect, records.CompanyName, records.CompanyReferenceNumber, records.CompanyBranch, Communications.ConversionType, Communications.Contact, Communications.ContactFrom, Communications.ContactTelephone, Communications.ContactEmail, Communications.ContactFax, Communications.CallDate, Communications.CallTime, Communications.ActionTextField, Communications.CallTime, Communications.ActionTextField") ?> sir i m new in php i need some help i want to go next record by clicking subbmit button here is my code: <?php mysql_connect('localhost','root',''); mysql_select_db('exam'); $sql="select * from examination"; $result=mysql_query($sql); echo $result; echo"<table><tr>"; $i = 1; while ($row = mysql_fetch_assoc($result)) { if(isset($_POST['bttn'])) { // here i want to go next record echo "<td>"; echo $row['qid']; echo "</td>"; print "</tr>"; $i++; } } Please help me guys i have a submit button that if(isset($_POST['sub_diplo'])) { $_SESSION['tmp']=$_SESSION['tmp']." counts "; } but tthe button is at the end of the page so when i press the button the page reloads and gose to start! exept that my code working! so is any way to move page to first location?? thanks Display my php errors somewhere other than where they occur, Its messing up my css. Id like to move them maybe to the bottom of the page or in some kind of box, Theres a few deprecated warnings that are part of system files not my code. hello why does my div move when i use a foreach loop ? if i use the code below i get the following i added a border style to the div so i can see that some are in and some are out: result 1 = not in a div result 2 = in a div result 3 = in a div etc then on the end i get a div with no result in it Code: [Select] function name(){ echo' <div id="divName">'; $a = Class::find_all(); foreach ($a as $ab){ $name = $ab->name; $dest = $ab->destination; <ul> <li><a href="index.php?pageID='.$dest.'">'.$name.'</a></li> </ul>'; } echo'</div>'; } thanks rick Hi all,
Any idea what Pinterest uses to make the background move please?
I searched everywhere and cannot find the answer:
https://www.pinterest.com/
I need the same type of background movement + popup on my site, it looks so nice!
Thank you,
Ben
Hi All,
I have this issue when upload a file using an uploader i made. For the life of me I cant figure out why it won't write the file.
Error:
[Sat Jun 21 20:45:40 2014] [error] [client xxxxxxx] AH01215: PHP Warning: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/tmp/phpUsCyXG' to '/home/sites/xxxxxx.co.uk/public_html/yourphotos/uploads/' in /home/sites/xxxxxxx.co.uk/public_html/yourphotos/index.php on line 31My PHP <?php //if they DID upload a file... $message = ''; if($_FILES['photo']['name']) { $valid_file = true; //if no errors... if(!$_FILES['photo']['error']) { //now is the time to modify the future file name and validate the file $new_file_name = strtolower($_FILES['photo']['tmp_name']); //rename file if($_FILES['photo']['size'] > (26214400)) //can't be larger than 25MB { $valid_file = false; $message = 'Oops! Your file\'s size is to large.'; echo $_FILES['photo']['size']; } if($_FILES['photo']['size'] < (1572864)) //can't be smaller than 1.5MB { $valid_file = false; $message = 'Oops! Your file\'s size is to small.'; echo $_FILES['photo']['size']; } //if the file has passed the test if($valid_file) { //move it to where we want it to be move_uploaded_file($_FILES['photo']['tmp_name'], '/home/sites/xxxxxxxx.co.uk/public_html/yourphotos/uploads/'); $message = 'Congratulations! Your file was accepted.'; } } //if there is an error... else { //set that to be the returned message $message = 'Ooops! Your upload triggered the following error: '.$_FILES['photo']['error']; } } ?> <html> <body> <form action="index.php" method="post" enctype="multipart/form-data"> Your Photo: <input type="file" name="photo" size="25" /> <input type="submit" name="submit" value="Submit" /> <?PHP echo $message; ?> </form> </body> </html>I have set the uploads file to have write permissions as well. Sam Edited by samtwilliams, 21 June 2014 - 02:51 PM. Hi, I have created a script that connects to an FTP SERVER... downloads a movie file to the web server then uploads it to a target FTP server. If I move a small file of say 10mb it works well! But if I move a larger moviefile such as a 700mb file it doesn't... The only thing I can think is there is some sort of timeout... Any pointers would be a massive help! I have tried to increase the FTP timeout and also enabled passive mode Code: [Select] ftp_set_option($conn2, FTP_TIMEOUT_SEC, 600); Code: [Select] <?php $movefile = "movie 2.avi"; $server1 = array( "Name" =>"Downloads", "Host" =>"10.0.1.3", "User" =>"Paulio", "Pass" =>"lol", "Path" =>"/Download/Completed"); $server2 = array( "Name" =>"files", "Host" =>"10.0.1.2", "User" =>"Paulio", "Pass" =>"lol", "Path" =>"/Television"); ////////////////////////////////// Download file to be moved. ////////////////////////////////// // Connect to server $conn1 = ftp_connect($server1['Host']); // Open a session to an external ftp site $login1 = ftp_login ($conn1, $server1['User'], $server1['Pass']); ftp_pasv($conn1, true); // Check open if ((!$conn1) || (!$login1)) { echo "Ftp-connect failed!"; die; } else { echo "Connected to " . $server1['Name'] . " FTP server.<br><br>"; } [b]ftp_set_option($conn1, FTP_TIMEOUT_SEC, 600);[/b] ftp_chdir($conn1, $server1["Path"]); // Moves file to be moved to web NAS drive. ftp_get($conn1, $movefile, $movefile, FTP_BINARY); ////////////////////////////////// Upload file to be moved. ////////////////////////////////// // Connect to server $conn2 = ftp_connect($server2['Host']); // Open a session to an external ftp site $login2 = ftp_login ($conn2, $server2['User'], $server2['Pass']); ftp_pasv($conn2, true); // Check open if ((!$conn2) || (!$login2)) { echo "Ftp-connect failed!"; die; } else { echo "Connected to " . $server2['Name'] . " FTP server.<br><br>"; } [b]ftp_set_option($conn2, FTP_TIMEOUT_SEC, 600);[/b] ftp_chdir($conn2, $server2["Path"]); // Uploads moved file from web NAS drive to destination ftp_put($conn2, $movefile, $movefile, FTP_BINARY); //Deletes source file ftp_delete($conn1, $movefile); //Deletes temp file unlink($movefile); ftp_close($conn1); ftp_close($conn2); echo "Complete."; ?> Thanks, Paul. |