Jump to content

Koobi

Staff Alumni
  • Posts

    419
  • Joined

  • Last visited

    Never

Everything posted by Koobi

  1. Great, thanks for that :) Seems to work fine.
  2. [quote author=phpfreak link=topic=101153.msg400481#msg400481 date=1153409316] Yes, but it appears they got past that somehow. The screwed up thing is SMF sent them from my e-mail address. I'm getting hate mail right now from people. Wonderful! [/quote] Topic notifications come through your email address as well.
  3. i know maybe 0.00001% of assembly....actually i can barely remember any...but i was fascinated by it in school but could never really do anything in it...just read a bit of it here and there
  4. Hi, I'm not too good with JavaScript, I'm trying to figure out how I can detect if a user input in a text field has more than two decimal places. For example: 1. If user inputs 10.555, I would trigger an error 2. If user inputs 4.34, this should be fine 3. If user inputs 1.2 this would be fine too 4. If the user inputs 7, this is fine Any help? Thanks for your time
  5. i have about 5 years of intense PhotoShop usage under my belt. i'd rather you post the labels here if you don't mind.
  6. how about this instead: contact.php [code=php:0] <?php $title = 'My contact page'; include header.php; echo '<p>Contact me</p>'; include footer.php; ?> [/code] header.php: [code=php:0] <?php echo " <!-- Doctype and other necessary tags come here --> <title>$title</title> </html> <body> "; ?> [/code] this is just an example. the system can be optimized but that should fix the str_replace() problem for you
  7. as far as i know, all WYSIWYG editors and all graphic editors that slice images for you and create the HTML don't produce proper markup. they may sometimes produce valid markup but i've never seen a program that produces semantically correct markup. you should do it by hand if you care about valid and semantically correct markup, if it doesn't take up too much of your time...but once you get used to it, you can bang some code together pretty quick.
  8. .htaccess is a part of Apache. you don't need to access any apache configs. just add what ShogunWarrior posted in an .htaccess file and save that .htaccess file to the working directory. but your XML file isn't valid to begin with. you would have to surround your XML in CDATA tags
  9. :Edit: akitchin has replied by the time i modified the code and posted it...but i'll post it anyway :) first you would have to tell me if you intend to upload files that can have two valid extensions like tar.gz, etc. if not, you would modify your code to this: [code=php:0] //put filename in a variable before checking file extension $filetypecheck = trim($_FILES['FileName']['name']); //put file's extension in a variable $extension = strrchr($filetypecheck, '.'); $validTypes = array('.zip', '.sit', '.jpg', '.pdf', '.tif', '.gif', '.epf', '.psd'); // check to see if a file was entered and if that file is a valid type if(!empty($filetypecheck) && in_array($extension, $validTypes)) { echo 'valid upload format'; } else { echo 'invalid upload format'; } [/code] there's a bunch of other things you should look into if you want to strictly allow only files of a certain type but it seems like you're not very particular about that so this should work ok as far as i know. hope that helped :)
  10. [quote author=jo.nova link=topic=100459.msg396480#msg396480 date=1152808755] I'm trying to isolate the file extension of  uploaded files so that I can check them for validity.  For example, say I want to only accept ".zip" files: Let's say the value of $_FILES['somefile']['name'] is "afile.zip"; I want to put just the extension in a variable and check it against a predefined set of strings.  I can setup the string filtering, but I don't know how to tell PHP to look at just the last three characters in a file name. Any help? [/quote] the thing is, an extension can be more than 3 characters so you wouldn't be doing a thorough job if you looked at the last 3 characters. also, a file can be a text file and have a ".zip" extension or it could be a malicious exe and have a ".jpg" extension. and if you plan to upload files such as tar.gz or tar.bz, etc (files with more than one extension - in this example, the file is an archived and compressed file), you would have to have some sort of work around to detect such extensions. there are two options: 1. maintain an array of files with more than one extension that you permit. and first check if the last two blocks of characters (by a period) are in the array (using in_array()) that you maintain. if not, take the block of characters after the last period and check against that. i used to use this: [code=php:0] echo end(explode('.', $fileName)); [/code] but i think akitchin's strrchr() is faster than an explode. 2. match the value of $_FILES['upload']['type'] or mime_content_type() against an array of allowed MIME's and allow or disallow accordingly. you might find this useful: [url=http://www.ace.net.nz/tech/TechFileFormat.html]Almost Every file format in the world![/url] or you could refer to /etc/mime.types if you're on a linux machine.
  11. it totally depends on what you want to do. what do you intend to use cookies/sessions for?
  12. Here's my code: [code=php:0] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>test</title> </head> <body> <?php function in($string) {       return  htmlentities($string, ENT_NOQUOTES); } function out($string) {         return html_entity_decode($string, ENT_NOQUOTES); } //these are the rights reserved and copyright symbols, respectively //this board is encoding it but in my code, it's the actual symbol $string = '®©'; echo 'String: ' . $string; echo '<hr /><pre>'; echo 'In: ' . in($string); echo '<hr />'; echo 'Out: ' . out($string); echo '</pre>'; ?> </body> </html> [/code] this is my output: [code] String: ®© ─────────────────────────────────────────────────────────────────────────────── In: ®© ─────────────────────────────────────────────────────────────────────────────── Out: ®© [/code] as you can see, i'm using UTF-8. i don't understand why i see the characters preceeding the "copyright" and "rights reserved" symbol. i've tried this in Firefox on Linux and Elinks but i get a similar result. i typed the code in vim editor so i doubt any special characters were entered. any idea, anyone? thanks for your time.
  13. to answer your first question: i don't think what you saw was errors. i believe they were more like warnings. you should post your "errors" warnings are expected your case where you don't seem to have initialized your variables which is considered good practice. i don't see how this makes sense: [code=php:0] while ($row = mysql_fetch_array($result, MYSQL_NUM) {   $row[0] = $name; } [/code] wouldn't you want to do it the other way around? assigning values works from left to right. as for the second question, reserved words can't be used in MySQL, as far as i know. so, regardless if you used it with a parenthesis to enclose them or not, it would still cough up since those are reserved words.
  14. I forgot to post this earlier but this site has some great how-to's for Ubuntu, Fedora and Mandriva. i've used the ubuntu guide extensively for setting up my distro. http://easylinux.info/wiki/Main_Page
  15. well then i think Ubuntu is for you. there are other beginner distro's as well but what stands out the most about Ubuntu is it's hardware support. so, as a beginner, you won't spend hours scratching your head wondering how you can configure your hardware.
  16. i'm assuming your options have no spaces in them since you haven't stated otherwise. if it does, you would probably have to use regular expressions. but for now, how about: [code=php:0] $values = explode(' ', $line, 3); [/code] the above code will explode by a space and only three times. once 3 explodes are executed, it will stop. :edit: ShogunWarrior just posted while I was posting. do we have to parse $line itself as well? or is $line already parsed at this point? if you have to parse the entire line and if there's a space on either side of the equals sign, use 5 instead of 3 and disregard the first two indices of the array $values
  17. As far as I know, all Linux distro's handle Apache and PHP the same. I'm not sure which distro's come with PHP preinstalled. if you want to learn linux and want something easy, i'd suggest Ubuntu purely because you're new to Linux. But if you know Linux, you might get bored with it. you'll find this thread useful: [url=http://www.phpfreaks.com/forums/index.php/topic,100080.0.html]good free linux OS[/url]
  18. Hi guys, This is for a colleague of mine. I'm not too familiar with JavaScript so i thought I'd ask here. The problem is, we are trying to make some text blink every 500ms and this is the code I use: [code] <script type="text/javascript"><!-- function changeColour(elementId) {     var interval = 500;     var colour1 = "#00f", colour2 = "#f00";     if(document.getElementById)     {         var element = document.getElementById(elementId);         element.style.color = (element.style.color == colour1) ? colour2 : colour1;         setTimeout("changeColour('" + elementId + "')", interval);     } } //--></script> [/code] this doesn't seem to work on Firefox for Linux. I was hoping you could help me out with this. Thanks for your time.
  19. [quote author=neylitalo link=topic=100080.msg395464#msg395464 date=1152659742] And the name of the package manager is actually Portage, which is indeed based on the BSD Ports system. [/quote] i might be mistaken, but isn't portage a part of the main package management system which is Emerge?
  20. i can't remember exactly what the error is related to...but if i remember correctly, it's to do with how you connect to mysql please post lines 250 through 260 of C:\apache\htdocs\phpmyadmin\lib.inc.php, here
  21. you might enjoy this thead then: [url=http://www.phpfreaks.com/forums/index.php/topic,100080.0.html]good free linux OS[/url] since you say you are familiar with Linux CLI, why not go for Gentoo? Anyway, check out that thread.
  22. also it isn't fun when you have no time to compile and satisfy every dependency. i was installing a program a month ago on a remote server and i had to satisfy some 20+ library dependencies and let me tell you it was NOT fun! basically, apt and emerge check for dependencies. for example, if you install something like vim editor, you will need some ncurses libraries and emerge and apt will tell you that you need those libraries when you attempt to install vim and if you allow it to, it will even satisfy those dependenceis for you which is awesome if you're pressed for time. i prefer compiling from source to using RPM's. most...or at least a good make file (in a source installation) will let you do this: [code] make check [/code] (which is the step after you 'make' and before you 'make install') which will inform you of dependencies. generally, compiling from source consists of the following commands: [code] $ cd /path/to/source $ ./configure --with-myOption --with-otherOptions --with-moreOptions $ make $ make check #optional but recommended $ make install [/code] you would need super user status (su or sudo, depending on the distro) for 'make install' if you're installing the program on the entire system.
  23. yeah freelancing can be a bit*h sometimes :/ it's either REALLY good or REALLY bad. anyway, about paying 50% up front. not many clients would do that...unless they know you and your work. you're lucky you have such clients. most won't go over 40%
  24. i don't know if you can pull a payment off a situation like this... generally, you would have a set number of days within which they would have to respond. i would say 75 days. if they don't respond, then they are no more a priority though they would still be your responsibility since it would be unethical to a certain extent to just leave them hanging after taking that advance no matter how much you think you deserve it....IMO. it sounds a bit harsh but i think you might have to implement something like this when necessary because you have other things to do as well. but you should make such a condition known to the client at the initial inception.
×
×
  • 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.