Jump to content

phpdragon

Members
  • Posts

    211
  • Joined

  • Last visited

    Never

About phpdragon

  • Birthday 12/06/1972

Profile Information

  • Gender
    Male
  • Location
    Australia

phpdragon's Achievements

Member

Member (2/5)

0

Reputation

  1. do a count in your while loop and advance it for each loop assigning it to a variable, then use an array to check if the count matches your specified rows numbers and if it does display your add.
  2. This may help if (!in_array($extension, array('jpg', 'jpeg', 'gif', 'png'))
  3. This seems to work ok <?php $test="mail.google.com.au"; $break=explode('.', $test); if (isset($break[3])) { $result="$break[1].$break[2].$break[3]"; } else { $result="$break[1].$break[2]"; } echo $result; ?>
  4. <?php $test="mail.google.com"; $break=explode('.', $test); $result=$break[1]."."$break[2]; echo $result; ?> edit: this only works for first level domains tho I have to look up the other way of doing it thats a bit more reliable
  5. assign all the check boxes different names then simply refer to them as posted variables and check for them eg <input type="checkbox" name=newsletter" value="Newsletter" /> Would like Quarterly Newsletter</label> <br /> <label> <input type="checkbox" name="email" value="email" /> Would like Email Bulletin</label> <br /> <label> <input type="checkbox" name="directory" value="directory" /> Entered on VCACD Directory</label> <br /> <label> <input type="checkbox" name="mail" value="mail" /> then on your processor page if (isset($_POST['Newsletter'])) $newsletter="Quarterly Newsletter";[ if (isset($_POST['email'])) $email="Email Bulletin"; if (isset($_POST['directory'])) $directory="VCACD Directory"; if (isset($_POST['mail'])) $mail="Mail";/code] these variables are then available for your use in the email
  6. This is a solution for ajax, check the following post for how a select box changes the contents of a div tag, this example populates another select box with a list of states based on which country was selected in the first select box, you can modify that to have the div tag include the contents of your form to be modified and the query to collect the data.
  7. One option is this http://phpmychat.sourceforge.net/
  8. if(preg_match("#[^\w\d_-]#i", $username, $char)){ if ($char[0]==" ") { $char[0]="no spaces"; } echo "Bad (".$char[0].")"; }else{ echo "Good"; } This solved the problem for me
  9. if(preg_match("#[^\w\d_-]#i", $username)){ echo "Bad ($char)"; }else{ echo "Good"; } That bit works great thank you. In the "Bad" Section how would I echo the first bad character or even all bad characters that were input from $username as $char for example?
  10. I am just trying to check the $username input of the form in the code below to make sure it only has the characters a-z, A-Z, 0-9, _, - and nothing more, if it contains a character outside those parameters I just want to spit out and error message with the variable $badchars containing the illegal chars. What I have below is not quite what I have asked for, so I would like some help modifying it to work that way. I <?php if (isset($_POST['submit'])) { $username=$_POST['username']; if (preg_match('#[^a-z0-9]#i', $username > 0)) { $error="<font color='red'>$username contains unacceptable ( $badchars ) characters</font>"; } else { $error="<font color='green'>$username checks out fine</font>"; } } if (isset($error)) { echo $error; } ?> <br/> <form name="test" action="nasty.php" target="_self" method="post"> <input type="text" size="20" name="username" value="<?php if (isset($username)) { echo $username; } ?>" /> <input type="submit" name="submit" value="check" /> </form>
  11. what does the resulting html source look like when you have tested each condition, and are both images in the location you have specified and the paths correct? If you have already determined that a user is online/offline by by declaring a variable as 1 or 0 then displaying an image would be easy.
  12. sorry with my result switch $splitdate[2] and $splitdate[1] around to have the way you first described
  13. $startdate="2009-05-27 20:35:18"; $predate=explode(' ', $startdate); $splitdate=explode('-', $predate[0]); $newdate="$splitdate[2]-$splitdate[1]-$splitdate[0]"; echo $newdate;
  14. make your database query for the image names first, then nominate the $file image in a while loop calling the image to be thumb-nailed from its directory
  15. I resize like this // create thumbnail (150x150) $file = $_FILES['image_file']['tmp_name']; list($width, $height) = getimagesize($file); if ($width >= $height) { // scale to width $thumb_width = 150; $thumb_height = $height * ($thumb_width / $width); } else { // scale to height $thumb_height = 150; $thumb_width = $width * ($thumb_height / $height); } $image = imagecreatefromjpeg($file); // create thumbnail file $thumb_image = imagecreatetruecolor($thumb_width, $thumb_height); imagecopyresampled($thumb_image, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height); $output_file = "admin/gallery/thumbs/".$_FILES['image_file']['name']; imagejpeg($thumb_image, $output_file, 100); hope this helps
×
×
  • 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.