redbullmarky
Staff Alumni-
Posts
2,863 -
Joined
-
Last visited
Never
Everything posted by redbullmarky
-
whoops sorry i may have added to my post after you first read it. use the 'foreach' command (check my post above) which will just cycle through each item in the array and make a dropdown item from it Cheers Mark [b]EDIT:[/b] or more specifically: [code] <select size="1" name="Reported_Gamer_Tag"> <?php foreach ($Gamer_Tag as $tag) { echo '<option>'.$tag.'</option>'; } ?> </select> [/code] hope that helps
-
[!--quoteo(post=356812:date=Mar 21 2006, 01:04 AM:name=PcGamerz13)--][div class=\'quotetop\']QUOTE(PcGamerz13 @ Mar 21 2006, 01:04 AM) [snapback]356812[/snapback][/div][div class=\'quotemain\'][!--quotec--] It only shows 1 Gamer_Tag from the database instead of all the Gamer Tags. Can someone fix it plz. I want all the Gamer Tags into one Option plz help [code] ... while ($row3=mysql_fetch_array($mysql_result3)) { $Gamer_Tag=$row3["Gamer_Tag"]; } ... [/code] [/quote] here's a problem. you re-assign the value of $Gamer_Tag every time. if you want $Gamer_Tag to be an array, so you can just store all the values from the database, just use $Gamer_Tag[] instead: [code] ... $Gamer_Tag = array(); while ($row3=mysql_fetch_array($mysql_result3)) { $Gamer_Tag[]=$row3["Gamer_Tag"]; } ... [/code] and then for your dropdown/menu, use: [code] foreach ($Gamer_Tag as $tag) { echo '<option>'.$tag.'</option>'; } [/code]
-
[!--quoteo(post=356800:date=Mar 20 2006, 11:52 PM:name=JustinK101)--][div class=\'quotetop\']QUOTE(JustinK101 @ Mar 20 2006, 11:52 PM) [snapback]356800[/snapback][/div][div class=\'quotemain\'][!--quotec--] Humm the only thing I can think of is they invoke the php GD image libary. Then just get each pixel at a page and create an image by this built up maxtrix of pixels. I could be wayyy off here. Interested if anybody acutally knows. ;) [/quote] i can only personally think of a handful of possible ways - manually. ok, so whilst alexa deals with millions of sites, if you've ever tried to change your contact details or related links, you'll notice that they state that the submissions get moderated and checked, etc, before going live. - custom browser parser. so just like IE/FF takes a page and decides to stick it in a big full screen window, and cross-browser element sizes can depend on each browser, it could be possible to get the html from a page and render it in a particular way, before 'setting' it with a snapshot. i have managed to 're-parse' parts of a page before, but how they would go about doing it i do not know. definitely an interesting one, but my bet (at least for alexa) is that the first one is more likely.
-
unenergizer, thats not a bad idea at all. at least i wouldnt need to keep their ftp details. their whole system is an 'admin panel' in effect. only employees will be able to access it. but (me being fussy and all that lol) i want to take this to its extreme. when you click on windows update, it doesnt ask you for any usernames/passwords/keys, etc. it just does it. i'm through with expecting clients to have any computer literacy about them, as i've found that (even with my personal sites) that the best way of dealing with things like this is to think about the end user being a newb, and not a upload/download ftp genius. i've gotten some good feedback by simplifying things and targetting the non-computer literate. so - how can i do it WITHOUT the user having to type ftp details? and without me having to store them? 1) user clicks 'update' 2) their system 'talks' to mine to find out what's out of date 3) my system sends the php/txt/whatever files to their system 4) their system installs it automatically.
-
for secure content, i always stick the files in a folder outside the web tree. my database stores the filename, size, type (application/msword, image/jpeg, etc). i then use a script which retrieves this file and sends it to the browser. to this day, i have never used the default HTTP_AUTH methods as i find that i don't have as much control over them and they sometimes appear 'clunky'. anyway, to the point - this will let you, using php, decide on a file by file basis (as opposed to protecting an entire directory) who can get what file. so instead of the link: [a href=\"http://www.mysite.com/thisfile.pdf\" target=\"_blank\"]http://www.mysite.com/thisfile.pdf[/a] you would have: [a href=\"http://www.mysite.com/getfile.php?file=thisfile.pdf\" target=\"_blank\"]http://www.mysite.com/getfile.php?file=thisfile.pdf[/a] and the getfile.php would do the necessary security checks and presenting the file to the user. [b]EDIT[/b]: to elaborate, all getfile.php does is gets the filename and type ($_GET['file']) from the database, opens the file, sets the headers, and outputs the result. much the same as a thumbnail script if you've used one for images. cheers Mark
-
cheers redarrow the problem is i need it to carry out the update task automatically. just like windows does. 1) user is notified 'updates are available' 2) user clicks link that says 'get updates' 3) updates (both PHP text files, images, etc - anything that might need doing) are automatically read from my site and replace the out of date versions on their site AUTOMATICALLY. believe me, i've thought of these download this, do this, do that, etc, but if i was someone with only a basic knowledge of computers, i'd be stuck already. these are the ways i've tried/thought about. if anyone can elaborate on any of them or suggest that one way is going to work the best, please feel free to do so. - i've tried using fopen with a URL to my update site, but (as expected) the update site parses the php first. - i've (partially successfully) used fopen, as above, to load a remote script on my update site from my test site that literally opens the required file and uses fgets and 'echo' to display all the lines in my script. this seems to work, but i'm sure there are probably flaws (aside from the security aspect to make sure its only the site that needs the updates getting them and not some TomDickandHarry chancer trying to nick my code) - not tried yet, but maybe the files that need updating could be stored in my mysql database (as blobs) with info as to where the file belongs. their site connects remotely to the update site's mysql database and gets the stuff it needs. out of the 3 methods, which would be the best? i'm really not keen on going down the road of FTP, and this has got to be as simple for the client as possible. if there's a 4th method, let me know...
-
[!--quoteo(post=356700:date=Mar 20 2006, 06:35 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 20 2006, 06:35 PM) [snapback]356700[/snapback][/div][div class=\'quotemain\'][!--quotec--] I'm not sure, to be completely honest. I've never used sockets. [/quote] no problem at all. ftp it is then... unless someone can explain how i can do this with sockets?
-
[!--quoteo(post=356680:date=Mar 20 2006, 05:47 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 20 2006, 05:47 PM) [snapback]356680[/snapback][/div][div class=\'quotemain\'][!--quotec--] If your host allows you to setup multiple FTP accounts, I don't see how having your "secondary" FTP account info on his server would be a problem. You could setup a subdomain on your hosting or a seperate area where the secondary FTP can only access that area. I wouldn't keep his info on your site, but I'd have no problem keeping "update ftp info" on his site. [/quote] hmm ok so there's definitely one way to explore. noted. you mentioned sockets. if i opened a socket to my 'updates' area on my site, how would i return a pure php script file? the way i'm thinking would be to have a script on his site that would open a socket to a script on my site, which in turn opens a php file and returns it 'as is'. on the script on my site, do i need to use functions such as fopen, fgets, etc to get my php file ready, or is their a better way?
-
[!--quoteo(post=356672:date=Mar 20 2006, 04:57 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 20 2006, 04:57 PM) [snapback]356672[/snapback][/div][div class=\'quotemain\'][!--quotec--] There are a few options to consider... FTP, Sockets... Both would probably do what you want. [/quote] which would be the best way without either his site having my passwords to access my files or vice versa? do you have a php function that i could look up that would be a start? like i say, i can't have his ftp passwords and he can't have mine, but ultimately the scripts on his server will need to be updated. if i can find a non-password way of exchanging files, then i'm sure i can do the rest in terms of securing it so other people can't get my scripts.
-
[!--quoteo(post=356656:date=Mar 20 2006, 03:52 PM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Mar 20 2006, 03:52 PM) [snapback]356656[/snapback][/div][div class=\'quotemain\'][!--quotec--] I personally would crate an updater in the package that you supply. Have a link to check for updates that connects to your site. Pass the root url of the customers site to a script on your site that checks against a databse of the last time they updated. If there are new updates pass back an array of files that are to be updated and allow their server access to teh folders on yoru server to copy teh files over directly. [/quote] hmm ok, so would it be best that i sent the guy an 'update' package and for him to use a HTTP upload script to upload and let the installer script deal with it? or is their a way that i can securely pass PHP files directly from my server to his, directly overwriting the old files? and just dealing with the permissions as it goes along?
-
Hi all I'm currently in the process of actually finishing off a back-end recruitment package for a client. The problem is, my main job is being the owner of a competing recruitment company, so I am limited to how much of the scripts/data/passwords etc I can access once I 'hand over' the full system. So I can't just keep an FTP account for me to do the updates - once I've handed over the package and they start inputting their data, that's it. However, my client is still going to need updates to the scripts now and again, as I'll be developing the package further for other clients. So my questions (and apologies for not posting code to pick apart, as I'm firstly after a little guidance) - what would be the best way to offer script updates to my clients? Remember, the people I deal with aren't necessarily going to be computer literate, so aren't going to want to deal with FTP/uploading, etc. The process ideally will be an option within the web application that says 'Update', which will automatically deal with the uploading and overwriting of the relevent files, etc. 1) is this possible? 2) has anyone here actually done anything like this before? 3) is there an easier way? However complex it may be for me to implement, the MOST important thing is my client can just 'click and update'. A few pointers in the right direction would be fantastic. Cheers Mark
-
[!--quoteo(post=355176:date=Mar 15 2006, 01:29 AM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Mar 15 2006, 01:29 AM) [snapback]355176[/snapback][/div][div class=\'quotemain\'][!--quotec--] // I don't know how to do that... Suggestion? [/quote] not a problem. you can put the code where you like really, but out of habit i always put it outside the closing </form> tag: [code] ... ... </form> <script language="javascript" type="text/javascript"> document.sform.Scriptures.focus(); </script> [/code] i'm not 100% sure, but you may need to add 'id' properties to your form/input elements, eg: name="Scriptures" id="Scriptures". i read in a few places that 'name' is only used now to keep backward compatibility, but ID is the main one to have. i always have my name and id properties holding the same value too. [!--quoteo(post=355176:date=Mar 15 2006, 01:29 AM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Mar 15 2006, 01:29 AM) [snapback]355176[/snapback][/div][div class=\'quotemain\'][!--quotec--] // I don't really know what to do with scrollbars... I CSS'ed them in IE, but FF won't let you change the drab ugly grey ones... [/quote] ahh nothing much you can do then really. i know what you mean about some of these cross browser differences. i think scroll bar styling is only for IE, and even then you can only deal with the colours not the size, etc. other than using flash or javascript, you'll have to stick with the grey ones. having said that tho, after some of the changes you made, it may not be so important after all to do away with them as things generally seem alot neater. [!--quoteo(post=355176:date=Mar 15 2006, 01:29 AM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Mar 15 2006, 01:29 AM) [snapback]355176[/snapback][/div][div class=\'quotemain\'][!--quotec--] // What do you think of the rounded corner boxes on my menu's? the are done entirely in CSS... [/quote] i hadn't noticed to be honest, but yeah - they add a nice (and probably essential) touch. i can only imagine how plain it'd be if they were all just square boxes. i really gotta start learning how to do stuff like that in CSS as i use the effect all over the place - only i always use images to do the curves and things. [b]EDIT:[/b] you'd be good to add a bit of padding to these rounded menu boxes, as the text on your 'dictionaries' page sits right up to the left of the box. otherwise, things are definitely heading in the right direction! good stuff. Mark
-
[!--quoteo(post=355273:date=Mar 15 2006, 08:35 AM:name=greycap)--][div class=\'quotetop\']QUOTE(greycap @ Mar 15 2006, 08:35 AM) [snapback]355273[/snapback][/div][div class=\'quotemain\'][!--quotec--] Its ok to have a clean-up process on an aborted transaction. Another solution is that, because it sounds like an image is optional, only allow image to ads that have been already been created. [/quote] else what you can do is only move the image file from your temporary location to it's permanent directory once the ad has been placed. so do your advert checking first, insert the details into the database, and if all is well, use move_uploaded_files afterwards. all that needs doing then is an occasional cleanup of your TMP directory. cheers
-
Session help: Undefined Index (I read the sticky)
redbullmarky replied to Mahdi's topic in PHP Coding Help
without wanting to hijack the thread, i totally agree with you, txmedic03. i think that sometimes when you get used to your environment and deal with it, it's easy to code AROUND that environment. so one chap might have errors off totally, and code away - but normally be the first to encounter problems when they port their software or scripst to a different server. including the age old "it worked on my localhost, but when i uploaded it to my host provider....". and the one with it on no-holds-barred-fully-strict error_reporting will find that they bloat their code with bits that are, in normal cases, not needed and still get loads of notices and warnings for things that are, for the sake of getting the script to deliver, pointless. i guess i probably sit somewhere in the middle but have found that out by playing around. notices, warnings and errors are displayed differently for a reason, and - from my own opinion rather than any documents, they go in order of 'disaster factor'. - notices - i tend to always turn these off, as they tend to be for very strict coding practice rather than anything that will affect the end result - warnings - this is where i start paying attention, as warnings seem to uncover very sloppy code practices, missing parameters, etc. - errors - obviously these cannot be ignored as they halt your script i'd probably recommend turning the setting up to its highest level when you first start out - to get used to how things work and why - if anyone ever remembers programming a Spectrum or a Commodore 64, etc, you'll know how picky they can be. but without trying to take too many loopholes and covering up of errors, as txmedic03 rightly pointed out, you'll soon realise what is going to get the job done and for your code to be versatile enough to work on any system you stick it on. -
*SOLVED* undestand arrays properly help lol
redbullmarky replied to redarrow's topic in PHP Coding Help
if you were told to use list and you HAVE to use list, then i'd look at the list syntax and work it out. i've never personally used it as i've never found a practical reason/need to. take a look anyway, you may find you'll need it one day: [a href=\"http://www.php.net/list\" target=\"_blank\"]www.php.net/list[/a] glad i could help! cheers Mark -
Session help: Undefined Index (I read the sticky)
redbullmarky replied to Mahdi's topic in PHP Coding Help
[!--quoteo(post=354897:date=Mar 14 2006, 02:37 PM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 14 2006, 02:37 PM) [snapback]354897[/snapback][/div][div class=\'quotemain\'][!--quotec--] Correct your errors, don't just hide them. I have tested setting $_SESSION['user_id'] and moving between directories and it works fine. The only thing I can think of is that your server configuration is some how affecting it. Sorry that I can't be of more help, but I am curious to see a solution. [/quote] yeah i never mentioned hiding them. but in some land, long long ago, it was common practice (and ONLY practice) to declare a variable before giving it a value, otherwise you had an 'unknown variable' error. nowadays, it's just ok normally to give a variable a value without actually declaring it first. from most of the scripts i see on here, and commercial/opensource scripts i see, it's common practice not to declare the variable first. but the problem with E_NOTICE is that it'll report all the little fiddly things that do not affect the way the script works at all, but seems to be there for the 'old fashioned' way of coding. txmedic03, you'll prob find (pull up a phpinfo and check) that your error_reporting is prob set at 2039 (E_ALL & ~ E_NOTICE) or lower, wheras my guess is that if Mahdi and saiko did the same, they'd probably find a higher value, or E_ALL for example -
[!--quoteo(post=354911:date=Mar 14 2006, 03:24 PM:name=alan543)--][div class=\'quotetop\']QUOTE(alan543 @ Mar 14 2006, 03:24 PM) [snapback]354911[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thanks for that. That works great for passing the value of the checkbox (i.e. on) But It's the other values in the row that I need to pass on if the checkbox is checked? Any ideas? Thanks [/quote] dont think i'm getting you. if a checkbox is checked, then it's VALUE is passed in the $_POST. if it's not checked, NOTHING is passed. can you be more specific about your problem? (has been a long day, so maybe i'm missing something simple)
-
*SOLVED* undestand arrays properly help lol
redbullmarky replied to redarrow's topic in PHP Coding Help
when arrays were first explained to me, i was told to imagine a load of boxes lined up either in a line or a grid. each one had a name, a number, or both. each box could be referred to by its name OR number. this bit sets up 5 boxes, labelled 'array1' through to 'array5'. each one is given start contents, which in this case is a letter from A-E. [code] $myarray=array("array1"=>"a","array2"=>"b","array3"=>"c","array4"=>"d","array5"=>"e"); [/code] the 'while' statement simply kicks off a loop that will keep repeating while the condition remains true. as for this: [code] while(list($arraing,(arrayingshard)=each($myarray)){ [/code] i really don't know what youre trying to achieve. i even tried it myself out of curiosity but it didnt work, so i'm guessing it was a bit of guesswork on your behalf, or some code that your course teacher gave you. either way, it seems really horrible (although if there's a specific purpose to doing it this way, i'd love to know - anyone?) but in a nutshell, all an array is is loads of variables grouped by the same name. here's 3 examples: [code] // set up a variable (1 box) called 'a', stick the number 5 in it $a = 5; // set up 5 boxes. by default, these will be labelled 0-4 (labels start at 0) as i have not specifically named them otherwise, and put some even numbers in it. // these boxes can be accessed by $a[0] - $a[4]. eg $a[2] contains '6' $a = array(2, 4, 6, 8, 10); // do the same as above, but give each box a better name // these boxes can be accessed with $a['first'] - $a['fifth'] $a = array("first"=>2, "second"=>4, "third"=>6, "fourth"=>8, "fifth"=>10); [/code] so if i'm getting this right, and your example needs you to show the box name and the box's value, just use 'foreach', which basically is a nice way of automatically going through each box of an array one by one: [code] $myarray=array("array1"=>"a","array2"=>"b","array3"=>"c","array4"=>"d","array5"=>"e"); foreach($myarray as $boxname=>$boxvalue) { echo $boxname.' is '.$boxvalue.'<br>'; } [/code] hope that helps -
change this: [code] if (unset($_SESSION['username']) { [/code] to this [code] if (!isset($_SESSION['username'])) { [/code] [b]EDIT:[/b] ooops same time post again......in which case, the way obsidian suggested is much better for what you're after anyway cheers
-
make sure all the checkboxes have the same 'name' attribute, but followed by square brackets, ie name="mycheckbox[]" by default, only the checkboxes that are checked will pass a value to your next script, and the checkbox values can be accessed with [code] $checkboxarray = $_POST['mycheckbox']; foreach ($checkboxarray as $checkvalue) { echo $checkvalue.'<br>'; } [/code] unchecked boxes are automatically ignored anyway. cheers
-
you missed the closing " quote off the end of your query, as you put the ORDER BY outside of your original quote: [code] ("Select * From bible where `$WhichBook` Like '$BOOK' and `chapter` like $CHAPTER ORDER BY `key` ASC"); [/code]
-
[!--quoteo(post=354844:date=Mar 14 2006, 11:49 AM:name=eranwein)--][div class=\'quotetop\']QUOTE(eranwein @ Mar 14 2006, 11:49 AM) [snapback]354844[/snapback][/div][div class=\'quotemain\'][!--quotec--] thanks. works great. to all the others who reads it, notice that there is a missing $ on date2. thanks again, eran [/quote] oops, my bad. i changed it now Cheers Mark
-
Session help: Undefined Index (I read the sticky)
redbullmarky replied to Mahdi's topic in PHP Coding Help
someone please correct me if i'm wrong, but the last time i had this error myself, i believe i had the settings in my php.ini file too strict for reporting errors. the 'error' youre getting is just a notice, and i believe it's because you don't declare/set up $_SESSION['user_id'] before you assign a value to it. open up your php ini file and find a line that says 'error_reporting', and change it to: error_reporting = E_ALL & ~E_NOTICE OR error_reporting = 2039 which are both the same thing, and which will give you errors if you have them but not notices. to be honest, and maybe someone will tell me it's bad practice, but i never personally set up a variable before declaring values to it. just seems too much trouble and a bit 'old school', so when i'm developing a system, i always have the error_reporting at the level i just mentioned. if you don't have access to your php.ini file, then a line right at the top of your code like [code] ini_set("error_reporting",2039); [/code] will do pretty much the same thing, albeit only for the script that you include the line on, without permanently changing the php.ini file. -
work out a random date between start of year and today [code] function getrandomdate($date1, $date2, $format = "Y-m-d") { $randomdate = rand(strtotime($date1), strtotime($date2)); return date($format, $randomdate); } // mysql date format, although strtotime works on many date formats. $firstdate = "2006-01-01"; $lastdate = "2006-03-14"; echo "random date is ".getrandomdate($firstdate, $lastdate); [/code] give that a go. to get the date back in a different format, just add a third parameter to the call to 'getrandomdate' function, else it'll come back in mysql format. Cheers Mark
-
[!--quoteo(post=354639:date=Mar 13 2006, 08:20 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 13 2006, 08:20 PM) [snapback]354639[/snapback][/div][div class=\'quotemain\'][!--quotec--] Alright... I had to know: [/quote] lol curiosity always wins in the end...