Jump to content

TapeGun007

Members
  • Posts

    307
  • Joined

  • Last visited

Everything posted by TapeGun007

  1. Ok, thanks... I will go look those up. I don't mind reading and research, just need a point in the right direction.
  2. Thank you gentlemen for the great input. However, I noticed something rather weird as it still fails to work. <?php header('Content-type: image/jpeg'); ?> test These are my first four lines of code, and I remarked everything else out. When I run this, I get a small broken image in the top left corner... and the word "test" never prints to the screen.
  3. I've read 100 posts on how to resize an image, and when I run this, it just spits out a bunch of garbage text (which when I pasted that in the original post, it deleted most of what I typed). I checked all the variables, and they are outputting the correct numbers. What am I doing wrong here?
  4. echo "<img src='test/zimages.jpg'>"; $thumb = ImageCreateTrueColor($finalwidth, $finalheight); $source = @ImageCreateFromJpeg('test/zimages.jpg'); ImageCopyResized($thumb, $source, 0, 0, 0, 0, $finalwidth, $finalheight, $width, $height); @ImageJpeg($thumb);
  5. Hey thanks. I called my web host, because I wasn't quite sure what you meant. I was able to move the files out of the public folder. Unfortunately, it's going to break a few things, but I can probably figure it out from here.
  6. I wrote a website some time ago that shares files for specific authorized individuals. Nobody can access the files without logging in. EXCEPT, Google has somehow scanned the directory, and if someone types in a key phrase specific enough, Google has a direct link to the file right in their seach engine. So, I placed a username/password on the folder. Now people can't access the files without entering this all the time. Unfortunately, neither can my users. So is there a way for PHP to automatically enter the username/password, or is there some other way to protect the files? Thanks for the help.
  7. I want to create a decoding tool. To do this, I want to create a database with every character in the db, and each character would have up to 255 possibilities for each character. The problem that I'm having is I want to automatically write each character into the database including special characters like single quotes, double quotes, and open parenthesis. I thought about trying something like this: $characters = Array( A,B,C,......); foreach ($characters as $c){ < pull the characters > < generate random code > < write to db > } But of course, certain characters like ")" cause a problem in an array. I thought maybe I could do it by character string or something like that, but I can't seem to find any code examples of that. Any suggestions? Thanks.
  8. I found an example on the web, plugged in the code, and it works! It is using the IF statement to prepare the variable as well. Here is the code: <?php include("db/dbconnection.php"); ini_set('display_errors',1); error_reporting(E_ALL); $UserFirstName = "John"; $UserLastName = "Doe"; $UserEmail = "[email protected]"; $UserCode = "1234"; $UserExpireDate = "2013-04-04"; /* Create the prepared statement */ if ($stmt = $mysqli->prepare("INSERT INTO Users (UserFirstName, UserLastName) values (?, ?)")) { /* Bind our params */ $stmt->bind_param('ss', $UserFirstName, $UserLastName); /* Execute the prepared Statement */ $stmt->execute(); /* Echo results */ echo "Inserted {$UserLastName},{$UserFirstName} into database\n"; /* Close the statement */ $stmt->close(); } else { /* Error */ printf("Prepared Statement Error: %s\n", $mysqli->error); } ?>
  9. I plan to fix that, it's just because I was a complete noob when I wrote the first query. The problem is, when I do searches on the web about MySQLi, I get half a dozen that give procedural examples, and half that were showing OOP, but not really explaining WHAT the code was doing and why you coded it one way or the other. After MUCH reading, it's finally starting to sink in.
  10. I took your code, and put it in it's own file. I then enabled errors, so I could see what was going on. The error I get from running your code sample above is Here is the exact code that I used: <?php include("db/dbconnection.php"); ini_set('display_errors',1); error_reporting(E_ALL); $UserFirstName = "John"; $UserLastName = "Doe"; $UserEmail = "[email protected]"; $UserCode = "1234"; $UserExpireDate = "2013-04-04"; $stmt = $mysqli->stmt_init(); $cmd = "INSERT INTO Users(UserFirstName, UserLastName, UserEmail, UserCode, UserExpireDate) VALUES (?,?,?,?,?)"; $stmt->prepare($cmd) or die ("Error with prepared statement.".mysqli_error()); $stmt->bind_param('sssss', $UserFirstName, $UserLastName, $UserEmail, $UserCode, $UserExpireDate); $stmt->execute(); $stmt->store_result(); $rows = $stmt->affected_rows; if($rows == 1) { echo "<b>Invitation updated in the db</b>"; }else{ echo "<span class='error'>Prepare Failed</span>"; } ?>
  11. The last line of code, "Prepare failed" comes up each time. I presume this has to do with the previous query, but I'm not sure how or why. I'm trying to move over from the regular MySQL to MySQLi so be gentle.
  12. //Grab Email and Expiration Code $query = "SELECT UserEmail, UserCodeExpire FROM Users WHERE UserEmail = '$UserEmail'"; $query_result = mysqli_query($mysqli, $query) or die (mysqli_error($mysqli)); $result = mysqli_fetch_assoc($query_result); // If there is no result, OR the user code has expired if ( !$result || $result['UserCodeExpire'] < date("Y-m-d")) { $stmt = $mysqli->stmt_init(); if(!stmt){ echo "<span class='error'>Initialization of Statement Failed</span>"; // Since the user doesn't exist, INSERT }else{ $cmd = "INSERT INTO Users(UserFirstName, UserLastName, UserEmail, UserCode, UserExpireDate) VALUES (?,?,?,?,?)"; if ($stmt->prepare($cmd)){ $stmt->bind_param('sssss', $UserFirstName, $UserLastName, $UserEmail, $UserCode, $UserExpireDate); $stmt->execute(); close(); echo "<b>Invitation updated in the db</b>"; }else{ echo "<span class='error'>Prepare Failed</span>"; } } }
  13. LOL. I so bad want to delete this thread. I discovered that it was working, but going to my spam.
  14. Here is my code: $to = $UserEmail; $subject = "Invitation - $UserFirstName $UserLastName"; $body = " blah blah"; $headers = 'From: [email protected]' . "\r\n". 'Reply-To: [email protected]' . "\r\n". 'Bcc: [email protected]'. "\r\n"; if (mail($to, $subject, $body, $headers)) { . . . } The code works great, except for one thing. The BCC does not work at all. Everything I read seems that I'm doing the correct thing, so apparently, I need a 2nd set of eyes... Thanks.
  15. I saw an error and made the following adjustment: $data = file_get_contents('http://www.freedomroadac.com/newsite/components/banners/bannerxml.xml'); $xml = new SimpleXMLElement($data);
  16. Ok, I think (hopefully), I'm on the right track here, let me give you more. The Bold is the link that points to the xml file. Index.php has the following JavaScript: <script type="text/javascript"> var cacheBuster = "?t=" + Date.parse(new Date()); // stage dimensions var stageW = 803;//"100%"; var stageH = 391;//"100%"; // ATTRIBUTES var attributes = {}; attributes.id = 'FlabellComponent'; attributes.name = attributes.id; // PARAMS var params = {}; params.bgcolor = "#ffffff"; /* FLASH VARS */ var flashvars = {}; flashvars.componentWidth = stageW; flashvars.componentHeight = stageH; flashvars.pathToFiles = ""; flashvars.xmlPath = "http://www.freedomroadac.com/newsite/components/banners/banner.php"; /** EMBED THE SWF**/ swfobject.embedSWF("http://www.freedomroadac.com/newsite/components/banners/preview.swf"+cacheBuster, attributes.id, stageW, stageH, "9.0.124", "http://www.freedomroadac.com/newsite/components/banners/expressInstall.swf", flashvars, params); </script> The only thing of importance is that the "flashvars.xmlPath= ..... banner.php" (I changed this from .xml to a .php file) So, I read up a little bit on the hanlder, tell me if I'm doing this correct. Here is banner.php: <?php // Tell the client that this is XML data header('Content-Type: application/xml'); $array = range(1,9); shuffle($array); $xml = new SimpleXMLElement('http://www.freedomroadac.com/newsite/components/banners/bannerxml.xml'); foreach($array as $number) { $item = $xml->addChild('item'); $item->addChild('title'); $item->addChild('path','http://www.freedomroadac.com/newsite/components/banners/Picture_'.$number.'.jpg'); $item->addChild('url'); $item->addChild('target','_blank'); $item->addChild('bar_color','0x683f3f'); $item->addChild('bar_transparency','70'); $item->addChild('slideShowTime','5'); } ?> Assuming I did this right (which I must not have, because it doesn't seem to work). Here is the bannerxml.xml file: <?xml version="1.0" encoding="UTF-8"?> <!-- slideShowTime - if set to 0, there is no autoslide --> <banner width = "803" height = "391" backgroundColor = "0xffffff" backgroundTransparency = "100" timerDisable="false" buttonsSide="left" buttonsMarginX="20" startWith = "1" controllerHeight = "25" autoPlay="true" fadeTransition = "true" verticalTransition = "false" controllerTop = "false" transitionSpeed = "1" titleX = "0" titleY = "0"> <items></items> </banner> This is my way of trying to better implement what you were saying. But I'm certainly not knowledgeable on the handlers, and will have to read more. The flash seems to run, but the images do not. It's the same thing that happens when it tries to load an image that doesn't exist basically. So something isn't quite right, I have a feeling it's how I reference the xml file. But maybe you can point me in the right direction.
  17. The original file is like this. I only included two <items>, but basically, it's just Picture_1.jpg through Picture_10.jpg. It's a rotating banner that goes through 10 JPG files. However, I wanted to randomize the images so they don't always just show picture 1, then 2, then 3, but rather in a random order. The only reason why I'm using XML in this case, is because I have a 3rd party deal, where a flash banner is compiled on the fly. They make a call to this XML file, but I want to use php to randomize the XML images. <items> <item> <title></title> <path>Picture_1.jpg</path> <url></url> <target>_blank</target> <bar_color>0x683f3f</bar_color> <bar_transparency>70</bar_transparency> <slideShowTime>5</slideShowTime> </item> <item> <title></title> <path>Picture_2.jpg</path> <url></url> <target>_blank</target> <bar_color>0x683f3f</bar_color> <bar_transparency>70</bar_transparency> <slideShowTime>5</slideShowTime> </item> ... Picture_3.jpg ... Picture_4.jpg ect </items> Here is what I want to do in PHP: <items> <?php $arr = str_split('123456789'); // get all the charaters into an array shuffle($arr); // randomize the array foreach ($arr as $a){ ?> <item> <title></title> <path>Picture_<?php echo $a; ?>.jpg</path> <url></url> <target>_blank</target> <bar_color>0x683f3f</bar_color> <bar_transparency>70</bar_transparency> <slideShowTime>5</slideShowTime> </item> <?php } ?> </items> But this doesn't work, so perhaps it's not possible, or I have the wrong syntax. Help?
  18. I had remarked the execution out to back track and forgot to put it back in. It works now. My bad.
  19. I'm replying because I work for an SEO company. Keep in mind that a majority of SEO work boils down to quality link builing more than anything else. Five years ago, the "on page" factors (the actual code of your website) had to be spotless to generate a decent ranking on Google. Today, as Google, Yahoo, and Bing completely ignore META tags, 90% of your SEO is going to come from building those quality links. In about 2-3 years, Google will change that, and may go to social media (or so I've heard them say on NPR). But for now, focus more on the link building.
  20. Yes, you are correct. However, now it simply does not update anything. Also, I did a echo $statement; And I get this: Update Leads SET FollowUpDate='2011-08-18' WHERE FollowUpDate<'2011-08-18' I purposely changed one date in phpMyAdmin to 2011-08-17, and it's not updating that record to 2011-08-18. Yet that nearly same command works fine in the SQL area of phpMyAdmin. So I am confused, must be improper syntax.
  21. I posted in here, because I know the SQL is correct. When I do this in phpMyAdmin, this works great: Update Leads SET FollowUpDate='2011-08-18' WHERE FollowUpDate<'2011-08-18' But in PHP I have the code written (and I've tried several different ways): $TodaysDate = date("Y.m.d"); $statement="Update Leads SET FollowUpDate='$TodaysDate' WHERE FollowUpDate<'$TodaysDate'"; When I execute the SQL above, it actually resets all the dates to 0000-00-00... ug. What is the correct syntax? Thanks.
  22. Just to confirm, I used Update Backup_Of_Leads SET FollowUpDate='2011-08-18' WHERE FollowUpDate<'2011-08-18' And it worked fine. hehe. *egg on face*
  23. Well... duh... I wrote that while I was tired and it was late, and I went right to bed afterwards. I had thought about "date" being a potential reserved word, and changed it to FollowUpDate. Sorry guys, I'll go back and try it again with the correct table name.
  24. I'm simply using PHPMyAdmin until I get the php code finished, but I'm trying to do an Update command. Here is what I have so far: Update Backup_Of_Leads SET Date='2011-08-18' WHERE Date<'2011-08-18' Anything that is before today's date, I want to reset to today's date. Obviously my simple command above doesn't work. Any help?
  25. Ah... LOL. I answered my own questions. The call to the JavaScript wasn't working correctly for some reason in the include file. When I manually called the JavaScript from the page, and not in the include file, it worked just fine.
×
×
  • 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.