Jump to content

5kyy8lu3

Members
  • Posts

    257
  • Joined

  • Last visited

Everything posted by 5kyy8lu3

  1. I have two things ya might look into. First, session variables for www.YourSite.com and YourSite.com (without the "www") are completely different. I force my site to use the www with a if statement checking for it, else not header("Location: www.YourSite.com"); Another thing, you should use session_start(); first thing after your <?php on ALL pages including ones you include. Even though they should inherit the parent document's session, it doesn't always work like that from what I saw in my own personal experience. It was an easy fix though, I just started putting session_start(); at the top of all of my php pages. Worth a shot if nothing else is working. here's the snippet i use to force the "www", you can use .htaccess if you prefer. <?php if ( $_SERVER['SERVER_NAME'] != 'www.YourSite.com' ) { header("Location: http://www.YourSite.com/"); } ?>
  2. glad to hear ya got it working! oh and like MT said: ALTER TABLE myarticles MODIFY COLUMN date TIMESTAMP gogogo
  3. try: FROM_UNIXTIME(date) = CURDATE() that's supposed to convert unix timestamp to date, so it should work in theory =)
  4. hmm I honestly don't know, I know mysql supports unix timestamp, but I just don't know if the functions used with DATETIME work with UNIX too without some conversion function (like php you can use strtotime()), wish I could tell ya. if you can't figure out a way to make the stuff work with your unix timestamps, you could make a new column with DATETIME and write a quick maintenance script to pull and convert your timestamps for your new column. it's not as fun as finding a real solution but it's always an option =)
  5. then from that point forward... $BLAH = 0; $BLAH2 = 6; if($BLAH = $BLAH2)//Equals TURE and then echo $BLAH would display 6 right? you're basically saving the contents of $blah2 into $blah, then using $blah to test for true/false. so basically, as long as $blah2 doesn't contain 0, null, or false, it should be true.
  6. nice, i'll have to save that snippet for when I have this problem again, I know I will =)
  7. yup. for one, even if you don't use DATETIME as your column type, if you do year, month, day, hour, minute, seconds, you go biggest to smallest so you can literally sort by that number. (like today's timestamp in that format would be a bigger number than yesterday's timestamp) but if you use DATETIME, you can even send a timestamp in like "20090920003900" and it'll automatically convert it to "2009-09-20 00:39:00" but yea, if you want to use mysql's built in date functions, like NOW(), CURDATE(), DATE(), etc, you should really use DATETIME
  8. hmmm that's weird, I hate messing with line breaks too. have you tried replacing \n without the \r? worth a shot if nothing else is working lol
  9. yea if you use a single equals sign it equates to true, but I'm not sure if that's what you're asking
  10. well it turns out it was as stupid mistake, but I'm still not sure why only half the image showed up white here's the problem code =) a:hover { color: #000000; background: #ffffff; } is there any way to specify that for only text? i'm way too lazy to add a class to all my text's anchor tags if i can do it some other way lol. there like a "text" element? like this? a.text:hover{} ? or something?
  11. like you copy pasted it word for word? i just changed the table name and column name so it works with my table and it worked just fine: SELECT ID, Timestamp FROM IPLog WHERE DATE(Timestamp) = CURDATE() ORDER BY Timestamp DESC LIMIT 20 returned: ID Timestamp 2586 2009-09-20 01:28:58 2584 2009-09-20 00:54:12 2585 2009-09-20 00:54:12 2583 2009-09-20 00:53:54 2581 2009-09-20 00:41:53 EDIT: by the way, what data type is your "date" column set to? I think it has to be DATETIME to work correctly, that or you have to put it into a VARCHAR column in a "suitable" format, like 20090920003900 or 2009-09-20 00:39:00. just a though
  12. I suck with regular expressions so I use str_replace("\r\n", "<br>", $string);
  13. SELECT * FROM myarticles WHERE DATE(date) = CURDATE() ORDER BY date DESC LIMIT 20
  14. the popup box that says "home" isn't from that alt tag, it's actually from the title="" tag. IE is bugged and it has title and alt switched, so in IE you would be correct. but i'm using firefox... here's the code: <td background="PixelPipeline.php?id=5114ed460e353dffghomesac4e4dbfd6213cea" width="73"> <a href="reflector.php?id=5f37a697b76ae16b745fe9c9011cdbfc363aec50"> <img src="/pix/SusanStorm.gif" width="73" height="29" border="0" alt="Home" title="Home"> </a> </td>
  15. Hi. I wrote a php script for image protection. It returns a table with the picture as the background of the table, and a transparent gif image that I use for the link. (wrap the anchor tag around that clear gif). When I mouse over, I get a weird white box thing. It's hard to explain so here are two screenshots: Normal: Mouse Over: I've tried border="0" and outline: none;. They seem to be for another problem. Any idea what's going on with my links?
  16. you could explode(" ", $string1); the string using space then compare the items in your arrays
  17. If ( ( $_SESSION['MakeCheck'] == "TRUE" ) AND ( $_SESSION['EngineSizeCheck'] >= '2000' ) ) { $_SESSION['SpecialOver2000'] = "TRUE"; }
  18. just block his IP lol. i'd guess he's hacking you with an injection or you have some bug he's exploiting
  19. wow oh wow, so much info. if there would've been a tutorial or sticky with all this info to begin with i think i would've been set =D thanks for all the input
  20. thanks! that's exactly what I needed. I'm not 100% on oop but that cleared alot of the confusion up. appreciate you taking the time to write all that out =)
  21. Hmm. I have lots of function I use but I don't see how using a class would be any different from having a php file with all my functions in it that I include. That's basically what I'm trying to figure out. You put your functions you use alot into a class, I put mine straight into a php file that I include. (which I do) That's what I'm not understanding.
  22. Hi. First off, I'm not here to start a OOP vs proc. flame war. I'm here because I'm trying to learn OOP and so far all the tutorials I've read have extremely simple examples in which the OOP takes 3-4 times the code to accomplish something vs procedural code. Like one tutorial I read used a class with a method to save a name to the variable and a method to get the value out of the variable. That took WAY more code to do than to just save the value straight to the variable and echo that string variable. I know there's more to OOP code than that, but the examples have been so simple I'm not grasping the purpose of it yet. Simple is good, but it's so simple I'm not getting the point of the OOP. Could someone write me or link me some "practical" example of SIMPLE object oriented php code where it makes more sense than to code it with procedural php? I absolutely love the concept of modular code, so I really want to learn it but I'm having a hard time understanding what OOP is all about. Basically, I need an example of how using OOP is better than just using functions. To help, I'll explain what I DO know. I know it helps keep code clean since you typically keep your class in a separate file you include/require. I know that functions are called methods and variables are called properties. I also know you can "reuse" a method with inheritance, which I could see being handy. I somewhat understand the keywords and syntax, but as far as theory, that's all I understand so far. ANY input at all would be much appreciated. (I've read several tutorials, and I own a few php books but none of them mention OOP, I'm guessing they were written before php5, and my friends who DO understand OOP can't explain it on a level I can understand) Thanks =)
  23. Hi. My buddy has a band and they produced a cd. They want me to design them a website to help promote and sell cd's. I know php and mysql fairly well. They want a demo video on the page that contains clips of each of their songs, which I figure I would just embed from youtube. That is a good enough solution to that problem I would assume, if not, please let me know of alternative routes that you'd think would be better. He wants to avoid selling songs individually and stick to selling the cd as a whole, to help promote their music and hope for a good record deal in the future. Would some automated paypal checkout system be the simplest/cheapest method for me/him? I've never used any "shopping cart" kind of software before. I figure paypal has everything already set up, he already has a paypal account, and it seems to be among the "cheapest" method of online payment. I've never checked prices for other checkout methods but I'm guessing paypal is pretty cheap. This is new material for me so any advice would be helpful. Thanks! Oh and this is for my buddy, I'm making the site for free (only thing he pays for is his own domain/hosting), so you aren't helping me get rich or anything lol I'm just helping a friend out.
  24. Ok I think I figured it out. Not sure what I did exactly but I made things more "definite" and it works this time around. here's the code incase anyone is curious of how my super primitive encryption works lol: <?php echo '<pre>'; function encrypt($Incoming) { for ( $i = 33; $i < 255; $i++ ) { $Codes[] = $i; } shuffle($Codes); $count = 0; for ( $i = 33; $i < 255; $i++ ) { $CryptTable[$i] = $Codes[$count]; $count++; } for ( $i = 0; $i < strlen($Incoming); $i++) { $Byte = substr($Incoming, $i, 1); $AsciiCode = ord($Byte); if ( ( $AsciiCode > 32 ) && ( $AsciiCode < 255 ) ) { $NewCode = $CryptTable[$AsciiCode]; $NewString = $NewString . chr($NewCode); } else { $NewString = $NewString . $Byte; } } for ( $i = 33; $i < 255; $i++ ) { if ( $CryptTable[$i] < 100 ) { $CryptTable[$i] = 'x' . $CryptTable[$i]; } $Key = $Key . $CryptTable[$i]; } $Keyed = substr($Key, 0, 333) . $NewString . substr($Key, 333); return($Keyed); } function decrypt($Incoming) { $Key = substr($Incoming, 0, 333) . substr($Incoming, -333); $string = substr($Incoming, 333, ( strlen($Incoming) - 666 )); $count = 0; for ( $i = 33; $i < 255; $i++ ) { $DeCryptTable[str_replace('x', '', substr($Key, $count, 3))] = $i; $count = $count + 3; } for ( $i = 0; $i < strlen($string); $i++ ) { $Byte = substr($string, $i, 1); $AsciiCode = ord($Byte); if ( ( $AsciiCode > 32 ) && ( $AsciiCode < 255 ) ) { $NewCode = $DeCryptTable[$AsciiCode]; $NewString = $NewString . chr($NewCode); } else { $NewString = $NewString . $Byte; } } return($NewString); } $a = encrypt("What is going on with this script???"); echo 'Encrypted: ' . $a . '<br><br>'; echo 'Decrypted: ' . decrypt($a); ?>
  25. i'm only playing with 32 through 126. example: <?php echo '<pre>'; for ( $i = 33; $i < 127; $i++ ) { echo $i . ' ' . chr($i) . '<br>'; } ?> which works fine. but when I decrypt my encrypted text, some characters show up as that "fffd" character, which google searching tells me means it's trying to display an invalid character, which is B.S. because I did a print_r() on my decryption table and all the ascii codes are within the 33-126, which ALL work fine using that above script. i'm stumped =*(
×
×
  • 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.