Jump to content

swamp

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Everything posted by swamp

  1. ??? :/ Thats nothing to do with what I'm looking for..
  2. Hi guys, I've got this code to print a loop from a database: <?php for ($f_i=0; $f_i < $limit; $f_i++) { $data = mysql_fetch_row($result); $id = $data[0]; $section = $data[1]; $value = $data[2]; $image = $data[3]; ?> <img src="../<?php echo $image; ?>" /><br /> <?php echo $value; ?><br /> <input type="checkbox" name="format<?php echo $f_i + 1; ?>" value="<?php echo $value; ?>" id="format<?php echo $f_i + 1; ?>"/> <?php } ?> I need a to make all the ticked checkboxes into a variable.. EG: $collect_formats = $_POST['format1'] . $_POST['format2'] . $_POST['format3'] But do it as a loop again instead of having to write all of them out... etc... Thanks in advanced
  3. Hi, Can someone please help me make sure the following script only uploads gif/jpg files please? Thanks in advance! <?php //create the directory if doesn't exists (should have write permissons) if(!is_dir("files")) mkdir("files", 0755); //move the uploaded file echo $_FILES['Filedata']['type']; move_uploaded_file($_FILES['Filedata']['tmp_name'], "files/".$_FILES['Filedata']['name']); chmod("files/".$_FILES['Filedata']['name'], 0777); ?>
  4. <style type="text/css"> .left { float:left; } .right { float:right; } </style> <div class="left">image1</div> <div class="right">image2</div> ?
  5. can you post the code from the form?
  6. I'm using this code to include a page containing links to files associated with the page I'm including it with. <?php include 'projects/' . $password . '/index.php' ?> These files were made ages ago and all have the links relative to the file (e.g file1.jpg is linked by /images/file1.jpg) When I'm including the page and clicking the links they are going to the path relative to the file they are included in instead of the actual path of the file.. How can I keep the path when including a file in the way an iframe does when you use that?.. Thanks
  7. Very bad idea, this removes the border when using the 'tab' button on your keyboard to flick through links. You're making the page un-accessible to keyboard users.
  8. Hey, I've got a field called position, the default is currently 1. You can change the position using up + down form controls. Whem I submit a new row to the database through a form I want the field position to default to the lowest current position and be one less than that... Eg <input type="hidden" value=<?php echo $lowest_position - 1 ?>"> and: $lowest_position - LOWEST CURRENT POSITION - 1;
  9. don't worry. fixed it. thanks
  10. I've written this code to +1 to $position when you submit the form. Problem is it just makes all the numbers 1 instead of adding 1?? So if the position was currently 5 i want it to make the position 6. etc.. if (isset($_POST['move_up'])) { $file_ed = $_POST['edit_id']; $pro_open = $_POST['pro_id']; mysql_query("SELECT id, project_id, file_name, file_date, file_location, position, approved FROM files WHERE id='$pro_open'", $linkID) or die (mysql_error()); $position = $data[5]; $nextorder = $position + 1; $results = mysql_query("UPDATE files SET position=$nextorder WHERE id='$pro_open'"); Any help appreciated! Cheers
  11. Hi there, I've written a code that I can add files and edit their properties... I've basically got a list of all my files from a database - one of the fields is called $position - I need this to be able to select the position of the file. The files default position in the list is '0' but I want to be able to make it go either down or up from form buttons. See the code below to see what I mean: I was thinking it would be something like '$currentposition = $position" "$newposition = $currentposition + 1" but can't get it to work. Could anyone lend a hand? Cheers! Move down: <?php if (isset($_POST['move_down'])) { $file_ed = $_POST['edit_id']; $edit = mysql_query("UPDATE files SET position = 'WANT THIS TO BE ONE NUMBER LESS THAN $position' WHERE id = '".$_POST['pro_id']."'") or die (mysql_error()); echo '<meta http-equiv="refresh" content="0;url=files.php?edit_id='?><?php echo $file_ed ?><?php echo'"/>'; } ?> Move up: <?php if (isset($_POST['move_up'])) { $file_ed = $_POST['edit_id']; $edit = mysql_query("UPDATE files SET position = 'WANT THIS TO BE ONE NUMBER MORE THAN $position' WHERE id = '".$_POST['pro_id']."'") or die (mysql_error()); echo '<meta http-equiv="refresh" content="0;url=files.php?edit_id='?><?php echo $file_ed ?><?php echo'"/>'; } ?>
  12. You almost had it mate, just needed to add: $MailToAddress = $_POST['MailToAddress']; which gets the field called MailToAddress from the form. Then call the name of the field in the form MailToAddress. form: <form id="smallgroupform" name="smallgroupform" method="post" action="scripts/smallgroupscript.php"> <div align="left">Small Groups<br /> </div> <label></label> <p align="left">Name <input type="text" name="Name" /> <br /> <br /> E-Mail <input type="text" name="Email" /> <br /> <br /> Phone <input type="text" name="Phone" /> (not required)</p> <p align="left">Who's Small Group are you interested in joining? <select name="MailToAddress" id="MailToAddress" multiple> <option value="None" selected="selected">None</option> <option value="ramydy7@umkc.edu">Rebecca & Kristin</option> <option value="elmd32@umkc.edu">Elizabeth & Emily</option> <option value="jlnr25@umkc.edu">Jenny & Jen</option> <option value="ajbtx9@umkc.edu">Rachel & Abigail</option> <option value="cnbc5b@umkc.edu">Chris & Tim</option> <option value="CalebEgli@umkc.edu">Caleb & Billy</option> <option value="nlj7b2@umkc.edu">Zeph & Mark</option> <option value="jsbcnb@umkc.edu">Jesus & Dan</option> <option value="mjn7c5@umkc.edu">Mike (Truth Project)</option> </select> <br /> <label></label> </p> <p align="left"> </p> <p align="left"><br /> <label></label> </p> <p align="left"> <label> <input type="submit" name="Submit" id="Submit" value="Submit" /> </label> <label> <input type="reset" name="Reset" id="Reset" value="Reset" /> </label> <br /> </p> </form> php script: <? $MailToAddress = $_POST['MailToAddress']; $redirectURL = "thankyou3.html"; $MailSubject = "Small Group: New Contact"; $sendHTML = FALSE; $serverCheck = TRUE; $w4fver = "2.2"; $ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] == "" ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR']); //function blockIP function blockip($ip) { $handle = @fopen("blockip.txt", 'a'); @fwrite($handle, $ip."\n"); @fclose($handle); } $w4fx = stristr(file_get_contents('blockip.txt'),getenv('REMOTE_ADDR')); if ($serverCheck) { if (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])) { $w4fy = TRUE; } else { $w4fy = FALSE; } } else { $w4fy = TRUE; } if (($w4fy === TRUE) && ($w4fx === FALSE)) { $w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html>\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body><font face=3Dverdana size=3D2>"; if (count($_GET) >0) { reset($_GET); while(list($key, $val) = each($_GET)) { $GLOBALS[$key] = $val; if (is_array($val)) { $w4fMessage .= "<b>$key:</b> "; foreach ($val as $vala) { $vala =stripslashes($vala); $vala = htmlspecialchars($vala); if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } } $w4fMessage .= "$vala, "; } $w4fMessage .= "<br>\n"; } else { $val = stripslashes($val); if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } } if (($key == "Submit") || ($key == "submit")) { } else { if ($val == "") { $w4fMessage .= "$key: - <br>\n"; } else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; } } } } // end while }//end if else { reset($_POST); while(list($key, $val) = each($_POST)) { $GLOBALS[$key] = $val; if (is_array($val)) { $w4fMessage .= "<b>$key:</b> "; foreach ($val as $vala) { $vala =stripslashes($vala); $vala = htmlspecialchars($vala); if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } } $w4fMessage .= "$vala, "; } $w4fMessage .= "<br>\n"; } else { $val = stripslashes($val); if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } } if (($key == "Submit") || ($key == "submit")) { } else { if ($val == "") { $w4fMessage .= "$key: - <br>\n"; } else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; } } } } // end while }//end else $w4fMessage .= "<font size=3D1><br><br>\n Sender IP: ".$ip."</font></font></body></html>"; $w4f_what = array("/To:/i", "/Cc:/i", "/Bcc:/i","/Content-Type:/i","/\n/"); $name = preg_replace($w4f_what, "", $name); $email = preg_replace($w4f_what, "", $email); if (!$email) {$email = $MailToAddress;} $mailHeader = "From: $name <$email>\r\n"; $mailHeader .= "Reply-To: $name <$email>\r\n"; $mailHeader .= "Message-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\n"; $mailHeader .= "MIME-Version: 1.0\r\n"; if ($sendHTML) { $mailHeader .= "Content-Type: multipart/alternative;"; $mailHeader .= " boundary=\"----=_NextPart_000_000E_01C5256B.0AEFE730\"\r\n"; } $mailHeader .= "X-Priority: 3\r\n"; $mailHeader .= "X-Mailer: PHP/" . phpversion()."\r\n"; $mailHeader .= "X-MimeOLE: Produced By Web4Future Easiest Form2Mail $w4fver\r\n"; if ($sendHTML) { $mailMessage = "This is a multi-part message in MIME format.\r\n\r\n"; $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n"; $mailMessage .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n"; $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n"; $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n"; $mailMessage .= "Content-Type: text/html; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n"; $mailMessage .= "$w4fMessage\r\n\r\n"; $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730--\r\n"; } if ($sendHTML === FALSE) { $mailHeader .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n"; $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n"; } if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader)) { echo "Error sending e-mail!";} else { header("Location: ".$redirectURL); } } else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";} ?>
  13. Hi, I have a page that reads from a mysql database, how on output can I make all links (in the format of www.website.com) turn into <a href="http://www.website.com">www.website.com</a> and all email links (in the format of someone@somewhere.com) turn into <a href="mailto:someone@somewhere.com">someone@somewhere.com</a>
  14. Post your code, its easy to do but alot easier with your code
  15. Yeah, sorry Jabop but thats not the thing I'm looking for. Has anyone got any further advice on this? It would be very much appreciated
  16. thanks, I'm trying to get yours to work sasa, but I'm not too sure how to implement it with my script. This is the whole thing: <?php $spliter = nl2br($post); $out= explode(".<br />", $spliter); ?> <? foreach($out as $k=>$v) { //echo '<div id="content_'.$k.'">'.$v ?> <div id="content_<? echo $k ?>"> <p> <? echo $v ?>. </p> <p> <? //if first div then don't put previous button if ( $k == 0 ) { echo " "; } else { ?> <span class="arrow-back"><a href="#" onClick="setVisible('content_<? echo $k -1; ?>');">previous page</a></span> <? } ?> <? //if last div don't put next button $paragraphs = count($out); //count paragraphs if ( $k == $paragraphs -1 ) { echo " "; } else { ?> <span class="arrow"><a href="#" onClick="setVisible('content_<? echo $k +1; ?>');">next page</a></span> <? } ?> </p> </div> <? } ?>
  17. Hey, I'm exploding $post into paragraphs to then go in divs... My paragraphs are seperated with < br / > tags. <?php $spliter = nl2br($post); $out = explode("<br />", $spliter); ?> I need it to only explode it after 3 occurances, so first if I had: Hello<br />My name<br />is<br />Swamp<br />I need help<br />with this script So if i echoed $out[1] it would look like: Hello My name is and $out[2] would be: Swamp I need help with this script. Cheers!
  18. Oh sorry - only skimmed through your first post I thought you just wanted to fix it with the same image everytime.. I'll have a look into it for you
  19. Theres an online tool to do this at http://www.adobe.com/products/acrobat/access_onlinetools.html
  20. You could use something like this: <script> function fixBrokenImage(){ var imglst = document.images; for(var i = 0; i < imglst.length; i++){ imglst[i].onerror = function() { this.src = "myimage.gif"; } imglst[i].src = imglst[i].src; } } </script> then use <body onLoad="fixBrokenImage();"> Just change myimage to the image you want to use as default.
×
×
  • 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.