Jump to content

TomTees

Members
  • Posts

    187
  • Joined

  • Last visited

    Never

Everything posted by TomTees

  1. So when would you use... /SomeFile.php as opposed to... SomeFile.php OR /MyFolder/SomeFile.php as opposed to... MyFolder/SomeFile.php TomTees
  2. Because the tiny_mce directory is obviously in the same directory as your calling page not the web servers root as you had used previously. I thought you needed a "/" to go into a directory? TomTees
  3. Its a client side address, so the first / points to the web servers document root. But yeah, its likely the path is incorrect. Yep, its the same pain-in-the-arse as the Rel thingy in HTML... This is the code that works... <!-- TINYMCE CODE --> <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script> Don't ask me why?! Also, I tried adding some text that I added formatting to, and while the entry was saved in my database, none of the formatting was captured so I'm not sure what the issue with that is?! TomTees
  4. Paths really screw me up in PHP. (Particularly with this author and his procedural style...) In my Web Root (in NetBeans), my main file is "index.php" (Then the series of includes starts) Index.php includes footer.html in the "includes" directory. Footer.html has this code... <li><a href="add_page.php" title="Add a Page">Add Page</a></li> "add_page.php" is in the Web Root, and it apparently appears as part of index.php by way of footer.html. (Convoluted if you ask me.) In the Web Root I have the "tiny_mce" directory. In that directory is "tiny_mce.js" which is supposed to run everything. In "add_page.php" I have this.. <!-- TINYMCE CODE --> <script type="text/javascript" src="../tiny_mce/tiny_mce.js"></script> I also tried this... <!-- TINYMCE CODE --> <script type="text/javascript" src="../tiny_mce/tiny_mce.js"></script> I *thought* I understood navigating paths pretty well, but I know that rel=... in HTML always screws me up because it doesn't work like regular paths. It works from the parent file's perspective and not the file the actual code is in. *Maybe* that is the issue with this JavaScript code which I know nothing about?? TomTees
  5. You're pretty smart. Someday maybe they'll make you a Global Moderator or something?! Thanks, TomTees
  6. I am in my motel room right now. If I disconnect from the Internet (i.e. turn off my Internet Connection), and then fire up MAMP, instead of getting the splash page, I get... If I then open up NetBeans and try to execute a PHP script, I get the same message as above. So that says to me, that without MAMP (likely Apache) having Internet access, it acts all retarded and refuses to serve up PHP pages?! That makes no sense, because all of my files are local, so even though I'm use a webserver (i.e. MAMP/Apache), it shouldn't need any Internet access. (I think I asked this question a few years ago, and someone mentioned something about a "Loop-Back Issue"??) Regardless, this is a real pain, because it means that with a live Internet connection, I can't do any development/testing (e.g. on a plane, at work, etc) Any ideas what the deal is??? TomTees
  7. Here is the HTML output from my PHP script... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- HTML HEADER --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Add a Site Content Page </title> <link rel="stylesheet" href="css/styles.css" type="text/css" /> </head> <!-- END OF HTML HEADER --> <!-- HTML BODY --> <body> <!-- WRAPPER --> <div id="wrap"> <!-- PAGE HEADING --> <div class="header"> <h1><a href="index.php">Some Title Here</a></h1> <h2>A Tagline Goes Here</h2> </div> <!-- END OF PAGE HEADING --> <!-- TAB NAVIGATION --> <div id="nav"> <ul> <li><a href="index.php"><span>Home</span></a></li><li><a href="about.php"><span>About</span></a></li><li><a href="contact.php"><span>Contact</span></a></li><li><a href="register.php"><span>Register</span></a></li> </ul> </div> <!-- END OF TAB NAVIGATION --> <!-- PAGE BODY --> <div class="page"> <!-- MAIN CONTENT --> <div class="content"> <!-- END OF HEADER --> <h3>Add a Site Content Page</h3> <form action="add_page.php" method="post" accept-charset="utf-8"> <fieldset> <legend>Fill out the form to add a page of content:</legend> <p> <label for="title"><strong>Title</strong></label><br /> <input type="text" name="title" id="title" /> </p> <p> <label for="category"><strong>Category</strong></label><br /> <select name="category" > <option>Select One</option> <option value="3">Category 1</option> <option value="5">Category 2</option> <option value="1">Category 3</option> <option value="4">Category 4</option> <option value="2">Category 5</option> </select> </p> <p> <label for="description"><strong>Description</strong></label><br /> <textarea name="description" id="description" rows="5" cols="75"></textarea> </p> <p> <label for="content"><strong>Content</strong></label><br /> <textarea name="content" id="content" rows="5" cols="75"></textarea> </p> <p> <input type="submit" name="submit_button" class="formbutton" id="submit_button" value="Add This Page" /> </p> </fieldset> </form> <!-- TINYMCE CODE --> <script type="text/javascript" src="../tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "exact", elements : "content", theme : "advanced", width : 800, height : 400, plugins : "advlink,advlist,autoresize,autosave,contextmenu,fullscreen,iespell,inlinepopups,media,paste,preview,safari,searchreplace,visualchars,wordcount,xhtmlxtras", // Theme options theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,undo,redo,removeformat,|,search,replace,|,cleanup,help,code,preview,visualaid,fullscreen", theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,outdent,indent,blockquote,|,sub,sup,cite,abbr", theme_advanced_buttons3 : "hr,|,link,unlink,anchor,image,|,charmap,emotions,iespell,media", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "/css/styles.css", }); </script> <!-- END TinyMCE code --> <!-- START OF FOOTER --> </div> <!-- END OF MAIN CONTENT --> <!-- SIDEBAR --> <div class="sidebar"> <!-- SIDEBAR ACCOUNT SECTION --> <div class="title"> <h4>Manage Your Account</h4> </div> <ul> <li><a href="renew.php" title="Renew Your Account">Renew Account</a></li> <li><a href="change_password.php" title="Change Your Password">Change Password</a></li> <li><a href="favorites.php" title="View Your Favorites">Favorites</a></li> <li><a href="recommendations.php" title="View Your Recommendations">Recommendations</a></li> <li><a href="logout.php" title="Logout">Logout</a></li> </ul> <div class="title"> <h4>Administration</h4> </div> <ul> <li><a href="add_page.php" title="Add a Page">Add Page</a></li> <li><a href="add_pdf.php" title="Add a PDF">Add PDF</a></li> <li><a href="#" title="Blah">Blah</a></li> </ul> <!-- END OF SIDEBAR ACCOUNT SECTION --> <!-- SIDEBAR CONTENT --> <div class="title"> <h4>Content</h4> </div> <ul> <li><a href="category.php?id=3" title="Topic 1">Topic 1</a></li> <li><a href="category.php?id=5" title="Topic 2">Topic 2</a></li> <li><a href="category.php?id=1" title="Topic 3">Topic 3</a></li> <li><a href="category.php?id=4" title="Topic 4">Topic 4</a></li> <li><a href="category.php?id=2" title="Topic 5">Topic 5</a></li> <li><a href="pdfs.php" title="Topic 6">Topic 6</a></li> </ul> <!-- END OF CONTENT SIDEBAR --> </div> <!-- END OF SIDEBAR --> <!-- FOOTER --> <div class="footer"> <p> <a href="site_map.php" title="Site Map">Site Map</a> | <a href="policies.php" title="Policies">Policies</a> © | </p> </div> <!-- END OF FOOTER --> </div> <!-- END OF PAGE BODY --> </div> <!-- END OF WRAPPER --> </body> <!-- END OF HTML BODY --> </html> Like I said in my original post, the Javascript editor I tried to add to the comments box doesn't even appear... TomTees
  8. I am using MAMP on my MacBook and don't understand why MAMP and my code in NetBeans will not run if I am offline? If I am trying to execute PHP files locally on my laptop, why should MAMP or Apache of NetBEans care if I do not have an Internet connection?! I wanted to show someone something at work where there is no Internet access, but that won't work as it currently stands. TomTees
  9. Like after I run the PHP script? TomTees
  10. Already did that. It is kind of lame. There is no editor, so that is pretty bare bone... It must be something simple. TomTees
  11. I am reading a book that shows you how to use TinyMCE so that you have an editor to use in a TextArea in the webpage. I am followed the example in the book but it isn't working. My book told me to place this code after my <form>... <!-- TINYMCE CODE --> <script type="text/javascript" src="/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "exact", elements : "content", theme : "advanced", width : 800, height : 400, plugins : "advlink,advlist,autoresize,autosave,contextmenu,fullscreen,iespell,inlinepopups,media,paste,preview,safari,searchreplace,visualchars,wordcount,xhtmlxtras", // Theme options theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,undo,redo,removeformat,|,search,replace,|,cleanup,help,code,preview,visualaid,fullscreen", theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,outdent,indent,blockquote,|,sub,sup,cite,abbr", theme_advanced_buttons3 : "hr,|,link,unlink,anchor,image,|,charmap,emotions,iespell,media", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "/css/styles.css", }); </script> <!-- END TinyMCE code --> The form with TextArea appears like it should in the main page but there is no editor. What am I doing wrong? TomTees
  12. So when you are building a website, is there any logical reason to name a file as HTML? (It seems to me that it would be easier to name HTML, HTML+PHP, and PHP files just as .php for simplicity?!) TomTees
  13. Okay, but to be more correct - as I found out last week - you can have 100% HTML in a PHP file and it ill run okay, but if you have any PHP in an HTML (by your webserver default) the PHP won't run. Right? Same if it is an HTML file. That is where I screwed up. (Of course it didn't help that NetBeans tricked my into thinking I could do this... <?php <!-- Comment grayed out in NetBeans but invalid when code runs!! --> ?> Yeah, GOD FORBID someone actually tried to make their code WELL-DOCUMENTED and READABLE!! (What w-a-s I thinking?!) TomTees
  14. I know that. And since it is an HTML file, I figured I could use them. But back to my question... TomTees
  15. I have a file ("header.html") that predominately has HTML in it. This may sound silly, but I would like to rename it as a .php file so that when I add comments next to my PHP, my IDE will shade them gray. I just changed all of my PHP comments from // Some PHP comment to <!-- New and Improved PHP comment --> only to realize that PHP freaks out and doesn't treat them as comments - like NetBeans falsely does - but treats them as erroneous code. (Now I have to go back and fix all of my files back to the way they were?!) If I could change my file from "header.html" to "header.php" then all of my // Comments would be grayed out in my PHP blocks and make my code easier to read. To achieve that end, is it okay to rename a file from .html to .php even if most of the content is HTML and only a little is PHP? (BTW, could you have a file that has 100% html content saved as a .php file and still have it work properly?!) Thanks, TomTees
  16. So, does the code I originally posted look okay? Does it safely regenerate the session id without the risk of losing the user's session information? If they are an admin, the code regenerates the session id but then should assign the same information the session originally had, so as far as I can see there is nothing to be lost. The author's code may not be the most efficient, but it looks okay. I just wanted some second opinions. Thanks, TomTees
  17. Well I knew that. What I meant was, is it a problem that it overwrites the values if the person is an admin? Maybe there is a better way to write the code than the author did? I'm just not overly familiar with sessions or this session_regenerate_id function... Thanks, TomTees
  18. I am trying to implement session_regenerate_id but am a little uncertain about the code from my book. // Check for match. if (mysqli_num_rows($r) == 1){ // User found. // Fetch User info. $row = mysqli_fetch_array($r, MYSQLI_NUM); // Note A $_SESSION['user_id'] = $row[0]; // Assign UserID to Session. $_SESSION['username'] = $row[1]; // Assign Username to Session. /* ORIGINAL CODE if ($row[2] == 'admin'){ $_SESSION['user_admin'] = true; // Assign to Session. } if ($row[3] == 1){ $_SESSION['user_not_expired'] = true; // Assign to Session. } */ // NEW CODE if ($row[2] == 'admin'){ // Call before storing any session data, because passing "true" as // the 1st argument causes any existing session data to be destroyed. session_regenerate_id(true); $_SESSION['user_admin'] = true; // Assign to Session. // Will this over-write any data from above (see Note A)?? $_SESSION['user_id'] = $row[0]; // Assign UserID to Session. $_SESSION['username'] = $row[1]; // Assign Username to Session. } if ($row[3] == 1){ $_SESSION['user_not_expired'] = true; // Assign to Session. } } else { My question is... // Will this over-write any data from above (see Note A)?? It is nested in the code above along with "Note A". Thanks, TomTees
  19. UGH!!! What a freshman mistake!! (Looks like my elderly eyes failed me at nearly 2:00am last night!!) Thanks for the catch!!! TomTees
  20. Another bizzare thing that stopped working all of a sudden... I have a registration form and this code no longer works... // Check for First Name. // Allow letters, space, period, apostrophe, and hyphen. if (preg_match('/^[A-Z\'.-]{2-20}$/i', $_POST['first_name'])){ $fn = mysqli_real_escape_string($dbc, $_POST['first_name']); } else { // Add error-message to array. $reg_errors['first_name'] = 'Please enter your first name!'; } All day when I typed in a two letter answer - to speed up typing and testing - things worked fine, but now I get a built-in error message off to the side of the input box. I typed 'ee' and that always worked before but no luck now. The Reg Ex hasn't changed. Could it be that there is a database connectivity issue that is screwing up my RegEx?? If I comment out all of the RegEx stuff then it works and my INSERT works - thanks to AlexWD TomTees
  21. Yep, that fixed it! Bizzare-o... I didn't touch that code all evening and when I went to run a different module - the error is in "Registration" and I was working on "Log In" - things broke?! Only thing I can think is that I was toggling between the code I downloaded from my book and maybe my code was broken and I didn't catch it... THANKS!! BTW, what exactly does that code do?? ADDDATE(NOW(), INTERVAL 1 MONTH) I guess it adds one month to the current time-date stamp? TomTees
  22. My application just broke about 2 hours ago and for the life of me I don't know what I did to it?! :'( (I was coding a different file, and when I tried to run the main - unrelated index.php - things stopped working?!) Here is a snippet of the suspect code... if ($rows == 0){ // Email and Username are available. // Add User to the database. $q = "INSERT INTO users(username, email, pass, first_name, last_name, date_expires) VALUES('$u', '$e', '" . get_password_hash($p) . "', '$fn', '$ln', ADDDATE(NOW()), INTERVAL 1 MONTH))"; $r = mysqli_query($dbc, $q); When I step through my code in NetBeans, the INSERT is failing and I don't know why because I haven't touched this code since this morning and it was working all day... Please help! TomTees
  23. Okay. So, back to an earlier thread... How would I say, "The current directory."?? How would I say, "The Web Root."?? TomTees
  24. Hmmm... Interesting... Well, I like my way better for brevity's sake. (But I did learn a new way to say the same thing...) Thanks, TomTees
×
×
  • 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.