Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Post the code you have so far.. and what the "problem" is..
  2. If this is true then from the index file will work.. if its not from the index.. then readup on Relative Paths..
  3. weird.. try this see what happens *untested <?php if (file_exists($file)) { if(chmod ($file, 0777)) { if (unlink($file)) { echo "Deleted $file"; } else { echo "cant Deleted $file"; } }else{ echo "Can't change rights"; } }else{ echo "No file exists"; } ?>
  4. OK i hope this helps... <?php //Set String $string = ' <img src="http://www.example.com/path/image.gif" height="500" width="500"> <img src="http://www.example.com/path/image2.gif" width="500" height="500"> <img src="http://www.example.com/path/image3.gif" > <img height="500" width="500" src="http://www.example.com/path/image4.gif" > '; //The Find $pattern = '/<img\s.*?src="(.*?)".*?>/s'; //The Replace $repl = '<img src="createthumb.php?src=$1&w=100">'; //Do the Find and Replace and print results echo preg_replace($pattern, $repl, $string ); ?> Okay.. The Find my sample Text is this hello <img src="http://www.example.com/path/image.gif" height="500" width="500"> world 1. Match the characters <img Now We have <img 2. Match a single "whitespace character" (spaces, tabs, line breaks, etc.) thats the \s Now We have <img (note the space at the end) 3. Match anything not a line break character, using lazyiness(the ? afte the * means lazy) .*? Now We have <img , okay explain a little more, it matches until the next characters are found (thats a basic example of lazy) as the next set are 'src="' it finds them next thus no addions, so results is no different.. 4. Match the characters 'src="' literally src=" Now we have <img src= 5. Matches everything until " (6.) is found, and stores it as backreference number 1 (.*?) Now we have <img src="http://www.example.com/path/image.gif and backreference1 = http://www.example.com/path/image.gif the reason we store it is because its in brackets (), i'm english we call them brackets 6. Match the character " Now we have <img src="http://www.example.com/path/image.gif 7. Match any single character that is not a line break character .*?>/s Match everything until > and then "whitespace character" Okay that probably confused you, but i expect other members to help or if your confused to highlight what part.. but i'll continue.. now remeber the sample text was hello <img src="http://www.example.com/path/image.gif" height="500" width="500"> world the find found <img src="http://www.example.com/path/image.gif" height="500" width="500"> and stored http://www.example.com/path/image.gif in backreference number 1 so we move on.. the Replace... <img src="createthumb.php?src=$1&w=100"> what this does it replace what we found <img src="http://www.example.com/path/image.gif" height="500" width="500"> with <img src="createthumb.php?src=$1&w=100"> BUT.. Note the src=$1 the $1 means backreference number 1 so infact we replace <img src="http://www.example.com/path/image.gif" height="500" width="500"> with <img src="createthumb.php?src=http://www.example.com/path/image.gif&w=100"> i'll await your questions
  5. doesn't work how? error...? fails to send..? etc? try this.. <?php send_mail("test@domain.com", "Hello world", "Test Email", "Me@me.com", "My Name") function send_mail($to, $body, $subject, $fromaddress, $fromname, $attachments=false) { $eol="\r\n"; $mime_boundary=md5(time()); # Common Headers $headers .= "From: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol; // these two to set reply address $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters # Boundry for marking the split & Multitype Headers $headers .= 'MIME-Version: 1.0'.$eol.$eol; $headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary."\"".$eol.$eol; # Open the first part of the mail $msg = "--".$mime_boundary.$eol; $htmlalt_mime_boundary = $mime_boundary."_htmlalt"; //we must define a different MIME boundary for this section # Setup for text OR html - $msg .= "Content-Type: multipart/alternative; boundary=\"".$htmlalt_mime_boundary."\"".$eol.$eol; # Text Version $msg .= "--".$htmlalt_mime_boundary.$eol; $msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol; $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $msg .= strip_tags(str_replace("<br>", "\n", substr($body, (strpos($body, "<body>")+6)))).$eol.$eol; # HTML Version $msg .= "--".$htmlalt_mime_boundary.$eol; $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol; $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $msg .= $body.$eol.$eol; //close the html/plain text alternate portion $msg .= "--".$htmlalt_mime_boundary."--".$eol.$eol; if ($attachments !== false) { for($i=0; $i < count($attachments); $i++) { if (is_file($attachments[$i]["file"])) { # File for Attachment $file_name = substr($attachments[$i]["file"], (strrpos($attachments[$i]["file"], "/")+1)); $handle=fopen($attachments[$i]["file"], 'rb'); $f_contents=fread($handle, filesize($attachments[$i]["file"])); $f_contents=chunk_split(base64_encode($f_contents)); //Encode The Data For Transition using base64_encode(); $f_type=filetype($attachments[$i]["file"]); fclose($handle); # Attachment $msg .= "--".$mime_boundary.$eol; $msg .= "Content-Type: ".$attachments[$i]["content_type"]."; name=\"".$file_name."\"".$eol; // sometimes i have to send MS Word, use 'msword' instead of 'pdf' $msg .= "Content-Transfer-Encoding: base64".$eol; $msg .= "Content-Description: ".$file_name.$eol; $msg .= "Content-Disposition: attachment; filename=\"".$file_name."\"".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !! $msg .= $f_contents.$eol.$eol; } } } # Finished $msg .= "--".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection. # SEND THE EMAIL ini_set(sendmail_from,$fromaddress); // the INI lines are to force the From Address to be used ! $mail_sent = mail($to, $subject, $msg, $headers); ini_restore(sendmail_from); return $mail_sent; } ?>
  6. if you do a find for "{" your find your find 65 of them if you do a find for "}" your find your find 66 of them So it would seam that theirs an extra } but you need to take into account this line //Side note: when I remove this line (just the '}') I get an "$end" error so theirs infact 65 of both.. so you probably miss-counted, either that or i fixed the problem without noticing!!, i am refering to my post hope that makes sence..
  7. maybe this <?php preg_match_all('%<a href\s?=\s?(?:["|\']?)(.*?)(?:["|\']?)>(.*?)<\/a>%i', $src, $result, PREG_PATTERN_ORDER); $linkname= $result[1]; $URL = $result[2]; print_r($linkname); print_r($URL); ?> or to find any valid link (starting with http), try <?php preg_match_all('/\bhttps?:\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]/i', $subject, $result, PREG_PATTERN_ORDER); $result = $result[0]; ?> please note we have a Regex within PHP section
  8. as a note: if your using a find to count the { compared to } please remember that you have a } commented out
  9. Hummm.. first question is why.. the reason i ask is, it maybe a problem.. as you could do this <?php $run=`runas \user:"Wesley Tabaka" "VLC" "C:\Program Files\VideoLAN\VLC\vlc.exe"`; echo $run; ?> BUT it requires a password to be entered, and theirs no way to add it onto the CLI.. and blank passwords are not allowed! Other Option.. start->run->services.msc find apache or wampapache (if using wamp) double click and select the logon tab change to this account and enter username and password
  10. try this (re-tabbed) <?php //User inputs // //$side_a = 10 //$side_c = 24 and //$angle_a = 150 (degrees) // $side_a = $_REQUEST[side_a]; $side_b = $_REQUEST[side_b]; $side_c = $_REQUEST[side_c]; $angle_a = $_REQUEST[angle_a]; $angle_b = $_REQUEST[angle_b]; $angle_c = $_REQUEST[angle_c]; $side[0]=$side_a; $side[1]=$side_b; $side[2]=$side_c; $angle[0]=$angle_a; $angle[1]=$angle_b; $angle[2]=$angle_c; $angle[0] = deg2rad($angle[0]); $angle[1] = deg2rad($angle[1]); $angle[2] = deg2rad($angle[2]); SSA($side, $angle); function SSA($side, $angle) { $pi = define_pi(); if (empty($side[0])) { if (empty($angle[1])) { if ($angle[2] > ($pi/2)) { if ($side[2] <= $side[1]) //working! { echo "<BR>No solution because 'side c is less than or equal to side b'.<BR>"; } elseif ($side[2] > $side[1]) //working! { $angle[1] = asin(($side[1]*sin($angle[2]))/$side[2]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = ($side[2]*sin($angle[0])/sin($angle[2])); show_me_the_money($side, $angle); } } elseif ($angle[2] < ($pi/2)) { $height = $side[1]*sin($angle[2]); if ($side[2] < $height) //working! { echo "<BR>No solution, the swinging side (c) is shorter than the height.<BR>"; } elseif ($side[2] > $height && $side[2] < $side[1]) //working! { echo "<BR><i>Two solutions, h < c < b. </i><BR>"; $angle[1] = asin(($side[1]*sin($angle[2]))/$side[2]); $angle[0] = $pi - $angle[2] - $angle[1]; $angle_b2 = $pi - $angle[1]; $angle_a2 = $pi - $angle[2] - $angle_b2; $side_a2 = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle_a2))); $side[0] = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0]))); $angle_a2 = rad2deg($angle_a2); $angle_b2 = rad2deg($angle_b2); echo "<BR>Angle A<sub>2</sub> = " ,$angle_a2, " degrees <BR>"; echo "Angle B<sub>2</sub> = " ,$angle_b2, " degrees <BR>"; echo "Side a<sub>2</sub> = " ,$side_a2, " units <BR>"; show_me_the_money($side, $angle); } elseif ($side[2] > $height && $side[2] >= $side[1]) //working! { echo "<BR>One solution, c > h and c > b.<BR>"; $angle[1] = asin(($side[1]*sin($angle[2]))/$side[2]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = sqrt(($side[1]*$side[1] + $side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0]))); show_me_the_money($side, $angle); } elseif ($side[2] == $height) { echo "<BR>One solution, c = height.<BR>"; $angle[1] = ($pi/2); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = $side[2]*tan($angle[0]); show_me_the_money($side, $angle); } } elseif ($angle[2] == ($pi/2)) //working! { echo "<BR>One solution, Angle B is 90 degrees.<BR>"; $angle[1] = asin($side[1]/$side[2]); $angle[0] = $pi - $angle[2] - $angle[1]; $side[0] = sqrt(($side[2]*$side[2]) - ($side[1]*$side[1])); show_me_the_money($side, $angle); } } elseif (empty($angle[2])) { if ($angle[1] > ($pi/2)) { if ($side[1] <= $side[2]) //working! { echo "<BR>No solution because 'side b is less than or equal to side c'.<BR>"; } elseif ($side[1] > $side[2]) //working! { echo "<BR>One Solution, b > c.<BR>"; $angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = ($side[1]*sin($angle[0]))/sin($angle[1]); show_me_the_money($side, $angle); } } elseif ($angle[1] < ($pi/2)) { $height = $side[2]*sin($angle[1]); if ($side[1] < $height) //working! { echo "<BR>No solution, the swinging side (b) is shorter than the height.<BR>"; } elseif ($side[1] > $height && $side[1] < $side[2]) //working! { echo "<BR>Two solutions, h < b < c."; $angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $angle_c2 = $pi - $angle[2]; $angle_a2 = $pi - $angle[1] - $angle_c2; $side_a2 = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle_a2))); $side[0] = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0]))); $angle_c2 = rad2deg($angle_c2); $angle_a2 = rad2deg($angle_a2); echo "<BR>Angle C<sub>2</sub> = " ,$angle_c2, " degrees <BR>"; echo "Angle A<sub>2</sub> = " ,$angle_a2, " degrees <BR>"; echo "Side a<sub>2</sub> = " ,$side_a2, " units <BR>"; show_me_the_money($side, $angle); } elseif ($side[1] > $height && $side[1] >= $side[2]) //working! { echo "<BR>One solution, b > h and b > c.<BR>"; $angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0]))); show_me_the_money($side, $angle); } elseif ($side[1] == $height) { echo "<BR>One solution, b = height.<BR>"; $angle[2] = ($pi/2); $angle[0] = $pi - $angle[2] - $angle[1]; $side[0] = sqrt(($side[2]*$side[2]) - ($side[1]*$side[1])); show_me_the_money($side, $angle); } } elseif ($angle[1] == ($pi/2)) //working! { echo "<BR>One Solution, Angle B is 90 degrees.<BR>"; $angle[2] = acos($side[2]/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*$side[2])); show_me_the_money($side, $angle); } } } elseif (empty($side[1])) { if (empty($angle[0])) { if ($angle[2] > ($pi/2)) { if ($side[2] <= $side[0]) //working! { echo "<BR>No solution because 'side a is less than or equal to side c'.<BR>"; } elseif ($side[2] > $side[0]) //working! { $angle[0] = asin(($side[0]*sin($angle[2]))/$side[2]); $angle[1] = $pi - $angle[0] - $angle[2]; $side[1] = sqrt(($side[0]*$side[0]) +($side[2]*$side[2]) - (2*$side[0]*$side[2]*cos($angle[1]))); show_me_the_money($side, $angle); } } elseif ($angle[2] < ($pi/2)) { $height = $side[0]*sin($angle[2]); if ($side[2] < $height) //working! { echo "<BR>No solution, the swinging side (c) is shorter than the height.<BR>"; } elseif ($side[2] > $height && $side[2] < $side[0]) //working! { echo "<BR>Two solutions, h < c < a.<BR>"; $angle[0] = asin(($side[0]*sin($angle[2]))/$side[2]); $angle[1] = $pi - $angle[0] - $angle[2]; $angle_a2 = $pi - $angle[0]; $angle_b2 = $pi - $angle[2] - $angle_a2; $side_b2 = sqrt((($side[0]*$side[0]) + ($side[2]*$side[2]))-(2*$side[0]*$side[2]*cos($angle_b2))); $side[1] = sqrt((($side[0]*$side[0]) + ($side[2]*$side[2]))-(2*$side[0]*$side[2]*cos($angle[1]))); $angle_a2 = rad2deg($angle_a2); $angle_b2 = rad2deg($angle_b2); echo "<BR>Angle A<sub>2</sub> = " ,$angle_a2, " degrees <BR>"; echo "Angle B<sub>2</sub> = " ,$angle_b2, " degrees <BR>"; echo "Side b<sub>2</sub> = " ,$side_b2, " units <BR>"; show_me_the_money($side, $angle); } elseif ($side[2] > $height && $side[2] >= $side[0]) //working! { echo "<BR>One solution, c > h and c > a.<BR>"; $angle[0] = asin(($side[0]*sin($angle[2]))/$side[2]); $angle[1] = $pi - $angle[0] - $angle[2]; $side[1] = sqrt((($side[0]*$side[0]) + ($side[2]*$side[2]))-(2*$side[0]*$side[2]*cos($angle[1]))); show_me_the_money($side, $angle); } elseif ($side[2] == $height) { echo "<BR>One solution, c = height.<BR>"; $angle[0] = ($pi/2); $angle[1] = $pi - $angle[0] - $angle[2]; $side[1] = $side[2]*tan($angle[1]); show_me_the_money($side, $angle); } } elseif ($angle[2] == ($pi/2)) //working! { echo "<BR>One solution, Angle C is 90 degrees.<BR>"; $side[1] = sqrt(($side[2]*$side[2]) - ($side[0]*$side[0])); $angle[0] = asin($side[0]*sin($angle[2])/$side[2]); $angle[1] = $pi - $angle[0] - $angle[2]; show_me_the_money($side, $angle); } } } //Side note: when I remove this line (just the '}') I get an "$end" error /// Why does the number of curly brackets not match up correctly -- yet still parses!!! //Line below is part that should be functioning, but isn't... elseif (empty($angle[2])) { if ($angle[0] > ($pi/2)) { if ($side[0] <= $side[2]) { echo "<BR>No solution because 'side is less than or equal to side '.<BR>"; } elseif ($side[1] > $side[2]) { echo "<BR>One Solution, b > c.<BR>"; $angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = ($side[0]*sin($angle[2]))/sin($angle[2]); show_me_the_money($side, $angle); } } elseif ($angle[1] < ($pi/2)) { $height = $side[2]*sin($angle[1]); if ($side[1] < $height) { echo "<BR>No solution, the swinging side (b) is shorter than the height.<BR>"; } elseif ($side[1] > $height && $side[1] < $side[2]) { echo "<BR>Two solutions, h < b < c.<BR>"; $angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $angle_c2 = $pi - $angle[2]; $angle_a2 = $pi - $angle[1] - $angle_c2; $side_a2 = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle_a2))); $side[0] = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[1]*cos($angle[0]))); $angle_c2 = rad2deg($angle_c2); $angle_a2 = rad2deg($angle_a2); echo "<BR>Angle C<sub>2</sub> = " ,$angle_c2, " degrees <BR>"; echo "Angle A<sub>2</sub> = " ,$angle_a2, " degrees <BR>"; echo "Side a<sub>2</sub> = " ,$side_a2, " units <BR>"; show_me_the_money($side, $angle); } elseif ($side[1] > $height && $side[1] >= $side[2]) { echo "<BR>One solution, b > h and b > c.<BR>"; $angle[2] = asin(($side[2]*sin($angle[1]))/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = sqrt(($side[1]*$side[1]) + ($side[2]*$side[2])-(2*$side[1]*$side[2]*cos($angle[0]))); show_me_the_money($side, $angle); } elseif ($side[1] == $height) { echo "<BR>One solution, b = height.<BR>"; $angle[2] = ($pi/2); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = sqrt(($side[2]*$side[2]) - ($side[1]*$side[1])); show_me_the_money($side, $angle); } } elseif ($angle[1] == ($pi/2)) { echo "<BR>One Solution, Angle B is 90 degrees.<BR>"; $angle[2] = asin($side[2]/$side[1]); $angle[0] = $pi - $angle[1] - $angle[2]; $side[0] = sqrt(($side[1]*$side[1]) - ($side[2]*$side[2])); show_me_the_money($side, $angle); } } elseif (empty($side[2])) { if (empty($angle[0])) { if ($angle[1] > ($pi/2)) { if ($side[1] <= $side[0]) { echo "<BR>No solution because 'side b is less than or equal to side a'.<BR>"; } elseif ($side[1] > $side[0]) { $angle[0] = asin(($side[0]*sin($angle[1]))/$side[1]); $angle[2] = $pi - $angle[0] - $angle[1]; $side[2] = ($side[1]*sin($angle[2]))/sin($angle[1]); show_me_the_money($side, $angle); } } elseif ($angle[1] < ($pi/2)) { $height = $side[0]*sin($angle[1]); if ($side[1] < $height) { echo "<BR>No solution, the swinging side (b) is shorter than the height.<BR>"; } elseif ($side[1] > $height && $side[1] < $side[0]) { echo "<BR>Two solutions, h < b < a ."; $angle[0] = asin(($side[0]*sin($angle[1]))/$side[1]); $angle[2] = $pi - $angle[1] - $angle[0]; $angle_a2 = $pi - $angle[0]; $angle_c2 = $pi - $angle[1] - $angle_a2; $side_c2 = sqrt((($side[0]*$side[0]) + ($side[1]*$side[1]))-(2*$side[0]*$side[1]*cos($angle_c2))); $side[2] = sqrt(($side[1]*$side[1]) + ($side[0]*$side[0])-(2*$side[1]*$side[0]*cos($angle[2]))); $angle_c2 = rad2deg($angle_c2); $angle_a2 = rad2deg($angle_a2); echo "<BR>Angle C<sub>2</sub> = " ,$angle_c2, " degrees <BR>"; echo "Angle A<sub>2</sub> = " ,$angle_a2, " degrees <BR>"; echo "Side c<sub>2</sub> = " ,$side_c2, " units <BR>"; show_me_the_money($side, $angle); } elseif ($side[1] > $height && $side[1] >= $side[0]) { echo "<BR>One solution, b > h and b > a.<BR>"; $angle[0] = asin(($side[0]*sin($angle[1]))/$side[1]); $angle[2] = $pi - $angle[1] - $angle[0]; $side[2] = sqrt((($side[1]*$side[1]) + ($side[0]*$side[0]))-(2*$side[1]*$side[0]*cos($angle[2]))); show_me_the_money($side, $angle); } elseif ($side[1] == $height) { echo "<BR>One solution, b = height.<BR>"; $angle[0] = ($pi/2); $angle[2] = $pi - $angle[1] - $angle[0]; $side[2] = sqrt(($side[0]*$side[0]) - ($side[1]*$side[1])); show_me_the_money($side, $angle); } } elseif ($angle[1] == ($pi/2)) { echo "<BR>One solution, Angle B is 90 degrees.<BR>"; $side[2] = sqrt(($side[1]*$side[1]) - ($side[0]*$side[0])); $angle[0] = asin($side[0]*sin($angle[1])/$side[1]); $angle[2] = $pi - $angle[1] - $angle[0]; show_me_the_money($side, $angle); } } } elseif (empty($angle[1])) { if ($angle[0] > ($pi/2)) { if ($side[0] <= $side[1]) { echo "<BR>No solution because 'side a is less than or equal to side b'.<BR>"; } elseif ($side[0] > $side[1]) { echo "<BR>One Solution, a > b.<BR>"; $angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]); $angle[2] = $pi - $angle[1] - $angle[0]; $side[2] = ($side[0]*sin($angle[2]))/sin($angle[0]); show_me_the_money($side, $angle); } } elseif ($angle[0] < ($pi/2)) { $height = $side[1]*sin($angle[0]); if ($side[0] < $height) { echo "<BR>No solution, the swinging side (a) is shorter than the height.<BR>"; } elseif ($side[0] > $height && $side[0] < $side[1]) { echo "<BR>Two solutions, h < a < c."; $angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]); $angle[2] = $pi - $angle[0] - $angle[1]; $angle_b2 = $pi - $angle[1]; $angle_c2 = $pi - $angle[0] - $angle_b2; $side_c2 = sqrt(($side[1]*$side[1]) + ($side[0]*$side[0])-(2*$side[1]*$side[0]*cos($angle_c2))); $side[2] = sqrt(($side[1]*$side[1]) + ($side[0]*$side[0])-(2*$side[0]*$side[1]*cos($angle[2]))); $angle_b2 = rad2deg($angle_c2); $angle_c2 = rad2deg($angle_a2); echo "<BR>Angle B<sub>2</sub> = " ,$angle_b2, " degrees <BR>"; echo "Angle C<sub>2</sub> = " ,$angle_c2, " degrees <BR>"; echo "Side c<sub>2</sub> = " ,$side_c2, " units <BR>"; show_me_the_money($side, $angle); } elseif ($side[0] > $height && $side[0] >= $side[1]) { echo "<BR>One solution, a > h and a > b.<BR>"; $angle[1] = asin(($side[1]*sin($angle[0]))/$side[0]); $angle[2] = $pi - $angle[0] - $angle[1]; $side[2] = sqrt(($side[1]*$side[1]) + ($side[0]*$side[0])-(2*$side[0]*$side[1]*cos($angle[2]))); show_me_the_money($side, $angle); } elseif ($side[0] == $height) { echo "<BR>One solution, a = height.<BR>"; $angle[1] = ($pi/2); $angle[2] = $pi - $angle[1] - $angle[0]; $side[2] = sqrt(($side[1]*$side[1]) - ($side[0]*$side[0])); show_me_the_money($side, $angle); } } elseif ($angle[0] == ($pi/2)) { echo "<BR>One Solution, Angle A is 90 degrees.<BR>"; $angle[1] = asin($side[1]/$side[0]); $angle[2] = $pi - $angle[0] - $angle[1]; $side[2] = sqrt(($side[0]*$side[0]) - ($side[1]*$side[1])); show_me_the_money($side, $angle); } } } function define_pi() { $pi = 3.14159265358979323846; return $pi; } #debug #function show_me_the_money() #{} ?>
  11. Try this, if fails uncomment debug section <?php include("include.php"); $GetLetters = mysql_query("SELECT * FROM messages WHERE Reciever='{$_SESSION['Current_User']}'") or die(mysql_error()); $row = mysql_fetch_assoc($GetLetters);//Moved for own formatting reasons if (!$row) { header("Location: letterbox.php"); die; }else{ $Subject = $row['Subject']; $From = $row['Sender']; $SentOn = $row['Senttime']; $MessageOne = $row['MessageText']; include("energybarinclude.php"); //Moved down (incase it un/sets $row) //DEBUGING Uncomment the 2 lines below if this fails #echo "MessageOne=$MessageOne<br>";//can remove this #print_r($row);//can remove this, $FindUser1 = mysql_query("SELECT * FROM userregistration WHERE UserID='$From'") or die(mysql_error()); //Fetch the row from the database $rowuser = mysql_fetch_assoc($FindUser1); $UserName1 = $rowuser['UserName']; } ?> <div id="bv_" style="position:absolute;left:375px;top:468px;width:224px;height:128px;z-index:19" align="center"> <font style="font-size:13px" color="#000000" face="Arial"><?= $MessageOne ?></font></div> <div id="bv_" style="position:absolute;left:182px;top:465px;width:150px;height:16px;z-index:22" align="left"> <font style="font-size:13px" color="#FFFFFF" face="Arial">Message:</font> </br> <font style="font-size:13px" color="#FFFFFF" face="Arial"><b>Subject: <?= $Subject ?><br> <br><br> From: <?=$From?> <br> Sent On:</br><?=$SentOn?> <br> <br> Reply!</b></font></div></body> </html>
  12. Okay. this have been here for awhile.. so i choose to look at this in more detail, (including installing WAMP) my findings when you include a URL, it fails to pass the $_GET, $_POST or $_REQUEST, in addition any functions/classes in the included file will be ignored.. now seeing as you don't really need a function, thats not a problem but you do use $_REQUEST, well their is a simple work-around, don't use include, use file_get_contents and pass the keys and values in the URL, see code below <?php #include("2.php");//This works //include("http://localhost/test/2.php");//This does not work //workaround $pass = ""; foreach($_REQUEST as $key => $value) { $pass .= "$key=$value&"; } $e = file_get_contents("http://localhost/test/2.php?$pass"); echo $e; ?> <html> <body> <form action=''> <input type='text' name='txt1'> <input type='submit' name='sub1'> </form> </body> </html> <?php ?>
  13. Of course you can replace it with nothing.. as with you can replace CR or NL.. here.. this will replace the VT with nothing $data= preg_replace('/\x{0B}/i', '', $data);
  14. why won't it reset ? because its in another from.. but your including that file.... if your trying to keep the value and just increase it everytime its run.. then your need to store the number in a session, cookie, database or file.., then read it back in, if the session (whatever you used) doesn't exist then create it and the num will start at 0 or 1
  15. i think we need to way for some more feed back from thefollower, i'll admit i missed the row being set but as i said, this should give us some better feedback <?php include("include.php"); $GetLetters = mysql_query("SELECT * FROM messages WHERE reciever='{$_SESSION['Current_User']}'") or die(mysql_error()); if (!($row = mysql_fetch_assoc($GetLetters))) { header("Location: letterbox.php"); die; } Else{ include("energybarinclude.php"); $Subject = $row['Subject']; $From = $row['Sender']; $SentOn = $row['Senttime']; $MessageOne = $row['MessageText']; $FindUser1 = mysql_query("SELECT * FROM userregistration WHERE UserID='$From'") or die(mysql_error()); //Fetch the row from the database $rowuser = mysql_fetch_assoc($FindUser1); $UserName1 = $rowuser['UserName']; ?>
  16. so $num1 = ($num1*2); or $num1 = ($num1+$num1); i assum you know your always setting $num1 to 0 at the start!
  17. i don't get what your trying surely $num1 = $result; or to increase $num1 by 1 do $num1++;
  18. also need to findout $From = $row['Sender'];//Where is this being set ? (from the include are they correct?) think we need to wait for a post back lol i think this should give some insight! <?php include("include.php"); $GetLetters = mysql_query("SELECT * FROM messages WHERE reciever='{$_SESSION['Current_User']}'") or die(mysql_error()); if (!($row = mysql_fetch_assoc($GetLetters))) { header("Location: letterbox.php"); die; } Else{ include("energybarinclude.php"); $Subject = $row['Subject']; $From = $row['Sender']; $SentOn = $row['Senttime']; $MessageOne = $row['MessageText']; $FindUser1 = mysql_query("SELECT * FROM userregistration WHERE UserID='$From'") or die(mysql_error()); //Fetch the row from the database $rowuser = mysql_fetch_assoc($FindUser1); $UserName1 = $rowuser['UserName']; ?>
  19. <?php //invalid echo "test ".$teng[astig]; //but will work, but bad pratice echo "test $teng['astig']"; //valid echo "test ".$teng['astig']; echo "test {$teng["astig"]}"; echo "test {$teng['astig']}"; ?>
  20. Both of those are perfectly valid. I use the former all the time. http://www.php.net/manual/en/language.types.array.php#language.types.array.donts Erm.. No they are NOT.. 1. $_SESSION[Current_User] will cause a notice error (as Current_User is not a Const but PHP will use the value as a string), it works but is bad pratice.. 2. an array can not be used in a sting unless it escape but {} or concatenated ie "test".array['blar']."er") please review the referance you posted. and
  21. <?php //This is wrong $GetLetters = mysql_query("SELECT * FROM messages WHERE reciever='$_SESSION[Current_User]'"); //try this instead (also no session_start();?) $GetLetters = mysql_query("SELECT * FROM messages WHERE reciever='".$_SESSION['Current_User']."'"); include("energybarinclude.php"); $Subject = $row['Subject']; $From = $row['Sender'];//Where is this being set ? (from the include are they correct?) ?>
  22. Google CSS MENU
  23. Okay, thats HTML NOT PHP, its a drop down list
  24. not 100% sure what you mean.. surely thats just to do with the indexing!
  25. unreadable character ?? you could filter to only allow what you want to keep, to filter the VT try this $data= preg_replace('/\x{0B}/i', '', $data);
×
×
  • 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.