Jump to content

mrdamien

Members
  • Posts

    186
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Canada

mrdamien's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Not a PHP problem. Try changing your css: From this: <style type="text/css"> .progressbar { border: #333333 1px solid; height: 2px; margin: 0 2px; padding: 1px; width: 72px; } .bar { background-color: #ff7700; height: 2px; float: left; } </style> to this: <style type="text/css"> .progressbar { border: #333333 1px solid; height: 2px; margin: 0 2px; font-size: 0px; padding: 1px; width: 72px; } .bar { background-color: #ff7700; height: 2px; line-height: 2px; font-size: 0px; float: left; } </style>
  2. The starting number would be: max($this->currentPage-5, 0); The ending page number would be: min($this->currentPage+5, $this->totalPages) so you can change your loop: $start = max($this->currentPage-5, 0); $end = min($this->currentPage+5, $this->totalPages); for ($i=$min; $i < $max; $i++) { if($i != $this->currentPage) { ... }else{ ... } }
  3. If you have multiple number-signs in the url, then all but the last segment following the number sign, would be part of the GET variables ( I think ). As far as I know, that is controlled by the web-server (i.e. apache). But I've never heard of apache having this problem... What web server are you using ?
  4. Edit: Since I'm not that great with regular expressions, and don't want to spend very long testing... heres a less-regex idea. Untested: preg_match( '/([.]{1,255}@([.]{1,255})/', $text, $matches); foreach($matches as $match) { if(filter_var($match, FILTER_VALIDATE_EMAIL)){ $text = str_replace($match, "<a href=\"mailto:$match\">$match</a>", $text); }else{ $text = str_replace($match, @<a href=\"http://twitter.com/$match\" target=\"_blank\">$match</a>", $text); } } Find all strings resembling "@(characters)". Use PHPs function to determine if its an email. If not an email, its a twitter account. I don't know if twitter has username restrictions (Like not symbols) if so, you'll probably want to test for those again, in the else clause.
  5. I haven't checked in a while but I'm guessing the answer is still "no".
  6. You need to install ffmpeg to convert your videos, however if you're on a shared hosting plan, they will most likely not install if for you. http://ffmpeg.org/ If installed, its rather easy to convert IE: exec("ffmpeg -i input.avi output.flv");
  7. You have to run in on a server with php, browsers don't parse the PHP. I see you have cpanel open, so I'm assuming you have a shared hosting somewhere, upload it there to test.
  8. mysql_num_rows wants the result-resource as a paramater, not the query Therefore: $result=mysql_query($sql); if(mysql_num_rows($result) > 0){ // <- change $sql to $result. $sql = "DELETE FROM horsedata WHERE id = '".(int)$horseid."'"; // (int) for safety $result=mysql_query($sql); echo "You have Euthanized this horse."; }
  9. Can you post the whole script? There's nothing I see that could be the culprit.
  10. Your script works for me. Minus the 2 missing curly-braces, your script works. What version of PHP/GD are you using? <?php $file = 'test.jpg'; // Get the dimensions list($width, $height) = getimagesize($file); // Define our source image $source = imagecreatefromjpeg($file); // Creating the Canvas $bwimage= imagecreate($width, $height); //Create our 2 colours $white = imagecolorallocate($bwimage, 255, 255, 255); $black = imagecolorallocate($bwimage, 0, 0, 0); //Reads the origonal colors pixel by pixel for ($y=0;$y<$height;$y++) { for ($x=0;$x<$width;$x++) { $rgb = imagecolorat($source,$x,$y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> & 0xFF; $b = $rgb & 0xFF; //if red is 255 and green is over 197 then colour in black, else colour in white if($r=255 and $g>197) { imagesetpixel($bwimage,$x,$y,$black); } else { imagesetpixel($bwimage,$x,$y,$white); } } // This was missing } // This was missing ?>
  11. Exceptions are difficult to know when to use. Both of your examples are not good examples of where to use exceptions. For form validation, either the form is valid, or it isn't. If it isn't you should simply show the form again, and ask that it be properly filled. For SQL queries, again, either the query is valid, or it isn't. All the queries you place in your site should be valid 100% of the time, so there is little need to validate them again. Exceptions should more-or-less be used when the script cannot continue past a point, because some external mechanism is not working. This is just my opinion of course. You could of course use exceptions for form-validation, but they won't add any functionality compared to <? if(!isset($_POST['email'])){ $error_message .= "An email is required"; } ?>
  12. $totalchall=mysql_query("SELECT COUNT(*) FROM challenges WHERE challgrid='$compare' OR challgdid='$compare'"); // $compare is still an array at this point so, $compare=mysql_query("SELECT teamid FROM membersteam WHERE memberid='{$_COOKIE['user']}'"); $compare=mysql_fetch_array($compare); $compare=$compare[0]; // now $compare is the teamid field $totalchall=mysql_query("SELECT COUNT(*) FROM challenges WHERE challgrid='$compare' OR challgdid='$compare'"); $totalchall=mysql_fetch_array($totalchall); $totalchall=$totalchall[0];
  13. In my opinion, the easy way is to use htmlentities, and make sure your data is properly inserted with mysql_real_escape_string
  14. Because float's are not actually precise numbers to the computer. http://ca2.php.net/int#language.types.integer.casting.from-float
  15. <?php //Organization Name $mail_from="$organization"; //Organization Telephone $message.="$organization_phone"; //Organization Mail $message.="$organization_mail"; //General Inquiries $message.="$general_inquires"; // From $header="From: $organization <$mail_from>\n". "Content-type: text/html"; // Enter your email address $to ='dealers@countrydelights.ca'; // Variables $message.=$var1.'<p>organization phone number</p><br>'.$var2.'<p>organization email</p><br>'.$var3.'<p>general inquiries</p><br>'; // Send Form $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We've recived your contact information"; } else { echo "ERROR"; } ?> You gotta specify Content-type in the headers.
×
×
  • 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.