Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by glassfish

  1. cyberRobot, The problem I have had with that is that I may have to use "../../" to go "up" with the directories. And "for some reason" I have had issues with this, when for example including the stylesheet file in the header file and the header file gets included in a sub-directory.
  2. For the includes I use the following: include($_SERVER['DOCUMENT_ROOT'] . "/cms/includes/connection.php"); And for these following examples I use "http://localhost/": <img class="header_image" src="http://localhost/cms/assets/image/capture.png" /> <script type="text/javascript" src="http://localhost/cms/jquery/jquery.js"></script> <link rel="stylesheet" type="text/css" href="http://localhost/cms/assets/style.css" /> With these examples I use "http://localhost/" because "$_SERVER['DOCUMENT_ROOT']" is not working with these above. My Question: Is there a function I could be using and replace it with "http://localhost/"? I am looking to have it like following: When I upload the web app onto the web server it still should be working out. EDIT: "Un-linking" those links which happen did not work.
  3. Well I found a good tutorial series on YouTube out of those multiple ones which are there. And I haven gotten into OOP and bind parameters ("PDO"). And I am quite liking it, it looks like that one is indeed typing less and one has set up a blog ("CRUD") quite quickly. Before that I have had also suspected the less amount of code with OOP, I was not quite sure when it comes to this, I thought maybe the request calls are written a bit shorter and that may be it when it comes to this. I feel like I could be learning from "full" blog web apps written with OOP and bind parameters, yet I also feel a bit sad about it, that I am not coming across a bunch of scripts on the internet. I will look a bit later on Themeforest for this. I still would appreciate suggestions on this. I am really looking to know OOP with bind parameters better.
  4. Well, it was said there would be more jobs in programming, and I was wondering "how it may have to look like" when it comes to the skills and when looking to apply for the "Carrers" link. With "bind parameters" I mean "secure" programming, for example secured of "SQL injection". Well, after you have said "those", I could be getting into those, I was not necessarily looking to "apply" now. I was also looking for something "exact". I also think, that when it comes to getting into those you have had mentioned I may be better off with OOP instead of "continuing" the "procedural style".
  5. Let's say for an "entry-income or low-income" to get started with. How should it look like when it comes to the skills? Could it work out if somebody for example can program with "bind parameters" and OOP in PHP? What are your recommendations?
  6. I have looked around. And what I came across was not necessarily what I was looking for. I was wondering if somebody can recommend a good tutorial for building a blog in PHP OOP? Also, I was wondering if somebody perhaps knows a good blog app written in PHP OOP, where I could be learning from the script files?
  7. Hey QuickOldCar, quick question, do you know if "allowing guests" works simply by enabling that option (also for the localhost) or may have to "re-new" the code?
  8. I did not think this is what "universal code" would stand for - and that below the "platforms" headline. Thanks! I just tried it out and it indeed works.
  9. Thanks for the answer, I will try that in a minute. I will try to have "those" script files inside an "includes" folder. Can I just have that "line" you have there inside the ".htaccess" file and nothing else to it?
  10. I have read this before, I am not quite understanding this. If I have the "*.php" files inside the following folder with XAMPP: htdocs/gallerysite/ To where do I move those files then?
  11. I just signed up on Disqus. Link: https://disqus.com/ My Question: Can this commenting system only be used for those platfroms which one can choose? I was looking to use this for my own web application (in PHP). If this may not work with Disqus, is there something similar to Disqus out there, quick and easy to set up?
  12. I have around 14 script files for an admin page. I am looking to block the access to 10 of them with .htaccess, so they can not get called up through the URL with the web browser, by for example guessing the name. <Files index.php> Order Allow,Deny Allow from all </Files> How to set up, so I can have "those" 10 files in there? Also, when comes to having an admin page and blocking the access to "those" script files is this the proper way to do it? I would appreciate the suggestions a lot!
  13. Thanks for the answers. I guess I may need ".htaccess" to block the access to the other files.
  14. Do you mean, having it kind of like a config? Can you elaborate on how to avoid that "script files" get run through the URL by "guessing" the name?
  15. I am looking to use this for an admin panel. session_start.php "session_start()" "if statement" where it checks if a successful login is given Is it necessary to include "session_start.php" into the top of each script file? If I just include "session_start.php" into the top of the "main" file where the other script files are included inside of the "main" as well, then I have it in ways where the other script files could get called up through the URL.(?) I thought it is a bit too much to include "session_start.php" into each script file. Is there a way where this can be done with more simple ways? I would appreciate the suggestions a lot.
  16. Thanks a lot for the answers! Psycho, thanks a lot for the SQL query! It works! The "order by" works for myself too!
  17. "Displaying the results" does happen, just the "ordering by DESC" does not happen. I will try the "join" suggestion a bit later.
  18. I have given the column the name "date_created" then I chose "datetime", and nothing additionaly. This is an example on how the datetime gets stored: 2014-10-22 13:18:50
  19. Script: <?php $tqs_admin_flag = "SELECT * FROM `flags`"; $tqr_admin_flag = mysqli_query($dbc, $tqs_admin_flag) or die(mysqli_error($dbc)); while($row_admin_flag = mysqli_fetch_array($tqr_admin_flag)){ //print_r($row_admin_flag); $tqs_admin_flag_thread = "SELECT * FROM `thread` WHERE `id` = '" . $row_admin_flag['thread_id'] . "' ORDER BY `date_created` DESC"; $tqr_admin_flag_thread = mysqli_query($dbc, $tqs_admin_flag_thread) or die(mysqli_error($dbc)); while($row = mysqli_fetch_assoc($tqr_admin_flag_thread)){ include($_SERVER['DOCUMENT_ROOT'] . "/gallerysite/admin_flag_thread.php"); } } ?> This in comparison works: $tqs_admin_flag_thread = "SELECT * FROM `thread` ORDER BY `date_created` DESC"; I would appreciate suggestions for which reasons the above script (the way it is) may not work. With the above script the querying and printing on screen does happen, though the "ordering by DESC" does not happen.
  20. It is used for a SQL update query, if I would not do this check all of the "entries" would get updated in the table (with the "for" loop), even though no modifications have been. Does this clarify? So basically, "check the checkbox", "modify the entry", and then have only those in the table updated where the modification has been done (where the checkbox is checked).
  21. Script: <?php // For example, the entries in the table. $entry1 = "text1"; $entry2 = "text2"; $entry3 = "text3"; // For example, the ID numbers in the table. $value1 = "140"; $value2 = "141"; $value3 = "142"; echo "<form method='POST' action='" . $_SERVER['PHP_SELF'] . "'>"; echo "<input type='checkbox' name='hashtag_modify_checkbox[]' value='" . $value1 . "' />"; echo "Modify"; echo "<input type='text' name='hashtag_name[]' value='" . $entry1 . "' />"; echo "<input type='checkbox' name='hashtag_modify_checkbox[]' value='" . $value2 . "' />"; echo "Modify"; echo "<input type='text' name='hashtag_name[]' value='" . $entry2 . "' />"; echo "<input type='checkbox' name='hashtag_modify_checkbox[]' value='" . $value3 . "' />"; echo "Modify"; echo "<input type='text' name='hashtag_name[]' value='" . $entry3 . "' />"; echo "<input type='submit' name='submit' />"; echo "</form>"; // Here, only store those hashtag names where the "modify" checkbox is checked. ?> This is used for the admin panel. It is a form where the input fields hold the text ("hashtags") already inside of them. Basically, one would have to check the "modify checkbox" to modify a hashtag, then only the modified hashtags should get stored into an array. How to have those hashtags stored in the array with the checked checkbox as the factor? The suggestions are much appreciated.
  22. Addendum: I have solved it like this: <?php if(isset($_POST['submit'])){ $hashtags = array(); for($i = 0; $i < count($_POST['hashtag']); $i++) { if (!empty($_POST['hashtag'][$i])) { $hashtags[] = $_POST['hashtag'][$i]; } } print_r($hashtags); } ?> Thanks for the answers.
  23. Addendum: <?php if(isset($_POST['submit'])){ if(isset($_POST['hashtag'])){ $hashtags = $_POST['hashtag']; } print_r($hashtags); } ?> Both, "isset" and "!empty" is printing the following: I would appreciate suggestions on this one: Array ( [0] => test [1] => test [2] => test [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => ) Note: With this I am using "hashtag[]" in the form.
  24. Jacques1, thanks for the suggestion, would I then have to use "keys" for the different values? $_POST['foo'][0], $_POST['foo'][1], $_POST['foo'][2] etc. EDIT: I tried it out, your suggestion is working great!
  25. Addendum: Okey I have tried it with this. <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <?php for($i = 0; $i < 12; $i++){ echo "<input type='text' name='hashtag" . $i . "' />"; } ?> <input type="submit" name="submit" /> </form> <?php if(isset($_POST['submit'])){ $hashtags = array(); for($i = 0; $i < 12; $i++) { if(!empty($_POST["hashtag$i"])){ $hashtags[] = $_POST["hashtag$i"]; } } print_r($hashtags); } ?> This works. Though, I have to specifically use "!empty", any reasons why? If I use "isset" I get this: Array ( [0] => test [1] => test [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => ) Thanks for the answer!
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.