Jump to content

webproclaim

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

webproclaim's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm trying to change a field in a MySQL database from a text field to a decimal field. Below is a sample of what I am trying to do but it is not working as there is something wrong with the syntax. Would someone mind showing me a 'fixed' version of the code below. Thanks. $ModifyTable = "ALTER TABLE  tablename CHANGE fieldname fieldname DECIMAL(10,2) DEFAULT NULL";
  2. The following code produces the following error... Parse error: parse error, unexpected T_STRING in C:\Sites\mysite\testfolder\test.php on line 6 I changed the database.txt file to contain commas instead of tabs and I still get this error. Any ideas? <?php $file = file_get_contents("database.txt"); $lines = explode("\n", $file); foreach($lines as $key => $value){ $pieces = explode(",", $lines); $row_{$key}_1 = $pieces[0]; $row_{$key}_2 = $pieces[1]; $row_{$key}_3 = $pieces[2]; } echo $row_1_2; ?>
  3. php_joe...Do you have a quick example you could paste in here?
  4. I was having the same problem. What I did was created a script that made a session with a 5 digit random string and then wrote the string onto an image. I then make the user retype the string on the image and then double check what they typed with the string in the session. If it doesnt match, the form doesnt submit and they get an error that the 'send key' didnt match and can try and type it again (I have the other fields in the form repopulate from their prior contents using $_GET). This makes it very difficult for a bot to submit forms unless they also contained some sort of advanced OCR routine. Below is the code I use to set the session and make the image. This should be saved as a .php file but referenced from your form as an image... <?php // 200 is width / 30 is height $TheImage = Imagecreate("75", "25"); // We want to color the image Blue.. // We use 0x before the HEX value so you can use the hex value.. // If you do not use 0x then you must give in a 0-255 value for the color. $ColorImage = imagecolorallocate($TheImage, 180, 50, 23); // Color the text... $ColorText = imagecolorallocate($TheImage, 0, 0, 0); $ColorLine = imagecolorallocate($TheImage, 75, 75, 75); // printing the text: // $TheImage is so it prints on that image. // 14 is how large the font is // 0 is the rotation (add and the right side will tip up) // 15 is how far it is from the left side of the image // 20 is how far it is from the top of the image // $ColorText gives the text its color // Verdana is the font it uses // Some sample text is the text is prints... $secret = substr(md5(uniqid(rand())), 0, 5); $secret = strtoupper($secret); // Set the secret string as a session so I can compare the submitted value in the form to what was generated here. session_start(); session_register("SecretString"); $SecretString = $secret; imageline($TheImage, 75, 8, 0, 15, $ColorLine); ImageTTFText($TheImage, 12, -5, 16, 20, $ColorText, "times.ttf", $secret); // Let the browser know that it is an image.. header("Content-Type: image/PNG"); // We want to show the image (in png format...) ImagePng ($TheImage); imagedestroy($TheImage); ?>
  5. I need some help regarding how to read from a comma delimited text file as if it were a database. Suppose I had a file called file.txt with the following contents... Column1 Column2 Column3 c1r1value c2r1value c3r1value c1r2value c2r2value c3r2value I know how to do this with MySQL but not with a text file. I dont merely want to read the file to the page but be able to connect to it as a database and selectively read column values. Any help would be greatly appreciated.
  6. How about this... Is there any otrher way for me to get text to be displayed on my image WITHOUT having to use ImageTTFText. Can I write text in an image without using a TTF?
  7. Rich, In this particular case, the problem cannot be with anything in the code. Everything worked fine before we reformatted and resetup our server. I have the exact same code running on a different server along with the same php.ini file and exact copy of the DLL for GD2.
  8. Any ideas anyone? I have yet to solve this. This is one of those off PHP things that happen every so often that make me want to pull my hair out (what's left of it).
  9. More info... Looking at the PHP errors...the problem is that it cannot see the font. The font IS in the correct place though. I am running this on Windows 2003 Server. Any idea why PHP can't see the font? It's in the same directory as the file. Warning: Could not find/open font in C:\!Webs\mysite\codekeyimage.php on line 31
  10. bbaker, I tried it without the '.ttf' and it still doesnt work. It is like the ImageTTFText function is broken.
  11. I wrote this script that creates an image and then places a random string of characters on the image and runs a line thru them. (This is something I use along with forms to block bots from auto posting them if you are interested). Anyway, I just setup a new server and now this script it does not work properly. It creates the image and the line in the image, but the text does not appear on the image. I verified that the times.ttf file is the the proper place. Also, this new server is running the same version of PHP as my other server where this script works (even using an identical copy of the php.ini file). I just cant seem to figure out why this would work on one server and not the other. It has to be something system related but I just can't figure it out. Any help with this would be appreciated. <?php $TheImage = Imagecreate("75", "25"); $ColorImage = imagecolorallocate($TheImage, 180, 50, 23); $ColorText = imagecolorallocate($TheImage, 0, 0, 0); $ColorLine = imagecolorallocate($TheImage, 75, 75, 75); $secret = substr(md5(uniqid(rand())), 0, 5); $secret = strtoupper($secret); session_start(); session_register("Dingy"); $Dingy = $secret; imageline($TheImage, 75, 8, 0, 15, $ColorLine); ImageTTFText($TheImage, 12, -5, 16, 20, $ColorText, "times.ttf", $secret); header("Content-Type: image/PNG"); ImagePng ($TheImage); imagedestroy($TheImage); ?>
  12. I recently migrated to a new server and installed the latest version of PHP 4. I am also running Mcrypt. The problem is, code I used to sue to encrypt and decrypt information is not longer working. Below is a sample of the code that used to work. I suspect that mcrypt no longer supports my methodology. If someone could provide me with an alternative to doing exactly what you see below, I would be most grateful. <?php $key = "112233445566"; $ScrambleThis = "This text shall be scrambled"; echo $ScrambleThis; $Scrambled = base64_encode(mcrypt_ecb(MCRYPT_BLOWFISH,$key,$ScrambleThis,MCRYPT_ENCRYPT)); echo "<p>".$Scrambled; $UnScrambled = mcrypt_ecb(MCRYPT_BLOWFISH,$key,base64_decode($Scrambled),MCRYPT_DECRYPT); echo "<p>".$UnScrambled; ?>
  13. I am trying to get Mycypt to work with PHP 4.4.2 on a Windows 2003 Server. I have php_mcrypt.dll in my extensions directory and libeay32.dll in the Windows/System32 directory. The two dlls above came in the same distribution with PHP 4.4.2. I have GD installed and working so I have my extension sdirectory setup correctly. Here is the error phpinfo gives me about Mcrypt... 1 PHP Warning: Unknown(): Unable to load dynamic library 'C:\PHP\extensions\php_mcrypt.dll' - The specified module could not be found. in Unknown on line 0 Any help would be appreciated.
  14. That settles it! Today you are officially 'The Man'. Works like I charm. Thanks so much. [!--quoteo(post=372763:date=May 9 2006, 09:57 PM:name=alpine)--][div class=\'quotetop\']QUOTE(alpine @ May 9 2006, 09:57 PM) [snapback]372763[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try this: [code] ob_start(); require("receiptcode.php"); $msg = ob_get_contents(); ob_end_clean(); [/code] [/quote]
  15. I am trying to send the contents of another PHP via email using teh script below. I am writing an ecommerce system and need to have the store send out an HTML email receipt. In the script below, I need it to go out and get the file 'receiptcode.php', which is a dynamic PHP page that creates an HTML receipt, and email it to the client. If I use '$msg = include ("receiptcode.php");'. Rather than populating $msg with the contents of receiptcode.php, it actually writes the processed receiptcode.php file onto the page containing the script. I also tried using '$msg = file_get_contents("receiptcode.php");' and this gets me closer in that it will actually send out the email receipt and does not write out the receiptcode.php file on the page this script is on BUT, it does not process receiptcode.php so I get all the PHP scripts in the email, unprocessed by the server. I am sure I am just using the wrong function but I just can't seem to find what I am looking for. Any help would be GREATLY appreciated. <?php ini_set("SMTP", "mywebsite.com"); $to = $Email; $subject = "mywebsite.com"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; "; $headers .= "charset=iso-8859-1\r\n"; $headers .= "FROM: \"mywebsite.com\" <noreply@mywebsite.com> \r\n"; // THIS IS THE PROBLEM AREA // RECEIPTCODE.PHP IS DYNAMICALLY POPULATED FROM A DATABASE USING PHP //$msg = include ("receiptcode.php"); $msg = file_get_contents("receiptcode.php"); $msg = stripslashes ($msg); // END PROBLEM AREA mail($to,$subject,$msg, $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.