Jump to content

SharkBait

Members
  • Posts

    845
  • Joined

  • Last visited

    Never

Everything posted by SharkBait

  1. http://www.tyleringram.com/blog/Dual-19-inch-Widescreen-Monitors-with-DualView is a picture of my dual 19"s At work I use dual 17" Samsungs. If my video cards at work were better I would of been running dual 20.1" wide screen dell monitors. But one card in the machine is old and doesn't support higher than 1152x768 or something and well a 20" wide monitor doesn't look very appealing at 1152x768
  2. I personally wouldnt use tables. Tables are for TABULAR data. This is what i use for quotes something similar anyway: <?php function doQuotes($str) { $code = array("#\[quote\](.*?)\[/quote\]#is"); $html = array("<div class\"quote\"<span>Quote:</span>\n\\1</div>"); $str = preg_replace($code, $html, $str); return $str; } ?> So i use regular expressions to find within a str and then replace them with the <div></div> tags that are CSS formatted etc.
  3. When you're coding (php, web design etc) how is your work area laid out? For me I have dual 19" wide screen monitors. One monitor is for notepad++ to do my code in, as well as photoshop. The other monitor has IE, Firefox etc open so I can see my changes. I also sometimes have pieces of paper in front of my to sketch out layouts etc when I am brain storming. What about you?
  4. I have to look at the PHP manual once in a while when I forget which order certain arguments go in a function or forget how to display the date/time in a particular way. Usually happens when i haven't used a function in a while and I need to refresh my brain on it.
  5. Usually you cannot tell when someone logs out. They might close their browser, or click the 'logout' link or their computer might crash. Most system I see show a 'People Logged in the past 5 mins' and then query to see when the last activity was of the person on the site. If there was no activity for more than 5 minutes the system would assume they 'logged' out
  6. Hi, Ok trying to figure out a decent way of doing this. I have a blog (www.tyleringram.com) which is custom code and what I would like to try and accomplish is be able to write in a blog post say [poll=1]. Pretty much on my site where the poll is located on the left side, I would like to try and add that into the posts that explain what the poll is about. Which would be stored in the MySQL table for the post but when it gets displayed to the user reading the post the script would parse the [poll=1] and then fetch the proper script (html/code etc) which would display the poll to the user Pseudo Example: Script would parse the above text and then display the poll with the id of 3 to the user when they view it... Hopefully this make some sense.
  7. They are sent but you need to process them <?php if(!empty($_POST['valuename'])) { $MC_Name = $_POST['valuename']; } ?>
  8. Ok I am using this bit of code for an image that sits on top of a div tag to round out the top 2 corners: <div style="margin:0 auto; background-image: url('/images/top.gif'); background-repeat: no-repeat; height: 9px; width: 902px;"></div> <div id="mainContainer"> Now Firefox displays it properly and there is no gap between the top.gif div and the mainContainer div. The image is 902px wide by 9px in height. Now in IE it seems to add padding below the image or a gap between the two div tags and I am not sure why. #mainContainer { width: 900px; margin: 0 auto; text-align: left; padding: 0; border: 1px solid #36c; } What is it I am doing wrong that makes IE place a gap between the 2 elements?
  9. So if I use SELECT and not UPDATE, the SELECT will replace the value in the database with what I want as well as output it?
  10. I am needing to do a string replace on in a mysql database on a particular field and I am not sure what the best way about it is. This is my query for updating a field with a REPLACE(): UPDATE Units SET Full_SN = REPLACE(`Full_SN`, 'TR-CPQACN', '') WHERE Real_Date >= '2007-09-25 00:00:01' AND Real_Date <= '2007-10-25 23:59:59' AND Series = 'TRCPQ' AND `MOD` = '16cit' AND ID = 223766 It doesn't update any rows, am I doing the REPLACE() part properly?
  11. The attachment header would be included at the beginning of the email: Content-Type: multipart/mixed; boundary="==--somewhereboundaryhere==" And then the email attachment might look something like: Content-Type: x-application/zip; name="MyFile" Content-Transfer-Encoding: base64 Then its just data encoded which will have the boundary on a separate line. As for how to actually parse it.. that's something I haven't done, I've only created emails with attachments, not the other way around.
  12. Well as long as Apache (i am assuming you're running Apache as your web server) has the proper permissions to write outside of its root serving directory it should be able to write where ever you want it to. Though I've never done it before but I would think that is the logic behind it
  13. Lol thanks that works nicely
  14. I seem to be having troubles comparing dates in Javascript. This is how I am doing it function checkTime(id) { var DoM = document.getElementById(id).value; var Today = new Date(); var Minute = 60 * 1000; var Hour = Minute * 60; var Year = Hour * 365; var difference; Today = Today.getTime(); DoM = Date.parse(DoM); difference = Today - DoM; if(difference > Year) { alert("OOW"); } alert("Today: " + Today +"\n DoM: "+ DoM +"\n Year: "+ Year +"\n Difference: "+ difference); } the value for the id would look like "2006-04-12" and I don't think I am comparing them properly. I am trying to convert them to Unix time.. find the difference between today's date and the date entered and then see if it is greater than 1 year.
  15. Ok I see how the two above are different but why would I do it one way and not the other? Or are both valid?
  16. Not sure if i have this right... but I have a MySQL class that I want to use in a function of another class. Let's see if I can show it. Please correct me if I am wrong, I'm learning OOP <?php class MySQL { function DoQuery($query, $link) { // Do Stuff } } class FunStuff { function DoMore() { $blah = $MySQL->DoQuery('blah', 'blah2'); $query = $MySQL->FetchArray($blah); return $query; } } $MySQL = new MySQL(); $Fun = new FunStuff(); while($Fun->DoMore) { //Do more stuff } ?> What I am trying to do is be able to pass my $MySQL object into the $Fun class so I can use it to run queries. Now I don't know if its workable or if I am going about it wrong but I'd like to know Thanks!
  17. Oh yea.. silly me I forgot about that Thanks!
  18. Ok I am trying to concat some strings together but its acting a bit odd and hopefully someone can explain to me why it is doing it. <?php $emails_addresses = array("thank you" => "blah@blah.com", "Kim" => "blah2@blah.com", "Bob" => "bob@bob.com",); $email_group = array( 0 => array("thank you", "Kim"), array("thank you", "Bob") ); $string = ""; foreach($email_group[0] as $person) { $string .= "{$person} <{$email_addresses[$person]}>, "; } ?> Now what that does it because of the < and > it seems to strip out the email addresses. If i put spaces between the < and > so it looks like thank you < blah@blah.com > as opposed to thank you <blah@blah.com> it will show up, but I am curious why the < and > are stripping the email from the string. I have also done it this way and the same thing happens: <?php $string .= $person . " <". $email_addresses[$person] .">, "; ?> Am I missing some concept of strings?? Eventually this is what I want to have happen: $string = "thank you <blah@blah.com>, Kim <blah@blah.com>"; ** Note: Why is it I type T y together it comes up as Thank you ?? I don't have any weird text replace macros running on my machine.
  19. Hi, I am trying to write information to a file which will be then used to be imported into Excel. I noticed that some of the values that I am retrieving from a database have some sort of carriage return in them so after I have dumped the results to a database with a delimiter, some of the fields break the import because excel thinks its a new line. I've tried to replace chr(13) chr(10), \r\n, \n etc and I am not sure which one it is. The data that goes into the database is from simple textarea in an HTML form where the user can type whatever they want into it and use the enter key for w newline. Since nl2br() works with the database fields, I am assuming it reads the chr() value but which one is it I should be looking at to replace? Chr(10), Chr(13) combination of the two? The database/website is on a Linux machine if that helps.
  20. I figured out what the problem was. The $BODY and $HEADERS had too much white space after each line so the headers were not being set up properly. All fixed now <?php // Generate Boundary String $semi_rand = md5(date('r')); $mime_boundary = "x{$semi_rand}x"; $HEADERS = "MIME-Version: 1.0\r\n". "Content-Type: multipart/mixed; boundary=\"{$mime_boundary}\"\r\n"; $BODY = "This is a multi-part message in MIME Format \r\n". "--{$mime_boundary}\r\n". "Content-Type: text/plain; charset=\"iso-8859-1\"\n". "Content-Transfer-Encoding: 7bit\r\n". "{$message}\n\n"; $FILE = fopen("log.txt", 'rb'); //$FILETYPE = mime_content_type("log.txt"); $FILETYPE = "text/plain"; $DATA = fread($FILE, filesize("log.txt")); fclose($FILE); // Base64 encode the file data $DATA = chunk_split(base64_encode($DATA)); // Add the attachment to the message $BODY .= "--{$mime_boundary}\r\n". "Content-Transfer-Encoding: base64\n\n". "Content-Disposition: attachment; filename=\"log\"\r\n". "{$DATA}\r\n". "--{$mime_boundary}--\r\n"; if(!mail('blah@blah.com', 'Log File', $BODY, $HEADERS)) { echo "Error in sending Email"; } else { echo "Mail sent successfully"; } ?>
  21. When I am trying to send an attachment with an email it seems to go inline with the email and not attached. What am I doing wrong with my MIME headers? <?php $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_{$semi_rand}x"; $HEADERS = "MIME-Version: 1.0\n Content-Type: multipart/mixed; boundary=\"{$mime_boundary}\""; $BODY = "This is a multi-part message in MIME Format \n\n --{$mime_boundary}\n Content-Type: text/plain; charset=\"iso-8859-1\"\n Content-Transfer-Encoding: 7bit\n\n {$message}\n\n"; $FILE = fopen("log.txt", 'rb'); //$FILETYPE = mime_content_type("log.txt"); $FILETYPE = "text/plain"; $DATA = fread($FILE, filesize("log.txt")); fclose($FILE); // Base64 encode the file data $DATA = chunk_split(base64_encode($DATA)); // Add the attachment to the message $BODY .= "--{$mime_boundary}\n Content-Type: {$FILETYPE}; name=\"log.txt\"\n Content-Disposition: attachment; filename=\"log.txt\"\n Content-Transfer-Encoding: base64\n\n {$DATA}\r\n --{$mime_boundary}--\n"; if(!mail('my@blah.com', 'Log File', $BODY, $HEADERS)) { echo "Error in sending Email"; } else { echo "Mail sent successfully"; } ?>
  22. I've looked but can't seem to see any other posts (mind you my RockStar hasn't kicked in yet.. lol) but is there a way to subscribe to a thread via RSS? I have RSS Bandit always running and would love to be able to keep track of threads that I'd subscribe to this way. I dont like to subscribe to threads via email because.. well I don't lol! On my blog I offer the ability to subscribe to comments on a particular post via RSS and love it, well actually as the admin of my blog I also have a feed that keeps track of all comments made anyway... Does PHPfreaks have this for the forum, or could this be something added to the forum at a later time?
  23. this i what I have: /* CSS */ #headerMenu li ul li ul { display: none; } #headerMenu li ul li:hover ul { display: block; } .. <!-- HTML --> <ul id="headerMenu"> <li>Files <ul> <li>Admin</li> <li>Actions <ul> <li>Add</li> <li>Delete</li> </ul> </li> </ul> </li> </ul> Now the above CSS does not make the Add/Delete UL hidden and I am not sure why I am using this on Firefox for now, I knwo it wont work with IE but I want to get it working with Firefox before i get the DOM working using the Suckerfish method. Hopefully you can assume the rest of the CSS is there to space everything out properly. What is happening is that it always shows the block add/delete. It is never hidden.... Am I doing something wrong?
  24. Wow I like that a lot too. I mean it's a nice clean way of getting it to work with IE. Thanks! For those who want the link to the SuckerFish Drop down: http://www.alistapart.com/articles/dropdowns/
×
×
  • 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.