-
Posts
364 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Love2c0de
-
How Do I Get $Salt When It's In The Config.php File?
Love2c0de replied to ChayaCooper's topic in PHP Coding Help
You can also use: $dir_name = dirname(__FILE__): Once you have the string directory, you can then search the directory for example: $files = scandir($dir_name); echo "<pre>"; print_r($files); echo "</pre>"; Hope it helps. Regards, AoTB.- 10 replies
-
- salt
- config.php
-
(and 3 more)
Tagged with:
-
Have you got any queries? I haven't used the basic mysql functions in a while BUT I think it's something like: $qry = mysql_query("SELECT col FROM table_name WHERE col={$value}"); if(mysql_num_rows($qry) >= 1){ echo "you have an image"; //here you would do something like: $img = mysql_fetch_array($qry); $output_img = "<img src='product_images/{$img['col_name']}' alt='{$img['col_name']}' />"; } else{ echo "no image in database"; } You then just output to your page like so: <?php if (isset($output_img)){ print($output_img);} ?> To deal with multiple images you would do: while($img = mysql_fetch_array($qry)){ $output_img[] = "<img src='product_images/{$img['col_name']}' alt='{$img['col_name']}' />"; } Then: if (isset($output_img)){ print_r($output_img); } You don't just have to print_r() you could then maybe use a foreach loop and do the business in there.
-
Ah I remember that coming up on localhost when I purposely put in a mistake in the code. I forgot to change it though. Cheers for that! I completely forgot. I'm getting quite confused here, I might take it down, carry on in localhost until I have got rid of these problems. Kind regards, AotB
-
Thank you both for the tips. I've just changed the display errors to off, and now it is only reporting 'Error:' (which is my string which I put before the mysqli_error()) so that is ok for now. I'll look into the other two mentioned though. Regards, AoTB.
-
lol it all went tits up. I'll turn error reporting off for now. Probably create a new hosting account as well now that you have all my details What a muppet. I only took it down to sort the font, which I've now changed to trebuchet ms for now.
-
Please note, I forgot to sort the font. I was using one local to my machine. Dont worry about that it's more layout I'm looking for.
-
It's your favicon. You need to take the <link> tag out of your <head> tags if you don't want it there. Example: <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> Check this site out: http://tools.dynamicdrive.com/favicon/ Hope it helps. Regards, AoTB.
-
Hi, I am wondering if you could possibly give me some criticism on my site. I am using backend php files to run the site so I am quite happy with my setup. It's more to do with the actual designing of the site rather than the functionality (I will be adding some javascript effects within the next few days). I have set all my elements, margins/padding to % and I had someone take a look on a larger resolution and it looked 'reasonably' ok but still needs to be changed. I spent a few hours last night creating a totally separate copy of my CSS file and setting everything with pixels and it looks the same as it did when I set it with %. I just need some criticism on the actual design because I'm not impressed myself. It looks too amateur to me. Here is the link: http://www.labtec.0fees.net/ Thank you for any help you can give me. Regards, AotB.
-
Ima duck out of this one, it seems I should watch and learn
-
Also, I copied and pasted your whole code and it and there is a definite syntax error with quotes.
-
I'm very new to php dude so I'm just trying to think what it could be. Change this part of your code: $sql = "INSERT INTO subcategories (subcat_name, subcat_cat, subcat_description) VALUES('" . mysql_real_escape_string($_POST['subcat_name']) . "', NOW(), " . mysql_real_escape_string($_POST['subcat_cat']) . " " . mysql_real_escape_string($_POST['subcat_description']) . " )"; To this: $_POST['subcat_name'] = mysql_real_escape_string($_POST['subcat_name']); $_POST['subcat_cat'] = mysql_real_escape_string($_POST['subcat_cat']); $_POST['subcat_description'] = mysql_real_escape_string($_POST['subcat_description']); $sql = "INSERT INTO subcategories (subcat_name, subcat_cat, subcat_description) VALUES ('{$_POST['subcat_name']}','{$_POST['subcat_cat']}','{$_POST['subcat_description']}')"; Let me know if it works I use prepared statements now but when I did use the normal mysql type functions I always escaped it like this before inserting. Edit: the error message you posted, which line is line 7 because I looked at your code at the top and I can't see a problem at line 7? Regards, AotB.
-
Edit: dont mind me, completely wrong. Ok, what is the actual error which is displaying to you? I think it's either your double quotes or I don't know. Kind regards, AotB.
-
I am lazy sometimes I had to edit about 6 times, it kept automatically putting the color there even after I copied and pasted from his original post with no tags Also, shouldn't he really be escaping the data JUST before the query? Because then he can do //insert table blah blah VALUES ("{$_POST['subcat_name']}","{$_POST['subcat_cat']}","$_POST['subcat_description']"); And for the timestamp, I've read to read it in the php like so: $date = date("Y-m-d H:i:s", time()); Then put that into the query where his field is (which should be DATETIME type)? Kind regards. AoTB.
-
Here you are selecting 3 fields: $sql = "INSERT INTO subcategories (subcat_name,//1 subcat_cat,//2 subcat_description)//3 In this part: VALUES('" . mysql_real_escape_string($_POST['subcat_name']) . "',//1 NOW(),//2 " . mysql_real_escape_string($_POST['subcat_cat']) . "//3 " . mysql_real_escape_string($_POST['subcat_description']) . "//4 )"; You are attempting to insert 4 values.
-
Can you post your HTML and CSS please? It's hard to help you with only that CSS. It is most likely another element causing it to display there. Regards, AoTB.
-
Firstly I'd always style elements in the order the are set in html. So for instance, put your #rest css code above the .wrap_reset class declaration. About your question, not too sure with absolute positioning but came across this example: http://jsfiddle.net/brettdewoody/C4jSS/ Hope it helps. Regards, AoTB.
-
Yup I think I definitely have some studying to do! Thanks for all the help. Much appreciated. Kind regards, AoTB.
-
Do you check the code I posted and was it what you meant? Also, I can't stress enough the advantages of writing your own code. I used Dreamweaver for the very first time at college the other day and was ready to smash the computer up.....the most stressful and complicated approach to web designing I've ever seen. Thank god for the code view. Regards, AoTB.
-
also, when I change your 'test' array values for instance, 'Christian' to 'Chrístian', it returns boolean false. I thought it was supposed to allow that character ? Regards, AoTB.
-
Won't let me edit for some reason, I can get my head around everything pretty much except the \pL part. Does the p hold a 'collection' of these special characters and the L means check for a match of one of those letters? Regards, AoTB.
-
Thanks a lot for that explanation, I was way off! aha. I was doing some tests with the 'test' code you gave me and changed the first array element to read "d'angelo" and it didn't return 1. What I did was added this - \' to the second character class like this: [\\w\\pL \'\\.\\-] and var_dump() then returned int(1) So, searching {0,20} means search 21 times, {0,36} would mean search 37 times? 0 is also counted as being the first similar to array indexes? Cheers again for explaining that. Regards AoTB.
-
I just copied your code and edited it slightly and it seems to stay within the 'wrapper' div. <div class="product" style="width: 600px; border:1px solid black;"> <img width="300" height="186" src="-censored content" class="attachment-medium wp-post-image" alt="healthy" title="healthy"> <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, </p> </div> For dummy text, I'd always use http://www.lipsum.com/ (Lorem Ipsum).. Not sure if using causes whitespace to take control. When I separated your 'blah blah' onto new lines and refreshed the page, the text displayed exactly how it was formatted in my text file. When I changed your text to the lorum ipsum dummy text, it worked ok. Check it out. Hope it helps, AoTB.
-
Thanks very much for confirming that. I am not going mad. I have been sitting here for about 2 hours reading up on regexp and the one I am dealing with, trying to work it out...I think i've figured out the first character set Here is my attempt: The caret used outside of an opening square bracket means we want to match characters specified in the character class. These are from a-z and A-Z. Using 2 backslashes means we want to escape its special use and use the literal? That literal backslash used with pL matches any of the unicode characters followed by any literal character? Let me know! Regards, AoTB.
-
Does the \\pL part of the reg exp have something to do with matching the different characters like the áéíóú ones? Regards, AoTB>
-
So basically the point is, if the data is not what you are looking for, don't delete any characters from their input but still send them back to the form to correct it, auto filling with their exact value? Also, when defining the length for myself, should I be using '{0, maxlength value defined in form?}'? PS-Thanks for that site, it will prove very useful I'm sure. Kind regards, AoTB.