-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
Return Results From A Mysql Database Dependent On Town Entered
Muddy_Funster replied to ianhaney's topic in PHP Coding Help
you would need to use the input to create a WHERE clause in the SQL query. This meens that you must now know about sanitization to make the user input safe -
Return Results From A Mysql Database Dependent On Town Entered
Muddy_Funster replied to ianhaney's topic in PHP Coding Help
first up - have you thought about using the google maps API? this would work for your ranging search. second - what you are looking for is number_format() -
Crypt() - Understanding Encrypting Using This Function
Muddy_Funster replied to timothyarden's topic in PHP Coding Help
I take a substing out of habbit, as I don't like to have the salt anywhere in the final stored hash (I don't think it's a concern with blowfish, but other algorithms I have used in the past did attach the raw salt to the hash). The param is not forced because I had to bulk set a generic password when I wrote this the first time and had a string set in there for it, I elected to remove the string but leave the empty set option so that if anyone wants to lift the code and try it out they can just echo the result with minimum effort. I only put it up to try to encourage people to use something a bit stronger than md5() and show how easy it can be. I would like to think that anyone taking it would change the cost and substring returned to something a bit more personal.- 10 replies
-
- crypt()
- encryption
-
(and 3 more)
Tagged with:
-
Return Results From A Mysql Database Dependent On Town Entered
Muddy_Funster replied to ianhaney's topic in PHP Coding Help
you guys have missed my point here. How - exactly - is the database going to know anything at all about geographical proximity? all the database stores is 1's and 0's. what information is it going to have to say placeA is cloaser to placeX than placeH is? -
ok, so that's looking a bit healthier, go back to the original echoes and then show us the page source
-
It's still my opinion that: outside of a structured learning environment, nothing is better than a few (never trust a single source for anything factual) good, up-to-date books as a learning tool. the net is a great refference resource, but not s**t hot for learning (too many distractions). phpfreaks and other forums are great to bounce ideas off and get some additional clarification - and even inspiration - on anything that would normaly have been delt with by "asking the teacher" (a process infinately more difficult when using a book to learn....) . The internet, as great and wonderfully junk ridden as is, is still a long way from being a substitute for a proper education in a subject (it is bloody handy for a pub quiz though).
-
Return Results From A Mysql Database Dependent On Town Entered
Muddy_Funster replied to ianhaney's topic in PHP Coding Help
Well what you're asking about is a bit more complicated than that, hidden in the use of a single word - "closest". Do you know how you are going to establish "closest" from only being given a town or postcode? -
JQueryUI - FTW!! muhahahaha. No, but seriously, it's got a lot of nice features and you can take advantage of most of the visual stuff just by using the css it gives you, no JS required
-
Return Results From A Mysql Database Dependent On Town Entered
Muddy_Funster replied to ianhaney's topic in PHP Coding Help
it is indead possible. What's got you stuck? the PHP or the SQL? -
User Authentication And Registration
Muddy_Funster replied to mostafatalebi's topic in PHP Coding Help
that is very dependant on environment. How your login is handled is dictated by how it is designed to interact with your site. -
I'm with DavidAM on this one. What your doing is nuts (on the surface of it at least). Why do you even want to think about doing this, never mind actualy doing it?
- 4 replies
-
- mysql alter
- while loop
-
(and 1 more)
Tagged with:
-
Crypt() - Understanding Encrypting Using This Function
Muddy_Funster replied to timothyarden's topic in PHP Coding Help
the script in my sig uses a combination of blowfish and whirlpool - whirlpool to generate the salt and blowfish to generate the final encryption. using it as an example, you would run the form input through it and store the returned value in the database at signup, and then run the form value through it and compare the returned value against the value in the database on login.- 10 replies
-
- crypt()
- encryption
-
(and 3 more)
Tagged with:
-
Photo Upload (Cms) Send Me In Right Direction
Muddy_Funster replied to jessebirr's topic in PHP Coding Help
you shouldn't store images in the database, it's not designed for that, files, such as images, belong in the filesystem. -
hmm, ok, let's make a change and see what we get, change $startList = mysql_fetch_assoc($query); to while($result = mysql_fetch_assoc($query){ $startList[] = $result; } and try the print_r() again
-
strpos() should do it
-
try a print_r($refactorList) to check whats in the array.
-
that....looks.....right? :/
-
JakkkeM, can you post the rendered page source for those dropdowns? Edt: just noticed that you have \n\r inside single quotes - they will not be parsed properly unless they are in double quotes. you can delete them, they were just to add a lttle formating to the final page source to make it slightly easier to read.
-
it behoves them to get as many people on there that don't know any better as they can. I have got to dissagree with that, learning how to do it wrong at the beggining can be a major setback. learning bad, outdated and depraciated functions and coding as well as worst practises only leads to more confusion than there would have been if a propper resource had be used in the first place.
-
I would say you would need to either hard code an array and look through it to astablish the relationship, store the relationship in another file and use a function like file_get_contents() to facilitate the check, or store the realtions in a database and look them up from there. You wouldn't access the .htaccess/httpd.conf file directly as php shouldn't have the permissions to do that.
-
that's completly useless for an associative array
-
the trickery is probably aided by the fact that if you type w3c.org php into your address bar it loads w3schools right off the bat, no search engine pages or anything.
-
W3schools is a crap place to learn - you just won't know that untill you you're past using it. I wonder if the admins can set the forum to auto-ban anyone that links to it on here.... anyway, getting back on topic after that rather random piece of promotion. I really can't see what your using to link the formatting to the elements, so I added a couple comments into the code to highlight where you are likely going to need to add these. I basicly only changed your SELECT * (because it's naughty) and added in a small bit of code to refactor the results from the database into something that's more menu-maker-friendly here's the code I came up with - as pretty much always : it's untested and unlikely to work as is, but should be enough to get you moving on the right track. $sql = <<<SQL SELECT link_id, links.assoc_menu as assoc_menu, link_title, link_url, title, type, btn_type, dropdown, stacking, menus.assoc_menu as m_assoc_menu, url as menu_url FROM menus INNER JOIN links ON (links.assoc_menu = menus.menu_id) WHERE link_permissions = 1 SQL; $query = mysql_query($sql) or die(mysql_error()); $startList = mysql_fetch_assoc($query); $refactorList = array(); foreach($startList as $line){ $refatorList[$line['assoc_menu']][] = array( 'link_id' => $line['link_id'], 'link_title' => $line['link_title'], 'link_url' => $line['link_url'], 'title' => $line['link_title'], 'btn_type' => $line['btn_type'], 'dropdown' => $line['dropdown'], 'stacking' => $line['stacking'], 'm_assoc_menu' => $line['m_assoc_menu'], 'menu_url' => $line ['menu_url'] ); } foreach($refactorList as $menu){ echo '<div class="your-ui-menu-class">'.$menu['0']['title']."\n\r <ul id=\"{$menu['0']['title']}\"> \n\r"; // ^ echo to output each menu title and start the <ul> foreach($menu as $link){ echo "<li><a href=\"{$link['link_url']}\">{$link['link_title']}</a></li>\n\r"; // ^ echo to output each link within the menu } echo "</ul> \n\r </div> \n\r"; }
-
ok, last thing I'll need is your table structure and a few lines of sample data. PS. why would you think there was something wrong with using a function?
-
http://php.net/manual is usefull for checking functions, w3.org is usefull for validating html. As an organisation W3C has nothing to do with PHP. That some people may have blogged a tutorial here or there I can't comment, but there is no actual W3C training in PHP (that I know of, if there is: I'd like to see the link). tizag.com is a good place to start (in my oppinion), and there is no substitute, in my mind at least, for a good paper book (or 4) as a learing resource.