Jump to content

spacepoet

Members
  • Posts

    320
  • Joined

  • Last visited

Everything posted by spacepoet

  1. Nevermind! For some reason it just started working .. odd .. Anyway, thanks for reading .. I would close this topic but I do not see where to do this .. ??
  2. Hello: I have been trying to install Open Cart (5.4 plus earlier verions) on a GoDaddy account, and I keep getting the same error and I do not know what it means or how to fix it: Warning: session_start() [function.session-start]: open(/var/chroot/home/content/c/a/s/castleplace/tmp/sess_5ug76ut9rv7oiirj2ct3p2lt37, O_RDWR) failed: No such file or directory (2) in /home/content/c/a/s/castleplace/html/system/library/session.php on line 11Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/c/a/s/castleplace/html/index.php:100) in /home/content/c/a/s/castleplace/html/system/library/session.php on line 11Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/c/a/s/castleplace/html/index.php:100) in /home/content/c/a/s/castleplace/html/system/library/session.php on line 11 Does anyone know what the solution is? The account has PHP5.2 .. I do know that I have "magic_quotes_gpc = Off;" in the php.ini file (as it is suppose to be turned off) but there was a message during installation that it was still enabled. Would this be the cause? If so, how do I turn it off? Trying it in .htaccess cause an Internal 500 error. Thanks.
  3. ISSUE SOLVED !!! I am glad! I used the $l_id (Locations id) to write the URL and Location as two different pieces of data. Looking back I should have done that in the first place, but this is all part of a learning process. Happy Holidays to me! And everyone else!!
  4. So it creates a much nicer SEO friendly URL, and it gets listed on the page with the service: 1.Private-Music-Lessons-Private-Music-Teacher.html Becomes 1.Private-Music-Lessons-Private-Music-Teacher.Philadelphia.PA.19128.html And gets listed on the page that way. Page: <html> Private Music Lessons | Private Music Teacher </html> Becomes <html> Private Music Lessons | Private Music Teacher | Philadelphia PA 19128 </html> I did this when I programmed with Classic ASP and it worked like a charm; just need to figure out this last piece. Any ideas .. ??
  5. Or .. is it possible to split the SESSION into 2 parts/names so I can use 1 for the URL and 1 to display on the pages .. ?? session_start(); if (isset ($_GET['myLocationContent'])) { $_SESSION['myLocation'] = $_GET['myLocationContent']; } if(empty ($_SESSION['myLocation'])){ $_SESSION['myLocation'] = 'Philadelphia PA 19128'; } Any ideas on this ...
  6. Sigh .... Maybe it would be better to try mod re-write .. ?? I have it working on the link I posted: echo "<li class='site-map-ul-li'><a href='1.Private-Music-Lessons-Private-Music-Teacher.".(str_replace(" ","-","$myLocationContent")).".html' title='".$myLocationContent."'>".$myLocationContent."</a></li>"; but I since it is 1 SESSION, it is also writing the dashes into the location on the page .. Can I somehow add this to my .htaccess for the 2 URL re-writes so it only writes it into the URLs .. ?? RewriteRule ^([0-9]+).([a-zA-Z0-9\-]+).([a-zA-Z0-9\-]+)\.html$ myPage.php?id=$1&myPageURL=$2&myLocationContent=$3 [L] RewriteRule ^1.Private-Music-Lessons-Private-Music-Teacher.([a-zA-Z0-9\-]+)\.html$ myPage.php?id=1&myPageURL=Private-Music-Lessons-Private-Music-Teacher&myLocationContent=$3 [L]
  7. Trying it this way: echo "<li class='site-map-ul-li'><a href='1.Private-Music-Lessons-Private-Music-Teacher.".str_replace(" ", "-" $myLocationContent).".html' title='".$myLocationContent."'>".$myLocationContent."</a></li>"; but I keep getting errors .. Any idea how to correct this .. ?? I'm excited - almost there!
  8. Hi there: Just letters, numbers and hyphens. No special characters; just trying to keep it straight-forward. Is this something I would do in the SESSION, and the have 2 variables to use .. ?? Or, can I somehow work it into the URL .. ?? header("location:1.Private-Music-Lessons-Private-Music-Teacher.".($_SESSION['myLocation']).".html"); Thanks! EDIT: Thinking about it, if I can just replace the spaces with hyphens in the URL string I posted, I would be more than happy! Possible?
  9. I GOT IT !!!!! Seems that this part: ... if (!ctype_alnum ($_GET['myLocationContent'])) { $error = 'Not a valid city name'; ... was causing the error New code: session_start(); if (isset ($_GET['myLocationContent'])) { $_SESSION['myLocation'] = $_GET['myLocationContent']; } if(empty ($_SESSION['myLocation'])){ $_SESSION['myLocation'] = 'Philadelphia PA 19128'; } Is working! One last part: any idea how I can replace the spaces with dashes in the URL *ONLY* .. so I can write the URL as: Philadelphia-PA-19128 And the text on the page as: Philadelphia PA 19128 ?? Thanks for staying with me and helping me out! I really appreciate it.
  10. Hi again: Yes, I would say it is stopping at the first space. Good point. Exact output code - I assume you mean the sitemap.php page and .htaccess file (I know this can be streamlined/coded better, but this is my first attempt at doing something like this). I removed only the HTML/CSS markup sitemap.php: <?php session_start(); if (isset ($_GET['myLocationContent'])) { if (!ctype_alnum ($_GET['myLocationContent'])) { $error = 'Not a valid city name'; } else { $_SESSION['myLocation'] = $_GET['myLocationContent']; } } if(empty ($_SESSION['myLocation'])){ $_SESSION['myLocation'] = 'Lancaster'; } include('include/db.php'); $con = mysql_connect($db_host, $db_user, $db_password); mysql_select_db($db_table); ?> <!DOCTYPE html> <html> </head> <body> <h1 class="mm-h1">Site Map</h1> <ul class="site-map-ul"> <? $query = "SELECT id, myPageActive, myPageURL, myButtonTitle, myTitle FROM myPageData WHERE myPageActive='Yes' ORDER BY listorder"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); for($j=0;$j<$num_rows;$j++) { $row = mysql_fetch_array($result); $id = $row['id']; $myTitle = $row['myTitle']; $myButtonTitle = $row['myButtonTitle']; $myPageURL = $row['myPageURL']; echo "<li class='site-map-ul-li'><a href='$id.$myPageURL.".($_SESSION['myLocation']).".html' title='".$myTitle." ".($_SESSION['myLocation'])."'>".$myButtonTitle." ".($_SESSION['myLocation'])."</a></li>"; } ?> </ul> <h1 class="mm-h1">Locations</h1> <ul class="site-map-ul"> <? $query2 = "SELECT myLocationActive, myLocationContent, l_listorder FROM myLocations WHERE myLocationActive='Yes' ORDER BY l_listorder"; $result2 = mysql_query($query2); $num_rows2 = mysql_num_rows($result2); for($j=0;$j<$num_rows2;$j++) { $row2 = mysql_fetch_array($result2); $myLocationContent = $row2['myLocationContent']; echo "<li class='site-map-ul-li'><a href='myPage.php?id=1&myPageURL=Private-Music-Lessons-Private-Music-Teacher&myLocationContent=$myLocationContent' title='".$myLocationContent."'>".$myLocationContent."</a></li>"; } ?> </ul> </body> </html> .htaccess (full file): # Mod Rewrite Options FollowSymLinks Options -MultiViews RewriteEngine on RewriteBase / # This makes the default page the one with an id of 1 RewriteRule ^$ myPage.php?id=$1&myPageURL=$2&myLocationContent=$3 [L] RewriteRule ^admin/index-login\.html$ admin/index-login\.php [L] RewriteRule ^sitemap\.html$ sitemap.php [L] RewriteRule ^sitemap\.xml$ sitemap-XML.php [L] RewriteRule ^robots\.txt$ robots.php [L] RewriteRule ^([0-9]+).([a-zA-Z0-9\-]+).([a-zA-Z0-9\-]+)\.html$ myPage.php?id=$1&myPageURL=$2&myLocationContent=$3 [L] myPage.php: (HTML/CSS removed) <?php session_start(); if (isset ($_GET['myLocationContent'])) { if (!ctype_alnum ($_GET['myLocationContent'])) { $error = 'Not a valid city name'; } else { $_SESSION['myLocation'] = $_GET['myLocationContent']; } } if(empty ($_SESSION['myLocation'])){ $_SESSION['myLocation'] = 'Lancaster'; } include("include/db.php"); $con = mysql_connect($db_host, $db_user, $db_password); mysql_select_db($db_table); $id = $_GET['id']; $myPageURL = ""; $myTitle = ""; $myDesc = ""; $myHeader = ""; $mySubHeader = ""; $myPageContent = ""; $myReadMore = ""; $myPageContentMore = ""; $myBannerContent = ""; $photo = ""; $continue = false; if(isset($_GET)) { if($id!="") { $query = "SELECT id, myTitle, myDesc, myHeader, mySubHeader, myPageContent, myReadMore, myPageContentMore, myBannerContent, photo_filename FROM myPageData WHERE id = $id"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if($num_rows>0) { $row = mysql_fetch_array($result); $continue = true; $myTitle = $row['myTitle']; $myDesc = $row['myDesc']; $myHeader = $row['myHeader']; $mySubHeader = $row['mySubHeader']; $myPageContent = $row['myPageContent']; $myReadMore = $row['myReadMore']; $myPageContentMore = $row['myPageContentMore']; $myBannerContent = $row['myBannerContent']; $photo = $row['photo_filename']; } } } if(!$continue) { header("location:1.Private-Music-Lessons-Private-Music-Teacher.".($_SESSION['myLocation']).".html"); } ?> <html> <body> <?php echo htmlspecialchars ($_SESSION['myLocation']); ?> </body> </html> It definately writes the session variable properly onto myPage.php if it it just 1 word and if I go back to the sitemap.php it is still there, so I know it is storing; it's just not working with the spaces. This is the last piece of this website so any way you know to fix this would be great! Thanks much for the help.
  11. Hi: Thanks, good catch and good point but it did not fix it .. Not sure what you mean by "exactly what URL are you trying?" but: (This is generated after I click the link I posted) Works: http://www.website.com/myPage.php?id=1&myPageURL=Private-Music-Lessons-Private-Music-Teacher&myLocationContent=Philadelphia Does not work http://www.website.com/myPage.php?id=1&myPageURL=Private-Music-Lessons-Private-Music-Teacher&myLocationContent=Philadelphia%20PA There is no %20 in the address bar after I click the link, but when I copied and pasted it into this post there is. It displays like this in the address bar: http://www.website.com/myPage.php?id=1&myPageURL=Private-Music-Lessons-Private-Music-Teacher&myLocationContent=Philadelphia PA It goes to myPage.php via mod rewrite and picks up the session and displays it if it 1 word, but not more than 1 (it keeps keeps the previous session with 1 word): <?php session_start(); if (isset ($_GET['myLocationContent'])) { if (!ctype_alnum ($_GET['myLocationContent'])) { $error = 'Not a valid city name'; } else { $_SESSION['myLocation'] = $_GET['myLocationContent']; } } if(empty ($_SESSION['myLocation'])){ $_SESSION['myLocation'] = 'Philadelphia'; } ?> <html> <?php echo htmlspecialchars ($_SESSION['myLocation']); ?> </html> Any ideas ..??
  12. Hello: I have a problem that has stumped me. I have this query string and mod rewrite in .htaccess: sitemap.php echo "<li class='site-map-ul-li'><a href='myPage.php?id=1&myPageURL=Private-Music-Lessons-Private-Music-Teacher&myLocationContent=$myLocationContent' title='".$myLocationContent."'>".$myLocationContent."</a></li>"; .htaccess RewriteRule ^([0-9]+).([a-zA-Z0-9\-]+).([a-zA-Z0-9\-]+)\.html$ myPage.php?id=$1&myPageURL=$2myLocationContent=$3 [L] If "$myLocationContent" is one word - "Philadelphia" it works fine But, if it is two or more words with either a space or a dash ("Philadelphia PA" or "Philadelphia-PA") it does not work. Any idea why .. ?? I ideally want to write the URL as "Philadelphia-PA.html" and display it on the page as "Philadelphia PA"
  13. Hello: I will have to explore getting a local server. But, I did get it to work this way: echo "<li><a href='myPage.php?id=1&myPageURL=Private-Music-Lessons-Private-Music-Teacher&myLocationContent=$myLocationContent' title='".$myLocationContent."'>".$myLocationContent."</a></li>"; which is not ideal, but at least it is a start. Can you recommened how I might use mod re-writing to make a "better" URL .. ?? I do want the id to always be 1 and the myPageURL to always be "Private-Music-Lessons-Private-Music-Teacher" I use this to re-write the other pages, but it does not work for this. RewriteRule ^([0-9]+).([a-zA-Z0-9\-]+).([a-zA-Z0-9\-]+)\.html$ myPage.php?id=$1&myPageURL=$2myLocationContent=$3 [L] One other thing I noticed (it is always something!): when I use 1 word for the "myLocationContent (like "Philadelphia") it writes the URL fine, but if it is 2 or more words (like "Philadelphia PA" - I assume the space is the issue) it does not work. Can this be fixed .. ?? Thanks for all the advice and input!
  14. Hi there: I can't re-start the server .. it's a site hosted at GoDaddy .. Can you think of a way to solve my problem .. ?? Any solutions or "tricks" to get this working would be greatly appreciated .. Thanks!
  15. Oh, I see what you mean. I found (via GOOGLE) that it should be: if (!ctype_alnum ($_GET['myLocationContent'])) { not alphanum But, it has not changed how the page works (meaning, I still get the same results). Do you even have error reporting turned on? I'm going to say no, because my next question is to ask how I turn that on ... ?? I'm still learning .. EDIT: I just added this (exactly as I listed it) to the php.ini file: ini_set('error_reporting', E_ALL); but no errors are displayed .. Is this the correct way to do it .. ??
  16. Hi there: Not sure ... I assume that function is pre-defined in the mySQL database (if that is even possible; I always assumed that's how a function like "my_real_escape_string" worked) .. ?? I do know I am almost there with my project, but can't get this last part to work .. Any ideas? Can I somehow transfer "myLocationContent" as a variable onto the main page, and then create the SESSION .. ?? Thanks.
  17. Hi again: Can you see why the SESSION is not getting carried onto the main page .. ?? I am listing the records of locations entered from the database (and I *THINK* starting a SESSION for them ..??); sitemap.html (re-written from "sitemap.php" in the .htaccess file): <?php session_start(); $_SESSION['myLocation'] = $myLocationContent; <html> <? $query2 = "SELECT myLocationActive, myLocationContent, l_listorder FROM myLocations WHERE myLocationActive='Yes' ORDER BY l_listorder"; $result2 = mysql_query($query2); $num_rows2 = mysql_num_rows($result2); for($j=0;$j<$num_rows2;$j++) { $row2 = mysql_fetch_array($result2); $myLocationContent = $row2['myLocationContent']; echo "<li class='site-map-ul-li'><a href='1.Private-Music-Lessons-Private-Music-Teacher.$myLocationContent.html' title='".$myLocationContent."'>".$myLocationContent."</a></li>"; } ?> </html> The "1.Private-Music-Lessons-Private-Music-Teacher..." page is the homepage/default page on the site that I create with mod re-write in .htaccess: # This makes the default page the one with an id of 1 RewriteRule ^$ myPage.php?id=$1&myPageURL=$2myLocationContent=$3 [L] # This is for all the other pages RewriteRule ^([0-9]+).([a-zA-Z0-9\-]+).([a-zA-Z0-9\-]+)\.html$ myPage.php?id=$1&myPageURL=$2myLocationContent=$3 [L] Regardless if that is relevant, I set-up the link for the locations on the "sitemap.html" page in .htaccess like this: RewriteRule ^1.Private-Music-Lessons-Private-Music-Teacher.([a-zA-Z0-9\-]+)\.html$ 1.Private-Music-Lessons-Private-Music-Teacher.$myLocationContent\.html [L] Then on "myPage.php (re-written for each page with .htaccess): <?php session_start(); if (isset ($_GET['myLocationContent'])) { if (!ctype_alphanum ($_GET['myLocationContent'])) { $error = 'Not a valid city name'; } else { $_SESSION['myLocation'] = $_GET['myLocationContent']; } } if(empty ($_SESSION['myLocation'])){ $_SESSION['myLocation'] = 'Philadelphia'; } ?> <html> <?php echo htmlspecialchars ($_SESSION['myLocation']); ?> </html> I keep getting "Philadelphia" every time, even though the link(s) on "sitemap.html" might be "Lancaster" or "Atlanta" The URL are written properly (2.this-is-a-page.Lancaster.html"), but once I click the link and go to "myPage..." it/the SESSION goes to (2.this-is-a-page.Philadelphia.html"). Any idea what I'm doing wrong and how I can get this to work .. ?? Thanks!
  18. Hi Christian (and everyone else!): OK - thanks!! This is starting to come together for me. This was driving me nuts for days .. lol .. I have two questions: 1 - Is there a relatively easy way to store the SESSION in a cookie, in case a user bookmarks the site? I am trying to get them to land on the site with the city/state/zip they type into a search engine, and then hopefully it will grab that city from the SESSION. I am writing it into the page URL as well. I was hoping to store it for a year, actually. 2 - I wanted to see if you new a way to display and/or write the SESSION in two ways, based on what you showed me: session_start(); // If the showLocation GET parameter has been set in the URL. if (isset ($_GET['showLocation'])) { // Make sure that showLocation only contains letters or numbers. if (!ctype_alphanum ($_GET['showLocation'])) { // City contained invalid charcters, show error. $error = 'Not a valid city name'; } else { // City name validated, add to session array. $_SESSION['myLocation'] = $_GET['showLocation']; } } // If the city name is not set, add default. if(empty ($_SESSION['myLocation'])){ $_SESSION['myLocation'] = 'Lancaster, PA 19480'; } I wanted to be able to be able to display it on the page as is: Lancaster, PA 19480 But somehow do a replace to change the comma and empty space into dashes for when I write it into the page URL: Lancaster-PA-19480 Can both of these be done .. ?? Thanks much!
  19. Thank you! I am working on this now .. I will let you know how I make out .. I already have a couple questions but I really appreciate the help!
  20. Hello: Does anyone use CKEditor? I want to insert PHP tags: <? echo $myVar; ?> via the RTE (Rich Text Editor) but I cannot get them to display on the website. I am inserting the data in an admin area so I am not worried about malicious code. When I display the data on the frontend it does not appear. But, when I view the source code it is showing the code as I entered it: <? echo $myVar; ?> rather than whatever the myVar is (Hello World, for example). Does anyone know why this is happening or have a solution? I thought maybe I could do a str_replace as I insert the data or display the data .. ?? INSERT $myVar = mysql_real_escape_string(str_replace(array('{%', '%}'), array('<?', '?>'), $_POST['myVar'])); Using a set of {% %} tags first, but this does not work the way I am doing it. Display: $myVar = $row['myVar']; Or, is there an encoding type I need to declare ..?? Anyone have any ideas?
  21. Hello: Thanks for showing me this! I do have it working on the initial page. <?php session_start(); if(!isset($_GET['showCity'])){ $cityToShow = 'Philadelphia PA, 19128'; } else{ $cityToShow = $_GET['showCity']; } $_SESSION['showCity'] = $cityToShow; ?> <html> <? echo $cityToShow; ?> </html> But, how to I "swap" the city to another one of a new link is clicked (on this page or a different page)? I tried this: sitemap.php <?php session_start(); if(!isset($_GET['showCity'])){ $cityToShow = 'Lancaster'; } ?> echo "<li class='site-map-ul-li'><a href='$id.$myPageURL.$cityToShow.html' title='".$myTitle."'>".$myButtonTitle."</a></li>"; But it did not work ... "$cityToShow" writes the word "Lancaster" into the URL, so I assume it is working. I am using mod re-write to write the URLs" .htaccess RewriteRule ^([0-9]+).([a-zA-Z0-9\-]+).([a-zA-Z0-9\-]+)\.html$ myPage.php?id=$1&myPageURL=$2cityToShow=$3 [L] Any ideas on how to accomplish this .. ??
  22. Hello there: Thanks for posting this well-written explanation. Yes, this does clear-up some of my questions! But I cannot get my script to work: <?php session_start(); $_SESSION['showCity']; $showCity = $_GET['showCity']; if($_SESSION['showCity'] == "") { $_SESSION['showCity'] == "Philadelphia PA, 19128"; } else { $_SESSION['showCity'] == $showCity; } <html> <? echo $showCity; ?> </html> Is it possible to do this is PHP? I am asking because I use to do something very similar in Classic ASP using a SERVER.TRANSFER method. But PHP does not have SERVER.TRANSFER. Any ideas how to get my script working properly? Thanks!
  23. Hello: I do not quite understand how SESSIONS work, so now is a good time to seek some answers .. I am trying to make a SESSION that will set a default location (if the session is blank) or display a SESSION requested from another link on that page, or a different page. Not fairing as well as I had hoped .. So .. Page.php: <?php session_start(); $_SESSION['showCity']; $showCity = $_GET['showCity']; if($_SESSION['showCity'] == "") { echo "Philadelphia PA, 19128"; } else { echo $showCity; } <html> <? echo $showCity; ?> </html> I am trying to define the SESSION at the top of the page, and then display it one or more times on the page. Not working ... Also, how would I change it if the SESSION variable is different on another page: <a href="Page.php?showCity='Lancaster PA, 14567">Lancaster PA, 14567</a> Can someone clear up my confusion .. ??
  24. Probably a very dumb question on my part, but how do I do that ..
  25. I am trying this: <? echo "<ul class='site-map-ul'>"; $radius = 20; $zip = "19128"; $query2 = "SELECT zip_id,lat,lon,city,abbr_state,zip FROM zip_codes WHERE (POW((69.1*(lon-\"$lon\")*cos($lat/57.3)),\"2\")+POW((69.1*(lat-\"$lat\")),\"2\"))<($radius*$radius)"; $result2 = mysql_query($query2); $num_rows2 = mysql_num_rows($result2); for($j=0;$j<$num_rows2;$j++) { $row2 = mysql_fetch_array($result2); $zip_id = $row2['zip_id']; $lat = $row2['lat']; $lon = $row2['lon']; $city = $row2['city']; $abbr_state = $row2['abbr_state']; $zip = $row2['zip']; $city = ucwords(strtolower($city)); echo "<li class='site-map-ul-li'><a href='$zip_id.$city.$abbr_state.$zip.php?zip_id=$zip_id&city=$city&abbr_state=$abbr_state&zip=$zip' title='".$city." ".$abbr_state.", ".$zip."'>".$city." ".$abbr_state.", ".$zip."</a></li>"; } echo "</ul>"; ?> But not working .. Getting the error: [b]Warning[/b]: mysql_num_rows() expects parameter 1 to be resource, boolean given in [b]/home/content/55/9880955/html/sitemap.php[/b] on line [b]70[/b] Line 70: $num_rows2 = mysql_num_rows($result2); I assumed it would see the zipcode is 19128, and find all zipcodes within a 20 mile radius of it .. Apparently not ...
×
×
  • 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.