-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
For this you would be looking for the freelance section...and probably your wallet.
-
Sure you can, there are a couple of ways of doing this, you can store the destination pages in the database along with the group definitions, or you can hard code them into an if() in your php. loading them into the database is the most flexible, you would then grab the destination during the login query and apply it to the header(location: ) on success. the php method would have you grab the group type, or roll level during the login query and then run it through a series of if() elseif() checks to fire the chosen header(location: ) call.
-
My point was that as the form is using the submit function (by you setting type=submit) and the form action is set to reload the page, I think you need to use javascript to override that default functionality of the element (the one that calls the form action) and have it only fire the JS onclick function.
-
I'm not sure how your generating your images, or what the content of your $imageID is, but in a limited example kind of way it would be something like <?php$imageID = array ( array("130520-001", "9133440_DSC_001.jpg"), array("130520-002", "9133440_DSC_002.jpg"), array("130520-003", "9133440_DSC_003.jpg"), array("130520-004", "9133440_DSC_001.jpg") );// the array above is a substitute for your data //load the javascript and the header - again, substitute for your linked files$pageHead = <<<PAGE_HEADER<!DOCTYPE html><html lang="en"><head><title>Muddy's Sample</title><script type="text/javascript" src="path/to/your_JQuery.js"></script><script type="text/javascript">$(function(){ function wopen(id, method, hei, wid){ alert("this would run your function, using the id of -"+id+"- and your other attributes of \""+method+", "+hei+", "+wid+"\""); }});</script></head><body>PAGE_HEADER;echo $pageHead;foreach ($imageID as $image){ $show_img = <<<SHOW_IMG<li><a class="thumb" name="{$image[0]}_t" id="($image[0]_t" href="images/{$image[1]}.jpg" title="Title #6"><img id="{$image[0]}_i" src="images/{$image[1]}_thumb.jpg" alt="Title #6" /></a><div class="caption"><!-- <div class="image-desc">Description</div> --></div></li></ul></div><div id="inphoto"> <a id="{$image[0]}" onclick="wopen($(this).id, 'popup', 448, 590); return false;"><img src="assets/inphotobutton.jpg"></a> </div> SHOW_IMG; echo $show_img;}echo "</body>\r\n</html>";?> It's not really that close to your's but it should let you get what I mean. Just remember and point the <script> tag's source to your jquery library.
-
hmm, so the issue being fixed by including the declaration of the connection would have some other source. I apologise - I didn't realise mysql_ was able to break scope quite that badly (never used it in any circumstance that would demonstrate it). I don't know about mysqli_ at all, I jumped straight to PDO from mysql_ when the depreciation notice came about.
-
HTML form > PHP > Email (multiple selectors)
Muddy_Funster replied to JeffSydor's topic in PHP Coding Help
show us your revised code -
You assume that an associative array is being returned, even though the code in the original post shows a numerical one. Also, just throwing answers at people doesn't help them to learn how to solve the problem, you really should include some information explaining why your code would be the right way to do things.
-
Well, no actually. Commonly people code mysql connections : $con = mysql_connect('host', 'user', 'pass'); $db = mysql_select_db('databaseName', $con); ... When you do this you assign the connection and database resources to variables, and as such when you enter into a function there is no visibility of it. Passing the connection variables into the function would obviously fix this so that, as you say, you would not need to call the include within the function, but your statement in and of it's self is not strictly accurate.
-
Inventory Management (Storing Items In Boxes)
Muddy_Funster replied to Monkuar's topic in PHP Coding Help
I am getting the impression this isn't an inventory as much as it is an equipped items display...where the location of the item is relevant, if not he may just want to allow the end user the ability to organize the items in their inventory (with persistence) to their personal preference, not the order that they are picked up in (cash sale items in the bottom row, weapons in the first and clothing in the second for example). Or perhaps the intent is to include hotkeys to activate items in certain slots. That's just off the top of my head, I haven't even thought about this in any great thought. As for displaying the items, you would loop through the array of data retrieved from the data base as you are rendering the grid and apply the (I assume) image to the relevant cell as it is being drawn. -
simple problem writing form data to mysql
Muddy_Funster replied to promotec's topic in PHP Coding Help
header problems can normally be gotten around by using the output buffer for scripts that run mid process. There is no reason that you can't have the whole thing on the one page given the way you have described it in your last post. You do need to be careful of your logic when checking the !isset() of the post data. Most often (if not always) post information is sent through the header, not the url query string - you would use $_GET to retrieve that info as Barand has shown in his example. I do hope that the connection info you posted is not actually accurate..... Give us a full breakdown of what you are doing (as well as what your final goal is) and we'll be able to help you more comprehensively. -
that's what my code produces....
-
HTML form > PHP > Email (multiple selectors)
Muddy_Funster replied to JeffSydor's topic in PHP Coding Help
when you send more than a single value (single selection) from a form it is sent as an array, you will need to check if the value sent from multiple selects in the form is an array and then react appropriately to get the string values you are looking for. -
PDO: including connection.php in another file
Muddy_Funster replied to Big_Pat's topic in PHP Coding Help
Just be careful what order you are calling your requires. it cascades the code from each as it's called so make sure that all declarations are required before any calls -
How to run multiple conditions on one field
Muddy_Funster replied to smash120's topic in PHP Coding Help
What are the contents of the variables that you are sending to the query at run time? -
First time using ajax, having problems.
Muddy_Funster replied to smokehut's topic in Javascript Help
I'd like to point you to jquery. as a beginner your would be better off starting to learn that than oldschool "raw" javascript - especially for ajax. another thing - you seem to have commented out the part of the script that actually calls the function.... -
you seem to have grasped the need to escape your backslashes a little late when creating the exec string....
-
you are not setting the array key to 'a', you are setting the value of the array key 0 to 'a'. thus you shouldn't be getting true. test with if(array_key_exists('a', array('a'=>'this is the value'))){echo "yay!, found it";}
-
ok, looking at the api docs for pchart, you are supposed to be entering an array there just the way you are doing it. Can you show us what you are actually trying to do, with perhaps some sample data?
-
off the top of my head I would say it's because you have assigned a type of "submit" to the image you need to add an over ride to the default function for the click event - see here http://api.jquery.com/event.preventDefault/
-
Your question is not clear, but I think you either want to list() or serialize() your data. I think I remeber hearing somewhere that serialize and arrays don't get on the best, but I could well be getting mixed up. My question to you is - do you need to use an array in the first place?
-
On the surface of it, that doesn't look like the right way to do things. I think you would be better having a single "User" class with, perhaps, a status property that defines if the user is registered or unregistered.
-
extract csv attachment from emails piped to php
Muddy_Funster replied to tdited's topic in PHP Coding Help
I'm not sure exactly what process you are using here, but I imagine that if I were going to do it I would work with the MIME headers and boundaries. Each multipart email (one that contains more than a single form of data e.g. attachment) has each part of the multipart data wrapped inside it's own MIME boundary header, this defines, among other things, the datatype of that mart of the message. So I would be searching for the boundary string, then checking within each boundary for the "content-type='application/csv'" and probably the "content-disposition='attachment'" as well to identify the relevent data for the CSV file. I would then find the encoding used on that part of the MIME message and throw it at a CASE or nested IF that would decode using the relevant base, i.e. base64, depending on what the sender had used to encode in the first place. I don't know if any of that is what you are looking for, but it's the best I got- 2 replies
-
- csv
- piped emails
-
(and 1 more)
Tagged with:
-
You're very welcome, let me know how you get on with it and If anything's confusing you then just give a shout.
-
simple problem writing form data to mysql
Muddy_Funster replied to promotec's topic in PHP Coding Help
you have given the same name to both of your hidden form elements. You can't do that (well you can, but you end up hitting problems when you try to access the contents of the variable....) change one to online and the other to offline, have both of them suybmit the value of 1 (as 0 can sometimes be treated as faulse for boolian checks) then check on the online2.php page which one is clicked by using the !isset($_POST['...']) check : <?php ... if(!isset($_POST['offline'])){ if(!isset($_POST['online'])){ echo"I don't think you should be here...."; exit(); } else{ //do online stuff } } else{ //do offline stuff } ... ?>