Jump to content

FrOzeN

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

Everything posted by FrOzeN

  1. <html> <head> <title>Example</title> <style type="text/css"> input {background-color: #82CAFA;} </style> <script type="text/javascript"> <!-- function txt_focus(textbox) { document.getElementById(textbox).style.backgroundColor = "#AFDCEC"; } function txt_blur(textbox) { document.getElementById(textbox).style.backgroundColor = "#82CAFA"; } //--> </script> </head> <body> <input id="t1" type="text" onfocus="javascript:txt_focus('t1');" onblur="javascript:txt_blur('t1');" /><br /> <input id="t2" type="text" onfocus="javascript:txt_focus('t2');" onblur="javascript:txt_blur('t2');" /><br /> <input id="t3" type="text" onfocus="javascript:txt_focus('t3');" onblur="javascript:txt_blur('t3');" /><br /> <input id="t4" type="text" onfocus="javascript:txt_focus('t4');" onblur="javascript:txt_blur('t4');" /><br /> <input id="t5" type="text" onfocus="javascript:txt_focus('t5');" onblur="javascript:txt_blur('t5');" /><br /> <input id="t6" type="text" onfocus="javascript:txt_focus('t6');" onblur="javascript:txt_blur('t6');" /><br /> <input id="t7" type="text" onfocus="javascript:txt_focus('t7');" onblur="javascript:txt_blur('t7');" /><br /> <input id="t8" type="text" onfocus="javascript:txt_focus('t8');" onblur="javascript:txt_blur('t8');" /> </body> </html> Is there a shorter way I can do this? Like a global event when a textbox has focus, and another one for when a textbox doesn't have focus? Thanks.
  2. Just tried both of them. Firebug is a bit useless with things as I have to select where to save the file everytime which is annoying, and it won't let me edit the full source. Even in parts I couldn't find anyway to modify JavaScript with it. As for Codetch it seemed much better but still seemed longer fidgeting around than an alt+tab between a text editor. It was also a bit confusing reading the source when it hasn't got any highlighting. Is there anything that's not bloated with features others than raw text editing? Thanks anyway.
  3. When I'm doing basic editing I just have a text editor and firefox open, and then switch between them. I'm wondering if there are any Add-ons for firefox that provide a text editor in the form of a tab. Eg, look at this screenshot: http://img117.imageshack.us/img117/5417/screenshotpf8.png Is there anything which would allow me to simple text editing like that (with line numbers + basic text-highlighting)? Thanks.
  4. Just a few quick questions, so I contained them to one topic. 1. I'm reading variables from $_COOKIE, $_GET, $_POST, and $_SESSION, and I need to filter them before inserting the information into a MySQL table. I came across these two functions: mysql_real_escape_string() and addslashes(). But I'm not to sure of the difference, so I don't know which one should be used where. Say $_POST['username'] contains Fr'Oz'e'N, and I then wanted to insert it into a MySQL table. What function do I run it through first? Also, I came across get_magic_quotes_gpc(). If I were to turn it on (not sure if it's on or off at the moment, never used it before). Would it automatically filter the variables? 2. I've seen numerous methods of doing this, but what's (well, generally) the best way to check if $_POST/$_GET contains any data, and if a $_SESSION exists or not? I'm asking this as from what I've seen, it involves checking all the parts of the array. Like if (!empty($_POST['username']) && !empty($_POST['password'])) {, etc. I'm curious to know if something like if (isset($_POST)) { can be done, or an efficient shortcut? And with sessions, I figured it would be a different method to the $_POST/$_GET as it registers an id. Would if (!empty(session_id())) { be suitable?, or is there a better way? (Note: not sure if this works, just an assumption). Thanks.
  5. How can I get classes to work with one another? Possibly parse a pointer address through to use them? Eg: [b]index.php[/b]: [code]include 'mysql.class.php'; include 'login.class.php'; $clsMySQL = &New MySQL_Wrapper; $clsLogin = &New LoginClass; $clsMySQL->db_host = "localhost"; // .... $clsLogin->something();[/code] Then in [b]login.class.php[/b]: [code]class LoginClass{     var $username;     var $example;     function test123() {         // I want to be able to parse the ability of allowing ALL my classes access to use clsMySQL without redeclaring it eveywhere.         // Eg:         $sql_result = $clsMySQL->sql_query("SOMETHING ...");         return $sql_result;     } }[/code] By pointer address I mean is it possible to setup something like: [b]index.php[/b]: [code]include 'mysql.class.php'; include 'login.class.php'; $clsMySQL = &New MySQL_Wrapper; $clsLogin = &New LoginClass; $clsMySQL->db_host = "localhost"; $clsLogin->objMySQL = &clsMySQL; // Parse it's address? // .... $clsLogin->something();[/code] [b]login.class.php[/b]: [code]class LoginClass{     var $username;     var $example;     var $objMySQL;     function test123() {         // I want to be able to parse the ability of allowing ALL my classes access to use clsMySQL without redeclaring it eveywhere.         // Eg:         $sql_result = $objMySQL->sql_query("SOMETHING ...");         return $sql_result;     } }[/code] Thanks. :)
  6. I think I'll go with the usual resizable column design. Then add some JavaScript for those using a windscreen. I think the extra effort is worth it for when I create my clan's gaming site. [EDIT] Also, for anyone interested. This monitor I got is absolutely awesome. I haven't had any problems, so I'd highly recommend it to anyone.
  7. I'm building a login system for a site, as well as the ability for users to register new accounts, etc. I'm trying to make it cover all the basic features as I build them in, that way I don't have to come back and continuously expand the table. Here's what I've currently come up with for the structure, and values/datatypes to store the information. As I haven't done anything like this before I'm looking for feedback on my setup. MySQL tables: [list] [*][b]Members[/b][list] [*]username - max. length 15 - VARCHAR(15) [*]password - max. length 20 - VARCHAR(71) - will be hashed, 71 characters to account for anything up to SHA-256 [*]cookievalue - VARCHAR(128) [*]email - max. length 255 - VARCHAR(255) [*]rememberme - BOOL - to determine whether or not to save a remember me cookie [*]joinedtime - TIME [*]joineddate - DATE [*]timezone - TINYINT - (+/-) amount of 30 minutes from server GMT eg: If server was GMT -5 and I lived in Sydney (GMT +10), when I picked my timezone it would set the TINYINT to 30 [*]datelightsavings - BOOL [*]membergroup - TINYINT - 0 = Head Admin, 1 = Admin, etc. [*]status - TINYINT - Banned, Suspended, Avaiting Email Validation, etc. [*]suspendeduntil - DATE [*]statusreason - VARCHAR(300) - moderators/admins whom ban/suspend users can leave a message that the member will see if they try viewing the site whilst suspended/banned, that way they 'know' what they did wrong [*]lastlogintime - TIME [*]lastlogindate - DATE [*]birthday - DATE [*]location - max. length 255 - VARCHAR(255) [*]title - max. length 255 - VARCHAR(255) [*]avatar - VARCHAR(255) - text link to image location [*]website - max. length 255 - VARCHAR(255) [*]msn - max. length 255 - VARCHAR(255) [*]aim - max. length 255 - VARCHAR(255) [*]yim - max. length 255 - VARCHAR(255) [*]icq - max. length 255 - VARCHAR(255) [*]postcount - INT [*]interests - VARCHAR(300) [*]signature - VARCHAR(500) [/list] [*][b]Temp Data[/b][list] [*]sessionid - VARCHAR(255) [*]sessionvalue - VARCHAR(64) [*]ipaddress - VARCHAR(15) [*]browserinfo - VARCHAR(255) - $_SERVER['HTTP_USER_AGENT'] [*]lastusetime - TIME [*]lastusedate - DATE [*]loggedin - BOOL [*]membername - VARCHAR(15) [/list] [*][b]IP Addresses[/b][list] [*]ip - VARCHAR(15) [*]status - TINYINT [*]reason - VARCHAR(300)[/list] [/list] [hr] Structure: [list] [*][b]Part 1 - Login[/b] [list][*][b]a)[/b] User visits webpage and their IP Address is matched against the 'IP Addresses' MySQL table to check it's status. If status isn't fine then the 'reason' value from that table is displayed to the user, and this will occur to them on all pages from that IP. There will also be contact information on that page which they can use to [i]try[/i] have there IP Address cleared if they have feasible reason as to why it should be. [*][b]a - exit)[/b] If IP Address isn't fine then exit at this stage. [*][b]b)[/b] If they already have a session, look it up and compare it's lastusetime/lastusedate to the current time/date. If it's within 20 minutes and the loggedin value is true, then login is complete and proceed to part 2. If it's within 20 minutes and doesn't have a loggedin value then skip to checking $_COOKIE info (1d). Otherwise, ignore the session info and treat it as new as it's setup in the next step. Note: After doing these checks, update the lastusetime/lastusedate. [*][b]c)[/b] If session isn't already created then do so giving it the value 'sessionvalue' (a random 64 character string). Then in the 'Temp Data' MySQL table create an row containing sessionid, the assigned sessionvalue, ip address, the unparsed browser info (HTTP_USER_AGENT) and the current server's time/date in lastusetime/lastusedate respectively. [*][b]d)[/b] Look up the 'Members' MySQL table for the cookievalue to see if it matches the the $_COOKIE['val'] saved on your computer. If it does then copy that 'username' across to the 'membername' value in the 'Temp Data' data and also set the 'loggedin' value to true. Login should now be complete, proceed to part 2. [color=red]Security note: Currently only using a random 128 character string to login users via cookie, open for other solutions.[/color] [*][b]e)[/b] Run $_POST values through a filter to avoiding security leaks. If $_POST['loggingin'] isn't set to '1' then ignore this step as the post info isn't to do with the login. If it is then look up $_POST['username'] in the 'Members' table. If it's there then encrypt the $_POST['password'] to whatever the current encryption method is (probably SHA1), and then match it against the one on the same row in the table. If they match then set the 'Temp Data' table to 'loggedin' equals 'true' and copy the 'username' across into the 'membername' value. Login is now complete. [/list] [*][b]Part 2 - Show page[/b][list][*]Will do after I have finished coding the login, this is just a stub section.[/list] [/list] My thoughts:[list][*]Possibly switch 1d and 1e so $_POST check is done before $_COOKIE. Need opinions on that. [*]Do $_COOKIE values need to run through a filter? Do they pose any vulnerabilities? (Like being able to change global variables, etc.) [*]Need ideas on method of encryption, the MD5 is broken so I don't want to rely solely on that. Would MD5(SHA1(password)) be substantial?[/list] I just typed this up then from the concept I had in my head, and it's 3AM in the morning. So may be a bit patchy. I only discussed the necessary parts regarding the login aspect. How does it sound so far? Any major problems, minor concerns, etc? All feedback is welcome, thanks. :)
  8. I got myself a [url=http://www.viewsonic.com.au/products/productspecs.php?id=264]ViewSonic 22" VX2235wm[/url] yesterday and have noticed a lot of websites don't use much of the width available (1650 pixels in my case). As I do web design I'm trying to make it account for all resolutions so the webpage will look great at all sizes, instead of just stretching to larger widths. I understand how to code it all to rescale and such, but I'm interested in seeing different concepts people have come up with for widescreen designs. The typical 3-column layout with the left & right sides fixed doesn't look that well as the middle becomes too wide. Possibly have 2 or 3 columns divided equally in the middle to share the content? Post ideas/examples (links) of websites you'd consider have an appealing look for widescreen users. :) [EDIT] Reworded post to remove ambiguity.
  9. Try: [code]<select name="subject" id="subject">     <option value="Purchasing Artwork">Purchasing Artwork</option>     <option value="Viewing Artwork">Viewing Artwork</option>     <option value="Commissions">Commissions</option>     <option value="Other" onSelect="document.getElementById('iAmHidden').style.visibility = 'visible';" />Other</option> </select> <div style="visibility: hidden;" id="iAmHidden"> <input name="reason" type="text" id="reason" value="Please Specify"> </div>[/code]
  10. How can I make it so two things (preferably divs or spans) sit on one line relative to where they are in the page. I'm trying to do this without the use of tables. With tables the code would look as follows: [code]...   <table width="100%" cellpadding="0" cellspacing="0" border="0">     <tr>       <td>Item 1</td>       <td align="right">Item 2</td>     </tr>   </table> ...[/code] [EDIT] Nvm, fiqured it out after a bit of playing around. Result: [code]<div style="float: left;">Item 1</div> <div style="text-align: right;">Item 2</div>[/code]
  11. Set cookie (30 days): [code=php:0]setcookie("name", "value", time() + 60 * 60 * 24 * 30);[/code] Remove cookie: [code=php:0]setcookie("name", "", time() - 3600);[/code] Is there a better way to make a cookie have a "Remember Forever" option? Also, is there specific way to remove a cookie?, or do you just set it one hour into the past?
  12. I want the page to take up 100%, except for 70px padding either side. But when a user resizes it so small that the middle* section is only the width of the banner, I then want the padding to become resized, and once it reaches 0px it then creates a horizontal scrollbar. middle* - being the page body excluding the side padding. http://www.clananthrax.net/example2.html As seen above, it's quite easily achieved with a table, but I'm wondering if I can set this up the same using a <div> instead? (The blue border is just to determine where the middle section sides are whilst working with it.)
  13. Thanks, I'll look into tweaking it with that. :)
  14. [quote author=neylitalo link=topic=110502.msg446828#msg446828 date=1159989559] Well, I'm a bit disappointed. I followed the link, saw this beautiful website appear, and then I looked at the source. Here I was, hopes up that somebody actually designed something that looked excellent on the first try, and it's a template. [/quote] Seven-labs.net is just a website owned by my friend. He's doing the template/design for me, specifically for this site (not something that'll be reused elsewhere). He sent me the .psd which looked like [url=http://img172.imageshack.us/img172/1733/templatehb4.gif]this[/url], and I've turned it into xhtml/css and added the menu and stuff. I haven't got around to adding the flowers at the bottom. [quote author=neylitalo link=topic=110502.msg446828#msg446828 date=1159989559] That aside, though, I think you should change the darker bars in the navigation to horizontal rather than vertical. The entirety of the rest of the site uses horizontal bars, and it doesn't look very good to have them mixed around. [/quote] Will do. -- The Google Ads will be on the site later on, so I'm just adding them to get a rough idea of what they look like in the layout. I may give registered members a option to disable them. PS: liQuid03x (poster above), is the person whom I'm building the site for. :)
  15. Other than a few simple pages, this is the first website I've made. My friend made the template in photoshop and then I just saved the images from it, and turned the rest into css. It still has some minor problems (incorrect widths) in IE, so I'm thinking to remove all the tables and switch them over to div's. http://frozen.myprose.net/ Post feedback of what you think of the initial layout. It's aimed at being a large database of Prose and Poetry which users can submit, comment/critique/rate, and browse/search to view others. I'll also be adding user profiles, a Private Messaging System, and an additional option for users to have their own blog.
  16. [quote author=michaellunsford link=topic=110382.msg446124#msg446124 date=1159894889] Is this even a PHP issue? I'm thinking if someone placed a SWF file on the server, they had ftp access at the very least. So, how do you protect against that? [/quote] Not sure. But it seems to be back, so either the hacker just re-added it (unlikely), or there is some form of script that put the file back, which could be a php script. It'd be best just to go over all these factors so you can determine how it happened. If you have a CPanel, or something similar. Check the ftp logs to see if someone actually uploaded the .swf file.
  17. A start would be to have a look over http://phpsec.org/projects/guide/ and see if any of the risks relate to your code.
  18. Don't worry as all you need to do is delete the file "/images/mainpage/dhh.swf", and remove the code: [code]<embed src="/images/mainpage/dhh.swf" hidden="true">[/code] -- I did a check on the other .swf files, it's the only offending one.
  19. [quote author=thorpe link=topic=110382.msg446087#msg446087 date=1159892617] [quote]I'm using firefox and it redirected me.[/quote] Well Im in Linux so Ive got no flash. Any chance the redirect may be occuring in your flash stuff? [/quote] Bingo! That also occured to me so I did a quick search for ".swf" and found this: http://www.detroithiphop.com/images/mainpage/dhh.swf I opened it in hex view found the link "http://www.churchofsatan.com" redirecting to "_parent". Simply remove it and your page should be back to normal. :) [EDIT] [s]Also, check for other ".swf"'s I didn't get around to that as you changed the page to a blank one.[/s]
  20. [quote author=ToonMariner link=topic=110213.msg445864#msg445864 date=1159871330] If you can cope with it give each cell a margin of 1px - it will leave a small gap between cells and IMO looks quite nice while removeing the 'complexity' of defining classes for various parts of the table. But I am very lazy! ;) [/quote] Just updated my code, now it doesn't use any classes. :D
  21. Read the comment below that function, someone posted an alternative. http://usphp.com/manual/en/function.ftp-chmod.php#66456
  22. Assuming the your computer doesn't have any proxie software installed to allow others to use your IP address as a proxie, can they attain the same $_SERVER['REMOTE_ADDR']? If so, could I get some links/suggests to other ways to add more authentication to avoid session hijacking.
  23. [quote author=ToonMariner link=topic=110213.msg445854#msg445854 date=1159869667] remove the border on the table - just have borders on the td's [/quote] That will still cause the parts where they meet to be double thickness. [s]I find when making table borders, I setup classes which I give to different parts of the table.[/s] Eg: [code]<html> <head>   <title>example</title>   <style type="text/css">     table {         border-right: 1px solid #000;         border-bottom: 1px solid #000;     }     td {       border-top: 1px solid #000;       border-left: 1px solid #000;     }   </style> </head> <body> <table width="100%" cellpadding="2" cellspacing="0" border="0">   <tr>     <td>Item (1, 1)</td>     <td>Item (1, 2)</td>     <td>Item (1, 3)</td>   </tr>   <tr>     <td>Item (2, 1)</td>     <td>Item (2, 2)</td>     <td>Item (2, 3)</td>   </tr>   <tr>     <td>Item (3, 1)</td>     <td>Item (3, 2)</td>     <td>Item (3, 3)</td>   </tr> </table> </body> </html>[/code] [EDIT] Update - Removed classes and moved the border-right/bottom to the table, now it's even easier. :)
  24. I'd always define it in the same piece of css as a:link, I would never seperate the two as it's not something I, or most users like. [code]a:link, a:visited {etc..}[/code]
  25. I'm not entirely sure on this, but I think -> is a pointer used to reference a function/variable to class (object). It makes sense having a read over [url=http://au.php.net/class]this[/url]. The sign *may* also be used for others things, not entirely sure as I'm quite new to php.
×
×
  • 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.