PHP - Problem With Imagettftext()
i have this code:
$wap_image_filename = $wap_profile_pic."-wap.jpg"; $image =0; if($mimetype=='IMAGE/PNG') { $image = imagecreatefrompng($profile_pic); imagejpeg($image,$wap_image_filename , 100); } else if($mimetype=='IMAGE/JPG') { $image = imagecreatefromjpeg($profile_pic); imagejpeg($image,$wap_image_filename , 100); } //resize photo with 100% quality $this->resizeImage($profile_pic,$wap_image_filename,300,300,100); $filename = $wap_image_filename; $date_card_image = imagecreatetruecolor(400, 500); //$date_card_image gives resource id $bg_col = imagecolorallocate ( $date_card_image, 200, 200, 200 ); imagefill ( $date_card_image, 0, 0, $bg_col); $source = imagecreatefromjpeg($filename); //$source gives a resource id# list($ppwidth, $ppheight) = getimagesize($filename); // Resize imagecopyresized($date_card_image, $source , 0, 40, 0,0, 400, $ppheight, $ppwidth, $ppheight); $uc_color = ImageColorAllocate ($date_card_image,10, 10, 10); $info_color = ImageColorAllocate ($date_card_image,42, 134, 186); $white = imagecolorallocate($date_card_image, 255, 255, 255); $black = imagecolorallocate($date_card_image, 0, 0, 0); $blue = imagecolorallocate($date_card_image, 0, 0, 128); $font = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf'; $text = $this->getUniqueCode(); // Add the text imagettftext($date_card_image, 24, 0, 55, 30, $blue, $font, $text); [COLOR="Red"]//get warning on this line 227[/COLOR] the warning i get is: Warning: imagettftext(): Could not find/open font in /home/helloises/traffic_2/phoenix/plugins/rainbowCodePlugin/lib/model/RcProfileTable.php on line 227 please can some one help me fix this? thank you Similar Tutorials<? $username="root"; //Your MySQL Username. $password="pass"; // Your MySQL Pass. $database="clan"; // Your MySQL database. $host="127.0.0.1"; // Your MySQL host. This is "localhost" or the IP specified by your hosting company. $player_name=$_GET['player_name']; // This gets the player his name from the previous page. /* Next, we will make a connection to the mysql. If it can't connect, it'll print on the screen: Unable to select database. Be sure the databasename exists and online is. */ mysql_connect($host,$username,$password); // Connection to the database. @mysql_select_db($database) or die( "Unable to select database. Be sure the databasename exists and online is."); //Selection of the database. If it can't read the database, it'll give an error. /* To protect MySQL injection. */ $player_name = stripslashes($player_name); $player_name = mysql_real_escape_string($player_name); $query="SELECT * FROM `playerdata` WHERE user = '$player_name' LIMIT 1"; // Gets all the information about the player. $result=mysql_query($query); $i=mysql_num_rows($result); // Here we are counting how many rows this result gives us. /* We will now put the player's information into variables so we can use them more easily. */ /* DON'T FORGET: The names should be exact the same as in your mysql db.*/ if ($i == 1) // If the user has been correct, then it'll give us 1 row. If its 1 row, then it'll proceed with the code. { $Playername=mysql_result($result,0,"user"); // Gets the username of the player and put it in the variable $Playername. $Money=mysql_result($result,0,"kills"); // Gets the money of the player and put it in the variable $Money. $Score=mysql_result($result,0,"deaths"); // Gets the score of the player and put it in the variable $Score. // Creating of the .png image. header('Content-Type: image/png;'); $im = @imagecreatefrompng('mypicture.png') or die("Cannot select the correct image. Please contact the webmaster."); // Don't forget to put your picture there. $text_color = imagecolorallocate($im, 197,197,199); // RED, GREEN, BLUE --> Go to www.colorpicker.com, select a nice color. Copy the R/G/B letters provided by colorpicker and put them here. $text_username = "$Playername"; // This gets the information about player name to be showed in the picture. $text_score = "$Score"; // Same as above ^^ $text_money = "$Money"; // Same as above ^^ $font = 'myfont.ttf'; //Upload your custum font to the directory where this file is placed. Then change the name here. /* USAGE OF THE imagettftext: First ($im) shouldn't be changed. (16) is the text-size. (0) is the angle of your text. Change it, and you'll see what's going on. (20) is de X-coordinate of the text. (36) is the Y-coordinate of the text. */ imagettftext($im, 16, 0, 20, 36, $text_color, $font, $text_username); // Prints the username in the picture. imagettftext($im, 16, 0, 72, 69, $text_color, $font, $text_score); // Prints the score in the picture. imagettftext($im, 16, 0, 72, 99, $text_color, $font, $text_money); // Prints the money in the picture. imagepng($im); imagedestroy($im); } else echo('Username is not in our database. Please try again.'); // If the username doesn't exist (so the row is 0) then it'll give en error. mysql_close(); ?> Hi, I have a small code to display some data from mysql db as .png image, however the image loads but it doesn't show any data on it. php: <? $username=""; $password=""; $database=""; $host=""; $player_name=$_GET['player_name']; mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database. Be sure the databasename exists and online is."); $player_name = stripslashes($player_name); $player_name = mysql_real_escape_string($player_name); $query="SELECT * FROM characters WHERE name='$player_name'"; $result=mysql_query($query); $i=mysql_num_rows($result); if ($i == 1) { $name=mysql_result($result,0,"name"); $OnServer=mysql_result($result,0,"OnServer"); $hours=mysql_result($result,0,"hours"); header('Content-Type: image/png;'); $im = @imagecreatefrompng('1.png') or die("Cannot select the correct image. Please contact the webmaster."); $text_color = imagecolorallocate($im, 197,197,199); $text_username = "$name"; $text_hours = "$hours"; $text_online = "$OnServer"; $font = 'visitor2.ttf'; imagettftext($im, 2, 0, 39, 15, $text_color, $font, $text_username); imagettftext($im, 2, 0, 160, 15, $text_color, $font, $text_hours); imagettftext($im, 2, 0, 297, 15, $text_color, $font, $text_online); imagepng($im); imagedestroy($im); } else echo('Username is not in our database. Please try again.'); mysql_close(); ?> html: Code: [Select] <html> <head> <title>My title here</title> </head> <h1>Signature configuration.</h1> <p>Hello and welcome to the image configuration page.<br /> Before you can make your signature, we need in-game name, exact as it is.</p> <form action="signature.php" method="get"> Playername: <input type="Submit"> </form> </body> </html> sql dump: http://pastebin.com/zXHgCDpt Any ideas? (it's 6am in here so I probably missed something obvious, sorry about that) Hello i have some code which is suppose to create a simple captcha image...the code was working fine until it was moved from one location to another...now what it does is the image is created...but for some reason, it's not displaying the text. Here is my code : Code: [Select] <?php session_start(); $image = imagecreate(100, 50); $background = imagecolorallocatealpha($image, 204, 204, 204, 127); $text = imagecolorallocate($image, 0, 0, 0); imagettftext($image, 20, 0, 30, 30, $text, 'Gabriola.ttf', $_SESSION['captcha']); $lines = 20; for($i = 0; $i <= $lines; $i++){ $x1 = rand(1, 100); $y1 = rand(1, 100); $x2 = rand(1, 100); $y2 = rand(1, 100); imageline($image, $x1, $y1, $x2, $y2, $text); } header('content-type: image/jpeg'); imagejpeg($image); ?> this code does create the gray box and displays the 20 lines but no text. when i echo out the $_SESSION['captcha'] on the page it displays the number generated (generated in another file)....i've even replaced that with a string and it doesn't work...the interesting thing about it is that it works on local machine but not on a hosted page...what could possibly cause this?...all the files were changed so the .ttf file is also within the same file as this page Imagettftext() - Just can't get it to work Hi ALL I'm trying to create a simple font tester. Imagettftext() looks perfect but I can't get it to work. I'm using this piece of code from php.net. Nothing is output and I get an error message in Firefox: The image "http://www.ttmt.org.uk/test/index.php" cannot be displayed because it contains errors. The font is available in the same location as the php file. http://www.ttmt.org.uk/test/index.php Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title> </head> <body> <?php // Set the content-type header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'corbelb.ttf'; // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> </body> </html> I'm writing a Dynamic image, that display's a user's Name, but for some reason, the kills stat won't print. I made a .php file using the same parsing method, but using echo, and it worked fine. I also know it's not an issue with X,Y, Size, float, anything like that because I tried replacing "$kill" with "Test," and it printed fine. Here is the actual image: And here is the code for it: <?php Header ('Content-type: image/jpeg'); Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); Header('Pragma: no-cache'); // get CMID variable from the url $cmid = $_GET['cmid']; // create the image using your own background $image = imagecreatefromjpeg("background.jpg"); // dimensions of the image used $img_width = 600; $img_height = 9; // set the colours $cool = imagecolorallocate($image, 81, 86, 96); $black = imagecolorallocate($image, 0, 0, 0); $white = imagecolorallocate($image, 255, 255, 255); $red = imagecolorallocate($image, 255, 0, 0); $grey = imagecolorallocate($image, 204, 204, 204); $green = imagecolorallocate($image, 206, 129, 18); $blue = imagecolorallocate($image, 0, 0, 255); $yellow = imagecolorallocate($image, 225, 225, 0); // set the font and print text $font = 'Verdana.ttf'; /* // counter - CHMOD your counter file to 777 $viewss = file("views.txt"); $views = $viewss[0]; $views++; $fp = fopen("views.txt", "w"); fwrite($fp, $views); fclose($fp); $counter = "$views"; // View Output imagettftext($image, 7, 0, 16, 117, $yellow, $font, "Views:$counter"); */ // Attempt to make web content grabber. function get_url_contents($url){ $crl = curl_init(); $timeout = 5; curl_setopt ($crl, CURLOPT_URL,$url); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); $ret = curl_exec($crl); curl_close($crl); return $ret; } // Web content grabber execution. $returned_content = get_url_contents('http://uberstrike.cmune.com/Profile?cmid=' . $cmid); // Parsing the returned content for Clan Tag. $namestart = strpos($returned_content, '<span style="color: #FEC42C; font-size: 20px; font-weight: bold;">'); $nameend = strpos($returned_content, '</span>', $namestart); $name = substr($returned_content, $namestart, $nameend-$namestart); // Stripping the parsed Clan Tag of HTML elements. $name = html_entity_decode(strip_tags($name)); // Clan and name output. imagettftext($image, 7, 0, 53, 7, $yellow, $font, "$name"); // Parsing the returned content for Global Rank. $rankstart = strpos($returned_content, '<h2 style="font-size:14px; font-weight:bold; text-indent:0px; margin-left:25px;">'); $rankend = strpos($returned_content, '<br />', $rankstart); $rank = substr($returned_content, $rankstart, $rankend-$rankstart); // Stripping the parsed Global Rank of HTML. $rank = html_entity_decode(strip_tags($rank)); // Filtering Rank to only show the value number, not text or formatting in between. $rank = str_replace ("G", "", $rank); $rank = str_replace ("l", "", $rank); $rank = str_replace ("o", "", $rank); $rank = str_replace ("b", "", $rank); $rank = str_replace ("a", "", $rank); $rank = str_replace ("R", "", $rank); $rank = str_replace ("n", "", $rank); $rank = str_replace ("k", "", $rank); $rank = str_replace (":", "", $rank); $rank = str_replace (" ", "", $rank); // Rank Output. imagettftext($image, 7, 0, 220, 7, $yellow, $font, "$rank"); $killstart = strpos($returned_content, '<h3 style="color: #FEC42C;">All time record</h3>'); $killend = strpos($returned_content, '</tr>', $killstart); $kill = substr($returned_content, $killstart, $killend-$killstart); // Stripping the parsed kill of HTML. $kill = html_entity_decode(strip_tags($kill)); // Filtering kill to only show the value number, not text or formatting in between. $kill = str_replace ("K", "", $kill); $kill = str_replace ("i", "", $kill); $kill = str_replace ("l", "", $kill); $kill = str_replace ("A", "", $kill); $kill = str_replace ("t", "", $kill); $kill = str_replace ("m", "", $kill); $kill = str_replace ("e", "", $kill); $kill = str_replace ("r", "", $kill); $kill = str_replace ("o", "", $kill); $kill = str_replace ("d", "", $kill); $kill = str_replace ("c", "", $kill); $kill = str_replace ("s", "", $kill); $kill = str_replace (" ", "", $kill); // Kill Stats output. imagettftext($image, 7, 0, 410, 7, $yellow, $font, "$kill"); // IP Logger $logfile= 'iplog.html'; $IPlog = $_SERVER['REMOTE_ADDR']; $logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://www.ip2location.com/demo.aspx?ip='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>'; $fplog = fopen($logfile, "a"); fwrite($fplog, $logdetails); fwrite($fplog, "<br>"); fclose($fplog); // output and destroy imagepng($image); imagedestroy($image); ?> I tried using the same parsing code for the $kill stat, and it works fine: http://dynfosig.com/Phoenix_uploads/clangadget/Test.php?cmid=563853 <?php // get CMID variable from the url $cmid = $_GET['cmid']; function get_url_contents($url){ $crl = curl_init(); $timeout = 5; curl_setopt ($crl, CURLOPT_URL,$url); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); $ret = curl_exec($crl); curl_close($crl); return $ret; } $returned_content = get_url_contents('http://uberstrike.cmune.com/Profile?cmid=' . $cmid); $killstart = strpos($returned_content, '<h3 style="color: #FEC42C;">All time record</h3>'); $killend = strpos($returned_content, '</tr>', $killstart); $kill = substr($returned_content, $killstart, $killend-$killstart); // Stripping the parsed kill of HTML. $kill = html_entity_decode(strip_tags($kill)); // Filtering kill to only show the value number, not text or formatting in between. $kill = str_replace ("K", "", $kill); $kill = str_replace ("i", "", $kill); $kill = str_replace ("l", "", $kill); $kill = str_replace ("A", "", $kill); $kill = str_replace ("t", "", $kill); $kill = str_replace ("m", "", $kill); $kill = str_replace ("e", "", $kill); $kill = str_replace ("r", "", $kill); $kill = str_replace ("o", "", $kill); $kill = str_replace ("d", "", $kill); $kill = str_replace ("c", "", $kill); $kill = str_replace ("s", "", $kill); $kill = str_replace (" ", "", $kill); // Kill Stats output. echo $kill; ?> * Moderator Note: Please do not remove code snippets from the question. Hi I'm creating a program that creates an image from an input using imagettftext(). Is there a way I can force a new line if the text exceeds the permitted image width? Thanks in advance Ste Hi All, I am getting this problem for one of my site that i am developing . When I insert special characters string like thi's ~!@#$%^&*()_+| the code is unable to convert it into right image with all text on it when the chosen font in trajanpro.ttf, but when I change the font with Ariel it work's fine. If anyone want to check this problem then you can check at this link http://www.centralstationery.com/produc ... ate_id=231 Click the text on card and a pop up will open and then change the font to Ariel then the image on card will be converted into right text. The code is imageSaveAlpha($image, true); ImageAlphaBlending($image, false); $bgcolor = imagecolorallocate($image, 200, 200, 200); $transparentColor = imagecolorallocatealpha($image, 200, 200, 200, 127); imagefill($image, 0, 0, $transparentColor); // pick color for the text $fontcolor = imagecolorallocate($image, $red, $grn, $blu); // fill in the background with the background color imagefilledrectangle($image, 0, 0, $width, $height, $transparentColor); $x = 0; $y = $fontsize; imagettftext($image, $fontsize, 0, $bx, $by, $fontcolor, $font, $quote); $final_image=DIR_USER_EDITOR.$new_image; // output image to the browser imagepng($image, $final_image); // delete the image resource imagedestroy($image); Thanks in advance Well, I have been tryna figure this out for days but it wont seem to work. The base image appears fine but it wont write the text or the avatar on it. Code: [Select] <?php //Do Not Cache header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); //Getting Variables $user = "Dusaro"; $rank = "Administrator"; $a = "0"; if(isset($_GET['a'])) { if(!empty($_GET['a'])) { $a = $_GET['a']; } } if(isset($_GET['u'])) { if(!empty($_GET['u'])) { $user = $_GET['u']; } } if(isset($_GET['r'])) { if(!empty($_GET['r'])) { $rnk = $_GET['r']; } else{$rnk='Administrator';} } else{$rnk='Administrator';} if(isset($_POST['u'],$_POST['r'],$_POST['a'])) { if(!empty($_POST['u'])) { $user=$_POST['u']; } if(!empty($_POST['r'])) { $rnk = $_POST['r']; } if(!empty($_POST['a'])) { $a = $_POST['a']; } } //Setting up Image $image = imagecreatefrompng("base.png"); $avatar = imagecreatefrompng($a.".png"); $font = "US101.TTF"; imagecopymerge($image, $avatar, 0, 0, 0, 0, 100, 100, 100); $color = imagecolorallocate($image, 0,0,0); ImageTTFText ($image, "15", 0, 230, 0, $color, $font,$user); ImageTTFText ($image, "14", 0, 257, 96, $color,$font,$rnk); //Displaying Image header("Content-type: image/png"); imagepng($image); imagedestroy($image); imagedestroy($avatar); ?> can any1 help?
I need to draw various font sizes onto a canvas to create a web service. Wanting to protect my HD assets, the intent is to use PHP to populate the image with the necessary text, and then scale down the image before presenting it to the user. <?php $img = imagecreatetruecolor(750, 530); $black = imagecolorallocate($img, 0, 0, 0); $gray = imagecolorallocate($img, 125, 125, 125); $white = imagecolorallocate($img, 255, 255, 255); $font = realpath('../fonts/micross.ttf'); $size = 12; $spacing = 20; for ($x = 0; $x <= 25; $x++) { $box = imageftbbox($size + $x/10, 0, $font, "The longer the phase the more apparent the size difference should be"); $boxWidth = $box[2] - $box[0]; imagefilledrectangle($img, 5, $x*$spacing+5, $boxWidth+5, ($x+1)*$spacing+5, $gray); imagefttext($img, $size + $x/10, 0, 5, $spacing*($x+1), $white, $font, "The longer the phase the more apparent the size difference should be Font Size ".($size+($x/10))); } imagejpeg($img); imagedestroy($img); ?> You can see how despite the font size steadily increasing by 0.1, it sporadically jumps at what seem at first like random intervals, however if you increase the number of loops and log the data, you can see that it alternates between increasing every 0.7, and 0.8. Unfortunately that doesn't help me any, just some insight. if($last != $boxWidth) { $last = $boxWidth; echo $boxWidth." ".($size+($x/10))."<br>"; }
This outputs the current width and font size each time the text width changes. Hi, I am creating an image with a random number to use as a capcha. I've done the image creation before and had it working but now I have a font path error. However......I know my font path is the same...I didn't change it and it was working perfectly. What I changed was I made the image creation piece of code into a function...so I could return a value and use the function as a capcha....can you not use this image creation stuff in a function? The difficulty is getting hold of the random number to verify someone typed it correctly. If you have any ideas I'm open to other methods. My code is: function capcha(){ $capchatxt = rand(10000,99999); $font = '/includes/balloon.ttf'; $textarray = imagettfbbox(30, 0, $font, $capchatxt); $width = $textarray[2]-$textarray[0]; $height = $textarray[3]-$textarray[7]; $image = imagecreate($width+10,$height+10); $background = imagecolorallocate ($image, 255,227,232); $colour = imagecolorallocate($image, 0, 154, 239); // blue; $pink = imagecolorallocate($image, 239, 0, 144); // crimson pink; $peach = imagecolorallocate($image, 255, 227, 232); // pale pink; // Add the text imagettftext($image, 30, 0, 5, $height+5, $pink, $font, $capchatxt); header('Content-type: image/png'); imagepng($image); imagedestroy($image); return $capchatxt; } At the moment: The function and the font file are in the same folder. The file which is calling the function is in a different folder. BTW - Forgot to mention that right now I'm using localhost (xampp)...not a real server. Thanks for the help. IceKat Guys thanks for helping me solve the problem i had but now i have another problem and i am lost. i have included the code below for you to have overview.
This is the code:
<table style="width:100%; margin-left:auto; margin-right:auto"> im making a website it works fine on firefox but on ie doesnt work correctly. page looks weird i see the error is <? include("index/index_files/front/php/include.php"); ?> anyone can help me its in a <html> tab. Code: [Select] <?php require('config.php'); $sql = "SELECT m.Title as title , f.Reg_URL as reg FROM website_main as m JOIN website_front as f LIMIT 0,01 "; $result = @mysql_query($sql) or die(mysql_error()); echo "<table border='3'>"; echo "<font size='9'><tr> <th><FONT COLOR=red><center>Title</center></font></th> <th><FONT COLOR=red>reg</th> </tr></font>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table $reg = $row['reg']; echo "<tr><td bgcolor=''><center>"; echo $row['title']; echo "</td><td bgcolor=''><center>"; echo '.$reg.'; echo "</td></tr>"; } ?> I got a problem i try to use an attribute for $reg but only appears as .$reg. on website anyone know why? Parts i have problems with are $reg = $row['reg']; and echo '.$reg.';. thank you Hi, i use mysql_real_escape_string() function when insert in db, but when echo i use htmlentities($var, ENT_QUOTES, "UTF-8") Now problem is '\ in that text. In db it write text with single quote with \, example That\'s wrong, and when echo it show just the same like in db.. How can i fix this ? Elo, I'm creating a very simple image list that is function generated which pulls the source from a table in my database, this is my code Code: [Select] $output = "<ul>"; $img_src = get_all_image_src($sel_event['id']); while($src = mysql_fetch_array($img_src)) { for($i=0;$i <= 9; $i++) { $output .= "<li>"; $output .= "<a"; $output .= " class ='album'"; $output .= " rel='group'"; $output .= " href='/images/gallery/'" . $src['img_src'] . $i; $output .= ".jpg"; $output .= " title='sample 1'"; $output .= ">"; //Image Thumb $output .= "<img"; $output .= " src='/images/gallery/'"; $output .= $src['img_thumb_src']. $i . ".jpg"; $output .= "alt='image01' "; $output .= "title='sample title' />"; $output .= "tae"; $output .= "</a>"; $output .= "</li>"; } } $output .= "</ul>"; return $output; and the img src doesnt seems to add up... my folder structure is Sandbox>image>gallery>2011>Mall>Event>Thumbs where Sandbox is the main directory. i tried echoing the $src['img_src'] and it displays correctly the data to be added (which is 2011/Mall/Event/ plus $i and a .jpg) .. sorry noob here... any thoughts? am i missing a simple detail? i'm getting this erro "Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /***/***/*****.php on line 278 not an active session, starts new" this is the code: if ($phase = mysql_result(mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"),0,0)) { if ($phase=='5') { // mysql_query("DELETE FROM `as_support` WHERE `mission` = '$var2'"); // header("Location: https://www.**********/*******/*******.php"); } else { echo date('h:i:s') . ": PHASE is $phase<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; } } else { echo "not an active session, starts new<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; mysql_query("INSERT INTO `as_support` (`mission`, `phase`) VALUES ('$var2', '0')") OR DIE(mysql_error()); the first line is line no. 278 can someone please tell me what to do? tnx shirley Hi there, I have a map of America made in flash, where you click on a state and the page should display the SQL database information for that state in the HTML table - but instead all it shows is the first entry of the database regardless of which state you click and it doesn't display the 2 radio buttons. My code is as follows Flash Actionscript 3 (just showing one state) Code: [Select] function waClick(event:MouseEvent):void { var waURL:URLRequest = new URLRequest("restaurants.php?state=Washington"); navigateToURL(waURL, "_self"); } wa_btn.addEventListener(MouseEvent.CLICK, waClick); PHP code Code: [Select] <?php include("mvfconnect.php"); $theChoice = $_GET['state']; $query = "SELECT * FROM restaurants WHERE" .$theChoice; $result = @ mysql_query($query); if (!$result) { $message="Unfortunately we are having problems with this page, we promise to have it fixed as soon as possible"; die($message); } $num = mysql_num_fields($result); $i=0; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $show1=substr($row['state'],0,50)."..."; $show2=substr($row['city'],0,50)."..."; $show3=substr($row['rname'],0,50)."..."; $show4=substr($row['address'],0,50)."..."; $show5=substr($row['pnum'],0,50)."..."; $show6=substr($row['web'],0,50)."..."; $show7=substr($row['dishes'],0,50)."..."; $show8=substr($row['dish_details'],0,50)."..."; $show9=substr($row['challenges'],0,50)."..."; $show10=substr($row['challenge_details'],0,50)."..."; $show11=substr($row['youtube'],0,50)."..."; $show12=substr($row['images'],0,50)."..."; echo "<tr>". "<td>".$row['city']."</td>". "<td>".$row['rname']."</td>". "<td>".$row['address']."</td>". "<td>".$row['pnum']."</td>". "<td>".$row['web']."</td>". "<td>".$row['dishes']."</td>". "<td>".$row['challenges']."</td>". "<td id='state".$i."' style='display:none'>".$row['state']."</td>". "<td id='city".$i."' style='display:none'>".$row['city']."</td>". "<td id='rname".$i."' style='display:none'>".$row['rname']."</td>". "<td id='address".$i."' style='display:none'>".$row['address']."</td>". "<td id='pnum".$i."' style='display:none'>".$row['pnum']."</td>". "<td id='web".$i."' style='display:none'>".$row['web']."</td>". "<td id='dishes".$i."' style='display:none'>".$row['dishes']."</td>". "<td id='dish_details".$i."' style='display:none'>".$row['dish_details']."</td>". "<td id='challenges".$i."' style='display:none'>".$row['challenges']."</td>". "<td id='challenge_details".$i."' style='display:none'>".$row['challenge_details']."</td>". "<td id='youtube".$i."' style='display:none'>".$row['youtube']."</td>". "<td id='images".$i."' style='display:none'>".$row['images']."</td>". "<td><input type='radio' name='vid' id='vid".$i."' onclick='openVideo(".$i.")' /></td>". "<td><input type='radio' name='pic' id='pic".$i."' onclick='openImage(".$i.")' /></td>". "<td class='last'style='display:none'>".$show1." ".$show2." ".$show3." ".$show4." ".$show5." ".$show6." ".$show7." ".$show8." ".$show9." ".$show10."</td>". "</tr>"; $i++; } ?> I have used this code before and it has worked fine, can someone please help me out! I do not receive email for my published php file which is: <?php ///// easend.php ///// $youremail = "acdelco40108@yahoo.com"; /*put the email address here, between quotes, the email address you want the message sent to*/ $to = $youremail; $email = $_POST['EMail']; $name2 = $_POST['Name']; $street2 = $_POST['Street']; $city2 = $_POST['City']; $state2 = $_POST['State']; $zip2 = $_POST['Zip']; $Phone = $_POST['Home_Phone']; $Cell = $_POST['Cell_Phone']; $education = $_POST['email1']; $comments = $_POST['email2'] ; $headers = "From:" . $email; $fields = array(); $fields{"Name"} = "Name"; $fields{"Street"} = "Street"; $fields{"City"} = "City"; $fields{"State"} = "State"; $fields{"Zip"} = "Zip"; $fields{"Home_Phone"} = "Home Phone"; $fields{"Cell_Phone"} = "Cell Phone"; $fields{"EMail"} = "Email"; $fields{"email1"} = "Education"; $fields{"email2"} = "Comments"; $subject = "We have received the following information from your employment application"; $body = "We have received the following information from your employment application:\n\n"; foreach($fields as $a => $b) { $body .= sprintf("%20s: %s\n",$b,$_POST[$a]); } mail ($to, $subject, $body, $headers); //send mail to owner #end create email vars $headers = "From:" . $to; mail ($email, $subject, $body, $headers); //send mail to user #end create email vars echo "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=ThankYou.html\"></head>"; ?> Hi. I am from poland. I am 17 old age and like webmastering. I write my social network. I have new server 10 GB VPS and my script no runing In my server. in my server do can not login. No runing function Code: [Select] mb_strtolower();as delete function mb_strtolower() ; this login runing. In my server haven`t installing liberary GD and no runing upload avatars. my code upload is: elseif ($_GET['act'] == "upload") { echo <<< KONIEC <hr> <center> <p> <h2>Dodaj zdjęcie</h2> <ul class="gallery clearfix"> <li class="extra"> KONIEC; error_reporting(E_ALL); // we first include the upload class, as we will need it here to deal with the uploaded file include('include/class.upload.php'); // retrieve eventual CLI parameters $cli = (isset($argc) && $argc > 1); if ($cli) { if (isset($argv[1])) $_GET['file'] = $argv[1]; if (isset($argv[2])) $_GET['dir'] = $argv[2]; if (isset($argv[3])) $_GET['pics'] = $argv[3]; } // set variables $dir_dest = (isset($_GET['dir']) ? $_GET['dir'] : 'test'); $dir_pics = (isset($_GET['pics']) ? $_GET['pics'] : $dir_dest); if (!$cli) { } // we have three forms on the test page, so we redirect accordingly if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'simple') { // ---------- SIMPLE UPLOAD ---------- // we create an instance of the class, giving as argument the PHP object // corresponding to the file field from the form // All the uploads are accessible from the PHP object $_FILES $handle = new Upload($_FILES['my_field']); // then we check if the file has been uploaded properly // in its *temporary* location in the server (often, it is /tmp) if ($handle->uploaded) { // yes, the file is on the server // now, we start the upload 'process'. That is, to copy the uploaded file // from its temporary location to the wanted location // It could be something like $handle->Process('/home/www/my_uploads/'); $handle->Process($dir_dest); function TestProcess(&$handle, $title = 'test', $details='') { global $dir_pics, $dir_dest; $unlink = 'test/'. $handle->file_dst_name; $myid = $_SESSION['id']; $opis = htmlspecialchars(stripslashes(strip_tags(trim($_POST["opis"]))), ENT_QUOTES); $handle->Process($dir_dest); if ($handle->processed) { unlink("$unlink"); $link = ''.$dir_pics.'/' . $handle->file_dst_name .''; $addphoto = mysql_query("INSERT INTO photo VALUES('', '$myid', '$link', '$opis')"); echo <<< KONIEC <br> <center> <img src="$link" > <br> <br /> </center> KONIEC; } else { echo '<fieldset class="classuploadphp">'; echo ' <legend>' . $title . '</legend>'; echo ' Error: ' . $handle->error . ''; if ($details) echo ' <pre class="code php">' . htmlentities($details) . '</pre>'; echo '</fieldset>'; } } if (!file_exists($dir_dest)) mkdir($dir_dest); // ----------- $handle->image_convert = 'jpg'; $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 500; $handle->image_precrop = 15; $handle->image_watermark = "watermark_large.png"; $handle->image_watermark_x = 20; $handle->image_watermark_y = -20; TestProcess($handle, '15px pre-cropping (before resizing 800 wide), large watermark automatically reduced, position 20 -20', "\$foo->image_convert = 'jpg';\n\$foo->image_resize = true;\n\$foo->image_ratio_y = true;\n\$foo->image_x = 800;\n\$foo->image_precrop = 15;\n\$foo->image_watermark = 'watermark_large.png';\n\$foo->image_watermark_x = 20;\n\$foo->image_watermark_y = -20;"); } else { // one error occured echo '<fieldset>'; echo ' <legend>file not uploaded to the wanted location</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } // we copy the file a second time // we delete the temporary files $handle-> Clean(); } else { // if we are here, the local file failed for some reasons echo '<fieldset>'; echo ' <legend>local file error</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } echo <<< KONIEC <li> </ul> </p> </center> KONIEC; is it the only problem that isn`t installing GD as i have something off in php.ini ? Plise Help me Hi, im creating a script for a website that will list products, i have the basic construct which lists the products from the database but it lists then vertically, i have set the width of each 'product' to 200px so i could have around 3 colums and many rows. can anybody advise how i would make them run vertically aswell as horizontally? my code below: <?php include_once("include/globals.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="styles/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <?php //Get database Results $result = mysql_query("SELECT * FROM Products WHERE is_active = 1") or die(mysql_error()); //keeps getting the next row until no more records while($row = mysql_fetch_array($result)) { //echo results ($result) echo '<div id="holder">'; echo '<div class="title">' . $row['Name'] . '</div>'; //insert image here echo '<div class="image">'; echo '<img src="' . $row['image'] . '" width="100" alt="">'; echo '</div>'; echo '<div class="tag_line">'; echo $row['Tag_Line']; echo '</div>'; echo '<div class="price">Now Only: £'; echo $row['Website_Price']; echo '</div>'; echo '<div class="prod-footer"></div>'; echo '</div>'; } ?> </div> </body> </html> table structu Field Type Null Default Comments MIME ID int(11) No product_code varchar(255) No Name varchar(255) Yes NULL Tag_Line varchar(255) Yes NULL Description varchar(255) Yes NULL Specification varchar(255) Yes NULL Technical_Info varchar(255) Yes NULL Cost_Price_USD decimal(10,2) Yes NULL Cost_Price_GBP decimal(10,2) Yes NULL Built_in_delivery decimal(10,2) Yes NULL Trade_Price decimal(10,2) Yes NULL Trade_Plus_Price decimal(10,2) Yes NULL Website_Price decimal(10,2) Yes NULL Is_active int(1) No image varchar(255) Yes NULL |