redbullmarky
Staff Alumni-
Posts
2,863 -
Joined
-
Last visited
Never
Everything posted by redbullmarky
-
more of a maths question, but it'll depend what the MAX total could be. you'd need something like (ACTUAL TOTAL / MAX POSSIBLE TOTAL) * 100 which you'd need to check.
-
the reason why the other topic is now in Javascript help is because the problem has nothing to do with PHP itself. Please do not double post, and check beforehand that where you're posting is the most appropriate place.
-
the first error is your problem. the others are a knock-on effect. Is it a server you have full access to? If so, you'll need to make sure the permissions on the sessions directory are set up correctly to allow the session files to be created. is there any reason why you need to set up a custom session save path? if not, remove/comment out this line: [code] <?php session_save_path(ROOT . DS . 'tmp' . DS . 'sessions'); ?> [/code] and try again
-
you could actually send the feed dynamically. this would just avoid the need to have so many files. so a RSS Feed URL could look something like this: [quote] http://www.mysite.com/feeds/myfeed.php?post_id=2 [/quote] and the myfeed.php actually sends the necessary XML headers, constructs the feed (or loads it from cache, if you put this functionality in) and sends it out. I believe some feed readers are a little funny about non RSS/XML extensions (irrespective of headers sent), but nothing that a .htaccess file and a mod_rewrite rule couldnt sort out.
-
[quote author=Daniel0 link=topic=122346.msg508879#msg508879 date=1169249193] That thing about Windows always getting spyware and virus is just crap...etc...etc...etc [/quote] dude, who pissed on your chips? chill out, it's friday! i actually agree with your reasons rather than the strength of your arguments, and I do see where you're coming from re Apple vs Windows users. But it's no different to PHP vs ASP, Liverpool FC vs Manchester United, etc - it's easily dismissed (due to its weak relevence on anything important) as just pure mild biased banter. Personally, I have chipped in a few £ worth in anti-Microsoft arguments, but not because I hate them, but just because of me disagreeing with one or two things at the time. No biggie. I have a serious problem with Apple and their prices. The SAME problem I have with Stella Artois beer. It's TOO expensive, yet they a) admit it and b) have quality to back it up. Even still, it's still a problem I have. Sure, we have our preferences - but life's too short to get touchy about an OS though. Bring back the ZX Spectrum. THEN I'll show you how an addictive game, intuitive software and all-round user friendliness didnt need the likes of Windows, OSX or Linux desktops to kick ass ;)
-
php function to convert "FF" to "255"?
redbullmarky replied to michaellunsford's topic in PHP Coding Help
[quote author=michaellunsford link=topic=123189.msg508870#msg508870 date=1169248324] Thanks for the quick replies. I checked the manual and did a google search -- but I didn't know the right language. bin2hex looks like the magic. Thanks! [/quote] you mean hex2dec? ;) -
php function to convert "FF" to "255"?
redbullmarky replied to michaellunsford's topic in PHP Coding Help
[url=http://uk2.php.net/hex2dec]hex2dec[/url] should set you on your way ;) you'll just have to note that each pair in the 6 character hex string amounts to a number, so you will (as far as i know, unless there's another specific function) have to split it up first into 3 parts and then perform the hex2dec conversions. the user notes on the php manual hex2dec page does bring up the subject of converting colours though. cheers -
[quote author=jesirose link=topic=123144.msg508651#msg508651 date=1169223199] redbull - yeah after some AIM discussion we determined it's a notice, and I have notices turned off (amazingly on every system I've ever used!) I'm stubborn. :) [/quote] TBH, i was exactly the same until i started getting into frameworks recently and studying their code, and when i saw an 'isset' as WELL as a non-empty check or whatever, I looked into it a bit more. As far as I know and have read, until fairly recently, error reporting was set by default to E_ALL ~ E_NOTICE or something like that (and most hosts I used, including my current one, were the same), which basically had all the errors and warnings showing but not the notices. I used to just use an installation out of the box, and then (as you do) just turn off display_errors when the site goes live. In most cases, it's fine - but obviously the problem would become quite apparent if you had to shift an entire site over onto a server that (for example) has error_reporting set to the max and no way of changing it. So I actually agree in some ways that it's unnecessarily extra code and an extra function call, but the difference doesnt even register enough on the how-long-to-generate-this-page-o-meter to worry much about. Like you say though jesi - it's so uncommon for mosts hosts to have notices showing, or to have no way of knocking them off, that it [i]can[/i] come down to personal preference and shortcuts. For example, I use short tags (<? ?> and <?= ?>) and alternative PHP syntax when doing my templates, which a) is sometimes stated as bad practice and b) can also be turned off on some installations. Oh well ;D cheers
-
[quote author=jesirose link=topic=123144.msg508601#msg508601 date=1169219253] What I wrote won't return an error either, and it's shorter :-P [/quote] depending on the error_reporting level, it will return a 'notice - undefined index' which - although wont stop the script, it'll look a bit horrible with an message at the top of the screen. so whilst notices can safely be ignored/hidden without any detrimental effects, it's good practice to deal with them too. [code] <?php if (isset($_GET['action']) && $_GET['action']) { ... rest of code } ?> [/code] tis like a HTML/CSS validation warning. You dont HAVE to deal with it, and all things may work still the way intended, but it's always good to tidy up :)
-
i don't thing it's [i]too[/i] bad. at first glance, 2 things struck - the gradients are wildly overdone, as ober suggested, and it just seems like you've tried to squeeze as many gooogle ads in as possible. Not that I can't see the benefit of ads and earning money, etc, but I do tire of the amount of sites that look like revenue generating advert farms with a bit of content thrown in for good measure, when it should really be the other way around.
-
there are ways of tidying up the URL. Maybe one for another day, but look up mod_rewrite if you're using Apache....
-
it may not solve your problem, but worth noting on this line, just before your HTML starts: [code] header(sprintf("Location: %s", $insertGoTo)); exit; [/code] put an exit after the header line. redirecting with header like this only gets actioned once the script ends. meaning you send the header for a new location, but then HTML is output to the browser first....I've known the infamous "header error" to crop up before in this case....
-
i still have issues with the adverts being right in the middle. as jcombs pointed out, you have enough space on the right of the page to stretch things across a bit. wouldnt your ads be better down the side there, so that the bulk of the content can come UP a little bit? Also, the full-justified text in the 'News' column doesnt look right at all. Just having it as normal, default, left-aligned will do.
-
Looking for a book to design website properly
redbullmarky replied to fixxxer's topic in Miscellaneous
i'm with jcombs on this one. IMO, appearance and the design process both go very much hand in hand as far as the final result goes, but with anything artistic, there isn't really a process or a set of stages to go through. Much of anything arty is trial an error - be it drawing, design, music, whatever. I'm still very far off being good at the design side of things, but definitely getting better; I find the best way is to pull my favourite sites apart, look at the code+CSS and find out what works and why, but most importantly I find the colour scheme the one to pay the most attention to and the one I find I struggle with the most. As for actually putting it together, I always find it helps putting together a skeleton of a HTML page with a bit of CSS, and then mould a page from there - otherwise, it's a free-for-all process, really... -
remind me - is experts-exchange the one that has green text next to one of the replies saying "Accepted answer" or am I thinking of something else? I like that idea. It's a nice quick way for people to dive in and go straight to the answer.
-
Time limit on editing posts on this forum
redbullmarky replied to neylitalo's topic in PHPFreaks.com Website Feedback
i think you should change it to brown, with Comic Sans as the font. jk. Looks tonnes better. Attention to detail, huh?! ;) -
unfortunately not. my "real" reading is restricted to Dean Koontz and FHM. In all seriousness, the reason I don't really buy magazines these days is purely down to Google. Once you've found your own little source of resources, you're laughing, not to mention quids in. Most of the specialist computer magazines here are upwards of £5 (just shy of about USD$10) now which kinda puts me off a little bit...
-
Issue with < operator and integer values
redbullmarky replied to praefect's topic in PHP Coding Help
cool! even still.i actually find it always pays anyway to use brackets - both from a debugging point of view, but also a portability one. There's countless occasions I can think of where I've been required to go through code written using one language putting brackets in for another language, due to the calculation order being different. anyway - glad it helped! cheers -
it looks good as a whole. i tried to register (i think!) without any details. I got to step 3 submitting empty forms, and even then, entering a bunch of junk on the 3rd step i got a (what I guess is) welcome message about checking my email. You need to put some better validation in the registration process.
-
Time limit on editing posts on this forum
redbullmarky replied to neylitalo's topic in PHPFreaks.com Website Feedback
nah it's definitely blue, just tried it. empty your browsers cache. stylesheets kinda have a habit of doing that ;) -
Issue with < operator and integer values
redbullmarky replied to praefect's topic in PHP Coding Help
i havent checked this out, but depends on the order of operators - ie, which gets dealt with first when calculating: [code] $valid = $valid and $cnt['c']<=GSInfo::$maxGS; [/code] it seems that, given the numbers you state, the above is being evaluated as ($valid and $cnt['c']) <= GSInfo::$maxGS; . try throwing in some brackets to specifically state your order: [code] $valid = $valid && ($cnt['c'] <= GSInfo::$maxGS); [/code] -
yeah. if it works as well as it looks, it'll replace a couple of bits and pieces. cheers for the link!
-
what code have you tried so far? please avoid bumping your posts so soon
-
for resizing something to a max width/height, consider something like this instead when working out the new width/height: [code] <?php $scale = min($max_width / $actual_width, $max_height / $actual_height); // scale < 1 means image needs to be shrunk if ($scale < 1) { $new_width = $scale * $sx; $new_height = $scale * $sy; ... imagecopyresampled, etc all goes here .... ...draw the now resized image... } else // otherwise, just output the image as normal { .... draw the image as normal... } ?> [/code]
-
it would seem that GD is installed ok, else you wouldnt get the "supplied argument is not a valid Image resource in..." message. where is $im set?: [code] $orig_image = imagecreatefromjpeg($im); [/code] if this is your full code, then i'm going to make an assumption - that it was written and ran on a server with register_globals turned ON. Most installations now have this off by default. Having it turned on (a bad thing as far as security goes) would let you reference $_GET['im'] (to get filename from the URL) as simply $im. if this is the case, at the top of your code, try adding this: [code] <?php $im = $_GET['im']; ... rest of code here ?> [/code] and see how that works. cheers