-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
just apply the same successfull line of code to the other $result[] outputs to the rest of the outputs that you want to match that format. Sorry, I missread the first post and thought that you had the date in one column and the time in another.
-
I don't understand your question, sorry.
-
PHP AJAX SQL update not working after adding extra record
Muddy_Funster replied to underlink's topic in PHP Coding Help
perhaps this will offer some assistance : http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html -
I would suggest changing your query to SELECT ...,DATE_FORMAT(CONCAT(cdate, ' ', mdate), '%d %M %Y %H:%i:%s') AS mdate,...
-
php mysql (html?) echo 'username' problem
Muddy_Funster replied to ProdSawax's topic in PHP Coding Help
A couple of things RE the last post, first, the form method being used here is GET, not POST and second, the username is not part of the form data at all, so your idea won't work at all, even after changing to GET. Now to the OP. What you will actualy need to do is echo the information brought back from the database by changing the line pointed out by the last post to the following, assuming the field in the database that is hoding the username info is called username (if not change accordingly) is echo "Welcome '{$confirm_info['username']}'"; That said, check your database to see that the update and delete queries are doing exactly what you expect them to, I would be supprised if they are, I also seriously urge you to never use select * for production scripts. And another thing - you need to stop breaking in and out of PHP all over the place when it is totaly unnescacery to do so. -
Split that line up, and add some "or die"s to it so you can find where the problem is: <?php $con = mysql_connect('localhost', 'root', '') or die("Can't connect to database"); $db = mysql_select_db('annon', $con) or die("database not found on server, or insufficient permissions set for current account"); ?>
-
try elseif (!in_array($group_num, $dont_print)) {$add_on_sql .= ' OR id_group = '.$group_num.'';}
-
erm...no. Because if he doesn't need it to do what it's doing then we know that we can change it to make it better. If it does need to do what it's doing then any changes need to be more subtle.
-
I stand on my last statement. If you can't be bothered to include logic then your in the wrong game. Code needs logic. The web is full of crap code - pages that don't display correctly, pages that only load on one browser and not another, pages that have broken links and missing images, pages that open up the backend to injection attacks, pages that get hijacked by spam bots. Don't think that just because you didn't have a chance to see somthing come up on the page that the browser didn't render it, and that nothing could have captured it. Also header() can be broken very easily, it should never be used as a security step, only as a convenience.
-
Yes and No, I expect that the only reason you would store a salt in it's own field in a table would be because it is completly randomized and as such security is clearly a big deal, so the tradeoff would be the extra lookup to get the salt that applies to the username and then apply that to the password and then compare that with the value in the database - all running through encrypted port traffic. If that's not the case then I would expect the OP to follow conventional password hashing methodolgies and have the salt related to the information that is entered during login, either by hashing parts/all of the password, or by hashing parts/all of the username/email - or even by using a static hash value for the salt for lower security level requirements.
-
change lines 33-41 to the following: foreach ($shops as $id=>$shop_info){ echo "---- Shop ID $id<br>"; foreach ($shop_onfo as $key=>$value){ echo "---- ---- $key --- $value<br>"; } } the shop info had fallen out of the $shops foreach loop
-
a) hence the use of "for example" in my comment and b) You clearly don't understand that it's the same value as long as it's the same password and there is no need to request the password to compare it. Let me break it down for you: user enters password at registration script hashes password script sends hashed password to database hashed password stored in database - user enters password at login script hashes password script sends password to database database checks if this hash matches stored hash datebase returns user_id on success error on failure script checks if error or user id are returnd and procieds acordingly So, you hash the user input and send the hash across the network, you don't, at any point, ever, request the password from the table and run a comparison on the webserver inside of the PHP script. That's not just insecure, it's a stupid waste of resources. Stop digging.
-
that's not the code from your OP - there is no header() call anywhere
-
add a var_dump($shops) at the end at see what's in it, then we can see if the problem is populating the array, or displaying it
-
No, you dont, that's garbage of the first order. The function in my sig, for example, generates a unique salt based on the password it's self, every entry produces a unique value that does not need to be stored in the database. Even if it was stored in the database you would only need to retrive the salt - not the password. You never need the password.
-
I've had a quick poke about and you can do it with JQUERY using .arr() like so: function changeTitle(newTitle){ $(document).attr("title", newTitle); } It's not something I have used in production, but I did test that and it works.
-
try changing 27 to $shops[$shop->shop_id] = array('name'=>$shop->shopname, 'logo'=>$shop->shoplogo, 'levertijd'=>$shop->levertijd,'price'=>$shop->price,'postage'=>$shop->postage, 'cp_type'=>$shop->cp_type, 'product_url' => $shop->producturl);
-
need more info
-
$date is your variable - it's the string value of the date passed through the $_GET superglobal, it is not an object. What you are trying to do, and how to do it, is coverd in the manual pages here
-
What an utterly stupid request when you have, infact, not provided any code for anyone to re-order!
-
need more info
-
two things - 1 : Why in the name of <insert godlike figure of choice here> would you EVER even CONSIDER pulling password information out of the database???!?!?!? O_o 2 : "password" is a reserved word, you will need to either wrap it in backticks or change the column name in the table.
-
ahh, damn, missed that the shops were all objects, it's hard to follow that output, sorry. maybe try: foreach ($productitemsearch->ProductItemSearchResult->productdata as $key => $att){ if(!is_object($att){ echo "$key --- $att<br>"; } else{ foreach($att->Shops as $shop){ $shops[$shop['shop_id']] = array('name'=>$shop['shopname'], 'logo'=>$shop['shoplogo'], 'levertijd'=>$shop['levertijd'], 'price'=>$shop['price'], 'postage'=>$shop['postage'], 'cp_type'=>$shop['cp_type'], 'product_url' => $shop['producturl']) } echo "Shops ---<br>"; foreach ($shops as $id=>$shop_info){ echo "---- Shop ID $id<br>"; foreach ($shop_onfo as $key=>$value){ echo "---- ---- $key --- $value<br>"; } } It's still a bit early here just now, and I haven't had my coffee yet, so that's probably not going to work out of the tin, but you should be able to tidy it up from that.
-
Help With AJAX getting PHP generated HTML
Muddy_Funster replied to computermax2328's topic in Javascript Help
in the success function of the $.ajax() change $(this). to $('#divID'). Where divID is the id of your desired target div. ( if it's a class rather than an ID the used $('.classID') )