redbullmarky
Staff Alumni-
Posts
2,863 -
Joined
-
Last visited
Never
Everything posted by redbullmarky
-
[!--quoteo(post=367192:date=Apr 21 2006, 03:01 PM:name=bbaker)--][div class=\'quotetop\']QUOTE(bbaker @ Apr 21 2006, 03:01 PM) [snapback]367192[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code] if (!$var){ echo '$var does not exist'; } else { echo '$var exists!'; } [/code] [/quote] and just to clear the first answer like wildteen cleared up the second, the above is the wrong way to check the existence of a var. why? because using ! infront of the var will also be 'true' in the event of the var being either 'false', zero or an empty string. just because a variable has one of these 'nothing' values, doesnt mean it hasnt been set. as wildteen suggested: [code] if (isset($var)) { echo 'var exists'; } [/code]will do the trick nicely cheers Mark
-
How to transfer webpages from HTTP to HTTPS
redbullmarky replied to bluesapphire's topic in PHP Coding Help
[!--quoteo(post=367208:date=Apr 21 2006, 04:01 PM:name=David Blix)--][div class=\'quotetop\']QUOTE(David Blix @ Apr 21 2006, 04:01 PM) [snapback]367208[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi! 1 - How to verify tgrough PHP script that SSL certificate is successfully installed on server. 2 - If some one types "http://mypage.com/1.php" , then I want to redirect and change the url to secure server i.e; "https://mypage.com/1.php". How is it possible? Kind Regards [/quote] it really depends how your server/host is structured. for example, on my server - there are two directories. one for http files, and the other for https files. so in my http files folder (httpdocs), i just have something like: [b]1.php[/b] [code] header("Location: https://mypage.com/1.php"); exit; [/code] however, using another way - my server ALSO sets an extra $_SERVER variable when under SSL: [code] if (!$_SERVER["HTTPS"]) { header("Location: https://mypage.com/1.php"); exit; } [/code] $_SERVER['HTTPS'] is set to 'on' when under SSL hope that helps a bit. cheers Mark -
Displaying information after a # in PHP_SELF
redbullmarky replied to Doqrs's topic in PHP Coding Help
[!--quoteo(post=367170:date=Apr 21 2006, 01:10 PM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 21 2006, 01:10 PM) [snapback]367170[/snapback][/div][div class=\'quotemain\'][!--quotec--] This will help you on your way. I found this when trying to do the same thing. If you set a variable to contain the value of selfURL(); you will then be able to use substr to get whatever is after the #. [code] <?php function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } ?> [/code] [/quote] but all of your methods here containt variables from the $_SERVER array, which i checked whilst looking through the phpinfo(). notably, $_SERVER['REQUEST_URI'] which i would have expected to hold the result - didnt work there, either. -
[!--quoteo(post=367195:date=Apr 21 2006, 03:19 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 21 2006, 03:19 PM) [snapback]367195[/snapback][/div][div class=\'quotemain\'][!--quotec--] but at my resolution 1280x1024 the website only takes up about half my screen and then a get a scroll bar. There is no neeed for it and I would personally let the page expand down. [/quote] ahhh ok, point taken. i used to forget about those on 800x600, now i'm forgetting the ones with the bigger screens! Will see what i can do. cheers Mark
-
hi i agree with ober on this one. actually sounds like a blinding idea - the only problem being people getting PROPER credit where credit's due. take the milliondollarhomepage as an example, assuming this is before it was 'invented': - guy comes along (the ideas guy with no knowledge of programming) and says "hey, lets sell pixels on a webpage for a dollar each". - programmer says (to himself) "hehe i can do that easily". he knocks up the required code, puts the site up and makes over a million dollars. - ideas guy gets naff all apart from maybe a mention and some 'positive rep'. what i'm trying to say is - if you plan your project carefully thinking about all these groups of people, you'll do very well with it. if you DONT take these people into consideration so that everyone benefits, people will wind up feeling a little cheated. unless of course i've missed a big point somewhere? Cheers Mark
-
Anyone store code / syntax reference in handheld?
redbullmarky replied to kylekwan's topic in Miscellaneous
[!--quoteo(post=367159:date=Apr 21 2006, 12:28 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 21 2006, 12:28 PM) [snapback]367159[/snapback][/div][div class=\'quotemain\'][!--quotec--] sometimes I forget when I do this and start working on the older code, then upload it to the server, and realize I just trashed the previous work I did and get pretty pissed off depending on how much it was. [/quote] haha yeah that's why i was curious as to how people kept things together and sync'd. didnt windows use to have a briefcase thing to keep files uptodate? never used it anyway. only way i can think of is using a network drive, but this means keeping your 'server' computer turned on all the time, and hoping the connection never gets lost when working from elsewhere. -
[!--quoteo(post=367183:date=Apr 21 2006, 02:36 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 21 2006, 02:36 PM) [snapback]367183[/snapback][/div][div class=\'quotemain\'][!--quotec--] I don't understand why you have the fixed height? The scroll bar bothers me. [/quote] i guess the initial idea was to keep everything fairly neat, compact and in one place. sure, it's not conventional and i could have had things going down the page for miles, but just wanted to try keeping everything together. if the page was longer than the browser screen, then the scrollbars would still be there anyway, just not on the actual browser window itself.
-
right then. i've added some minor cosmetic changes following on from some previous suggestions. any more thoughts? cheers Mark
-
Displaying information after a # in PHP_SELF
redbullmarky replied to Doqrs's topic in PHP Coding Help
[!--quoteo(post=367060:date=Apr 21 2006, 01:53 AM:name=Doqrs)--][div class=\'quotetop\']QUOTE(Doqrs @ Apr 21 2006, 01:53 AM) [snapback]367060[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello, say i have a weblocation [a href=\"http://someurl.com/index.php#here\" target=\"_blank\"]http://someurl.com/index.php#here[/a], how would i get the information after the # sign, php_self only returns index.php. I am in need of the 'here' text. Thanks in advance, its hard doing a search on a pound sign :-p [/quote] hmm i tried this with a couple of files and a phpinfo(), but couldn't actually find anything. i'd probably say then it's not possible to do it this way. however, there maybe alternative ways of getting your desired effect, depending on what youre trying to achieve? -
[!--quoteo(post=366969:date=Apr 20 2006, 08:24 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Apr 20 2006, 08:24 PM) [snapback]366969[/snapback][/div][div class=\'quotemain\'][!--quotec--] I think you should be using mysql_close() when opening persistent connections with mysql_pconnect() as I don't [i]think[/i] they close themself... [/quote] according to the manual, it appears that mysql_close is used for non-persistent connections: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Note: mysql_close() will not close persistent links created by mysql_pconnect(). [/quote]and [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. [/quote] does make you wonder though, how much coding gets done that isn't that necessary...how many other functions are like this and not required, etc... still.
-
[!--quoteo(post=366923:date=Apr 20 2006, 07:07 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 20 2006, 07:07 PM) [snapback]366923[/snapback][/div][div class=\'quotemain\'][!--quotec--] [a href=\"http://multimedia-technologies.com/pharma-care/design1.jpg\" target=\"_blank\"]http://multimedia-technologies.com/pharma-care/design1.jpg[/a] [a href=\"http://multimedia-technologies.com/pharma-care/design2.jpg\" target=\"_blank\"]http://multimedia-technologies.com/pharma-care/design2.jpg[/a] [/quote] i like the first one. the second one, all the parts seem a little out of alignment with eachother, whereas the first is clean and consistent - more 'polished'.
-
[!--quoteo(post=366934:date=Apr 20 2006, 07:16 PM:name=askjames01)--][div class=\'quotetop\']QUOTE(askjames01 @ Apr 20 2006, 07:16 PM) [snapback]366934[/snapback][/div][div class=\'quotemain\'][!--quotec--] really? how about OPERA vs. FIRE FOX? which is the best? [/quote] well i guess it depends on what you want. i like zipping round the web quickly getting work done as quick as possible, so opera being fast as anything is perfect for me. was the biggest factor in me deciding to use opera as my primary browser. having said that though, firefox has alot of useful stuff. maybe opera has it too, but i just havent played with it properly yet, but i just love the way you can keep adding bits to firefox as you see fit (ie, extensions, etc)
-
[!--quoteo(post=366895:date=Apr 20 2006, 06:06 PM:name=askjames01)--][div class=\'quotetop\']QUOTE(askjames01 @ Apr 20 2006, 06:06 PM) [snapback]366895[/snapback][/div][div class=\'quotemain\'][!--quotec--] excuse me ober, but why do you liked OPERA web browser huh? what feature or main function that you fall in love to it huh? I have bad feelings about it, is there spywares or malicious ware that accompanied with it? because it's free? i'm merely curious, because i notice that you guys always used it. just asking. -/james/ [/quote] i'm a convert actually now. main reason for me is the speed - and now it's supporting opacity, its pretty much my weapon of choice, even above FF. as for security/safety etc, i actually get NO popups now, not even the ones that occasionally slipped through a double popup blocker on FF/IE. and its solid - it just seems like it couldnt crash even if it wanted to, so as for security - im not too worried. i've heard too many good things about it (even the gripes are now mostly fixed) to let it go. and ober - as for the web forms, i have come across another set a while ago but they were overly bloated, non standard javascript rubbish. these actually look a little more like they'd fit in with existing forms/input types, etc. IMO, extra input types are long long long overdue, especially considering the sort of demands people put on the web and web development now.
-
Anyone store code / syntax reference in handheld?
redbullmarky replied to kylekwan's topic in Miscellaneous
[!--quoteo(post=366783:date=Apr 20 2006, 12:55 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Apr 20 2006, 12:55 PM) [snapback]366783[/snapback][/div][div class=\'quotemain\'][!--quotec--] I try to keep both as syncronized as I can. [/quote] slightly off topic, but how do you go about this? i have a PC for when i'm working properly, and a Mac for when i'm all over the place. i use both for coding the same sites. -
[!--quoteo(post=366869:date=Apr 20 2006, 04:56 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 20 2006, 04:56 PM) [snapback]366869[/snapback][/div][div class=\'quotemain\'][!--quotec--] that's what I thought, so why even have them? I don't understand the purpose or usage... [/quote] i might be guessing - i actually have mysql_free_result but only cos it's the way i learnt and just stuck with it out of habit - but wouldn't it make all the difference with say, for example, a large script that deals with large tables on a high traffic site? surely freeing up a result would take the load of the server a little? all the manual really states is that its to be used if youre worried about memory when dealing with large results. as for mysql_close - not a clue.
-
Anyone store code / syntax reference in handheld?
redbullmarky replied to kylekwan's topic in Miscellaneous
hmmm it wouldn't really seem that useful to be honest - it's just one extra device to use when working which would probably only do the job of slowing me down. i just tend to find it much better to have everything in one central place - at least i know where i'm at then. even my notes and plans are all on computer as i dont even use a pen and paper, for the same reason of keeping everything in one place. -
Registration/ Subscription - Pay For Service
redbullmarky replied to Jenna May's topic in Third Party Scripts
Hi The username/password is a general thing and you'll find plenty of tutorials on this one, however the PayPal one is a little tricker. The BEST place to go is paypal's developer website - whilst not the most user friendly for the faint-hearted, it'll get you there eventually. however there are a few starters that have been posted here before: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=85918&hl=\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...topic=85918&hl=[/a] is one of them. Good luck! Cheers Mark -
[!--quoteo(post=366478:date=Apr 19 2006, 05:14 PM:name=atbjk)--][div class=\'quotetop\']QUOTE(atbjk @ Apr 19 2006, 05:14 PM) [snapback]366478[/snapback][/div][div class=\'quotemain\'][!--quotec--] i am haveing a problem echoing to the broswer. i am reading from a mysql database and then echoing the results to the browser in a neat table. everything works well when there are 100 records when when i try to echo a 1000 records to the broswer it chokes. I am using firefox and ie to test my script. here is the code i use $results=mysqltalk ('SELECT * FROM `cf_category` ORDER BY cateorgnum ASC ); $num_rows=mysql_num_rows($results); for($i=0; $i<$num_rows; $i++) { $row=mysql_fetch_assoc($results); echo '<table><tr><td width="137" valign="top">SAMPLE ROW DAta</td> <td width="425">SAMPLE ROW DAta</td></tr></table>'; } [/quote] when you say 'chokes', what exactly do you mean? you get an error? firefox crashes? nothing happens? have you tried it in other browsers? altho its not the way i'd personally put your code together, there's nothing actually wrong with it as far as i can see in terms of it working.
-
[!--quoteo(post=366457:date=Apr 19 2006, 04:23 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 19 2006, 04:23 PM) [snapback]366457[/snapback][/div][div class=\'quotemain\'][!--quotec--] well, there are definitely wrong ways to do things, but not one particular right way. [/quote] agreed. i thought than anything you could do in html was fine until i learnt about doctypes, XHTML and CSS.
-
[!--quoteo(post=366437:date=Apr 19 2006, 03:38 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Apr 19 2006, 03:38 PM) [snapback]366437[/snapback][/div][div class=\'quotemain\'][!--quotec--] I think you mis-read me. I don't have a problem with someone that wants to create an object that applies to layout and chunks of code that you're going to use and re-use over and over again with only slight tweaks from site to site. However, I'm getting the impression that people think all the little functions they use "sometimes" should be wrapped up in one giant box of crap and tossed into a class as a kind of code toolbox. I don't think that's the best approach. [/quote] hahahaha ober, as always, i value your opinion and your blunt explainations. noone can ever question your honesty lol i actually agree with you 100% too. jcombs i thank you too. i think you're both doing a very good job of proving the immortal point - there isnt really a right OR a wrong way. cheers guys Mark
-
from what i've read, Model/View/Controller. keeping php seperate from html. model = the 'engine' of the code, view = what the user sees and controller = managing user input ($_GET, etc). lots of people are raving on about this if you have a look through google, but it seems like it's a 'preference' thing, with the OOP police who claim that everything HAS to be OO else its crap. to be honest, i've gotten well into OOP and have found it has many benefits. but its definitely not the only way to do things, surely? my argument is that using a dreamweaver template results in code not much different to a templating engines code. its impossible to totally seperate the coding from the HTML - you're always gonna need to make use of loops in the design to display repeated entries, etc, etc blah blah. also from what i've looked up, using a template program like smarty is like replacing one syntax (PHP) with another (smarty's) = another load of syntax to learn + a third party bulk of a parser to turn it into something useful. the whole thing seems pointless, yet i'm being told it's "the proper way". same with frameworks/MVC. is there really anything wrong with using functions seperated into seperate include files that are clearly labelled and commented? or is OOP the only proper way? in summary - i feel like a bit of a cheat if i'm relying on a 3rd party templating engine to do the front end, someone elses framework to do the backend - not only have i got to learn all this stuff, but doesnt the client deserve a bit more care? if either smarty or the framework has bugs, who gets the blame? smarty? the framework coder? nope, its me. i know the general answers, but i could do with opinions. ober, i thank you for yours. cheers Mark
-
How to change the button's look
redbullmarky replied to BernardBlack's topic in Editor Help (PhpStorm, VS Code, etc)
[!--quoteo(post=366348:date=Apr 19 2006, 10:20 AM:name=BernardBlack)--][div class=\'quotetop\']QUOTE(BernardBlack @ Apr 19 2006, 10:20 AM) [snapback]366348[/snapback][/div][div class=\'quotemain\'][!--quotec--] I have an upload script (http://tech.tailoredweb.com/simple-upload-53.php), and I was woundering how I can change the buttons browse & upload to an image. Thank you for your help, BernardBlack [/quote] not 100% sure but i believe that CSS to an extent can style a button, even as far as the background image. really not sure how good it works cross browser though - havent actually ever tried it on a 'file' input type. -
Hi all Until this morning, I'd never really come into contact with MVC/Frameworks, templating engines, etc. But an interesting chat i had pretty much stated that it's the only way to go. I currently use Dreamweaver 8 and rely alot on its Templating system - I can put together a pretty hefty site fairly quickly and easily. So my questions 1, going by the sort of code that Dreamweaver produces, is it the 'wrong' way of doing things? is it wrong to embed PHP into HTML (ie, wrapping HTML in a while loop for repeating regions). 2, is MVC necessary to be 'correct' ? 3, aimed at you seasoned php coders: if you had to continue work where a previous programmer left off, would you be comfortable dealing with code created with Dreamweaver and its templates? or would you find a templating 'engine' more desirable? 4, If my code is well structured and commented as it is, does it matter? My argument in favour of my current method is that its a preference of mine and that learning/using templating systems can be unnecessary in certain situations. anyone have any thoughts on these questions or anything else to add for or against? Cheers Mark
-
hi steve i think you already gave an app of mine a spin. its based on plesk (which in turn is based on windows xp) but without using frames. i think it depends what youre trying to achieve. mine doesnt use ajax but DHTML/javascript/CSS, etc. in using a plesk-style layout, my own package has kinda 'dumbed down' something which can be quite complex, which has made things ridiculously easy to get around and use, even for a beginner. i think if you can model your web app around something that's familiar to most people (ie, WIndows XP), then you can't go far wrong. how you go about it will depend heavily on what you want to achieve and whether it warrants a large, userfriendly interface.
-
i have a server set up on my local machine, but generally only for development testing. it comes in very useful on my apple mac powerbook too tho, cos it means i can download a site i'm creating to my laptop, work on it whereever i like (ie, anywhere i can get some peace and quiet) and upload the result afterwards. all the ports on my machine are generally closed - i just use 'localhost' to test the results. as for installation - took me a couple of hours to figure out and do, but in retrospect there are many packages that will get WAMP onto your system in one go within about 20 minutes.