premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Most likely what is happening is the .htaccess is being accessed twice (which is not uncommon) so the first rewrite runs fine, but then it is re-directed and runs through the rules again and since index.php matches your ruleset it is ran again and index.php is now appended. The fix, make the rewrite rule omit .php, or add a rule above it that index.php is left alone like: RewriteEngine On RewriteRule ^index.php$ - [L] # Leave index.php to itself RewriteRule ^([a-z-]+\.[a-z]{2,}\.?[a-z]{0,})$ index.php?url=$1 [L] Not sure if that will work, given the index.php to itself rule, but you should be able to modify it / work from that.
-
Zend Server CE & Virtual Hosts (help Gurus)
premiso replied to 2levelsabove's topic in Apache HTTP Server
Did you try adding the trailing slash as I suggested? Did that not work? If the DOCUMENT_ROOT is pointing to "D:\zend_server_ce\Apache2\htdocs\domain.com\" what is the problem? IE how is it not pointing correctly? Since it is not "pointing correctly" perhaps it is your code that is flawed and not your vhosts declaration? There are too many variables here, given that you said it breaks on the live server. That says that you are probably working on different PHP Versions with different php.ini files and or the code does some compensation for the localhost server and they do not jive. The first thing first, how does the live server break? What are the symptoms of it? Are you sure it is not just how the code is programmed? -
Funny thing, I wrote a tutorial about this not too long ago for Debian, perhaps it will help you? Setup SVN with SSL on Debian with Apache2 The problem could lay in the vhosts file and not having more information, such as servername inside of it. But using that you should not mess wit hthe dav_svn.conf. @thorpe, the dav_svn.conf is located under /etc/apache2/mods-enabled/dav_svn.conf, everything in that file should be commented out, as the directive in the vhosts file is enough.
-
Zend Server CE & Virtual Hosts (help Gurus)
premiso replied to 2levelsabove's topic in Apache HTTP Server
A bit more information would help, such as where is your DOCUMENT_ROOT pointing to? As far as I know the <Directory> directive requires a tailing slash: <Directory "D:\zend_server_ce\Apache2\htdocs\domain.com\"> But I have never really quite seen a vhost file setup like what you have pasted, but I have never used Zend Server CE either. -
Me, I like the typewriters. Who needs a computer and keyboard when you have typewriters about?
-
Sometimes, the best thing to do is to look through the manual. http://us3.php.net/manual/en/function.substr.php#73233 ijavier aka(not imatech) igjav 14-Feb-2007 10:20 <?php /* An advanced substr but without breaking words in the middle. Comes in 3 flavours, one gets up to length chars as a maximum, the other with length chars as a minimum up to the next word, and the other considers removing final dots, commas and etcteteras for the sake of beauty (hahaha). This functions were posted by me some years ago, in the middle of the ages I had to use them in some corporations incorporated, with the luck to find them in some php not up to date mirrors. These mirrors are rarely being more not up to date till the end of the world... Well, may be am I the only person that finds usef not t bre word in th middl? Than! (ks) This is the calling syntax: snippet(phrase,[max length],[phrase tail]) snippetgreedy(phrase,[max length before next space],[phrase tail]) */ function snippet($text,$length=64,$tail="...") { $text = trim($text); $txtl = strlen($text); if($txtl > $length) { for($i=1;$text[$length-$i]!=" ";$i++) { if($i == $length) { return substr($text,0,$length) . $tail; } } $text = substr($text,0,$length-$i+1) . $tail; } return $text; } // It behaves greedy, gets length characters ore goes for more function snippetgreedy($text,$length=64,$tail="...") { $text = trim($text); if(strlen($text) > $length) { for($i=0;$text[$length+$i]!=" ";$i++) { if(!$text[$length+$i]) { return $text; } } $text = substr($text,0,$length+$i) . $tail; } return $text; } // The same as the snippet but removing latest low punctuation chars, // if they exist (dots and commas). It performs a later suffixal trim of spaces function snippetwop($text,$length=64,$tail="...") { $text = trim($text); $txtl = strlen($text); if($txtl > $length) { for($i=1;$text[$length-$i]!=" ";$i++) { if($i == $length) { return substr($text,0,$length) . $tail; } } for(;$text[$length-$i]=="," || $text[$length-$i]=="." || $text[$length-$i]==" ";$i++) {;} $text = substr($text,0,$length-$i+1) . $tail; } return $text; } /* echo(snippet("this is not too long to run on the column on the left, perhaps, or perhaps yes, no idea") . "<br>"); echo(snippetwop("this is not too long to run on the column on the left, perhaps, or perhaps yes, no idea") . "<br>"); echo(snippetgreedy("this is not too long to run on the column on the left, perhaps, or perhaps yes, no idea")); */ ?>
-
The manual: strings Using str_split and a foreach loop you should be able to determine this.
-
Using sessions will allow you access it. Just store the POST data you want to access into session and call it in the page you want to access it in.
-
Start using Absolute Paths, as relative paths often cause problems, as you have just found out. (IE remove the ../ and make it the actual url to access the image.) As my bet is stories.php is not in the same directory level (meaning two directories up) of where that header file is normally included from. More information on absolute vs relative: http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm
-
You should be able to run an UPDATE on the primary and auto_increment id, albiet it is generally not recommended, instead it would be recommended to have a separate column for "order" and then order it by that and you can use that to display it.
-
Warning: include() [function.include]: Unable to access
premiso replied to benzetti82's topic in PHP Coding Help
Since the include path is to the includes, do you really need the /includes when including it? Perhaps remove the /includes from your include path and see how that works out for ya. -
A. You are including connect.inc, when you have a connect function at the top of the script. What is the purpose of that? B. You are not setting $id = $_GET['id'] so $id is essentially empty.
-
using SELECT __ FROM table Where to get FileName from a table?
premiso replied to prallen's topic in MySQL Help
Try removing the whitespace after the UniqueID = ' $sql = "SELECT * FROM table Where UniqueID = 'nCSoHUaDMz'"; As MySQL will actually look for " asdfasear" you have to be exact or use the LIKE statement. -
Way to be descriptive! $_GET is not a method, but a Global Array which provides access to the query string of the url. If you are getting an "index not defined" error you can do this: $data = isset($_GET['data'])?$_GET['data']:''; Then when you access $data, it will not throw an error. If this is not the case, please provide us with something useful, such as the "unwanted" data you are receiving. Edit: Since you actually posted something useful. if (isset($_GET['id'])){ That will only execute if the array index of 'id' inside of $_GET has been set.
-
date is a reserved word in MySQL. So in your SELECT statement either encase `date` it in backticks (`) or rename the column (preferred). Also, I do not see you calling mysql_query and if you are calling it, I would suggest the following be added after it: $result = mysql_query($Coursesql) or trigger_error("Course Query Failed: " . mysql_error()); As that will give you a better idea of what is going wrong.
-
No. You would need to fetch the website data with the full path. Since most hosting do not allow fopen_wrappers (which means you cannot do it with include.) Instead you will need to either use file_get_contents or cURL to fetch the data then print / echo it to the screen. See the links (click on the file_get_contents or cURL above to view examples).
-
You could probably make a loop and check for Saturday / Sunday, if it is equal to that then omit. For the holidays, well you would have to take into account the "Observed" Holiday and calculate that, so you could not just simply define a date and viola! But it would be the same type of deal, if the date is equal to this date (either hardcoded in there or into an array) then you omit it and continue onwards. I am sure there are plenty of Calendar scripts that have this functionality that you could look at the decipher to create your own special function.
-
$fh=fopen($myFile, 'w') or die("can't open file"); fclose($fh); Since you do not define the directory there that creates an empty file where ever this script is executing from. To fix, remove that (as I do not see that it is doing anything productive) or unlink($myFile); as well. Either or should be fine.
-
How would you calculate mileage between two cities?
premiso replied to tomdelonge's topic in PHP Coding Help
lol You are better off looking it up online. What you need to do is find the latitude and longitude for each ZipCode, after you have that find out how many degrees is considered a mile. Once you have that you should be able to calculate it no problem! The point, you have to have 2 absolute positions and have a way to calculate the distance between two points. Without having or knowing 2 absolute positions, how do you expect to calculate the distance (other then by driving there yourself and doing an average speed etc, which Zane hit on)? -
$query2 = mysql_query("INSERT INTO user_group (group_id, user_id, group_leader, user_pending) VALUES ('2', '$dataArray[$i][0]', '0', '0'')") or DIE(mysql_error()); $query3 = mysql_query("INSERT INTO user_group (group_id, user_id, group_leader, user_pending) VALUES ('7', '$dataArray[$i][0]', '0', '0'')") or DIE(mysql_error()); Both of those have an extra ' after the last 0. And in this section: ('$dataArray[$i][0]', '0', '2', '', '0', '', '$dataArray[$i][3]', '$dataArray[$i][1]', '$dataArray[$i][1]' You need to encapsulate arrays (when accessing multiple dimensions) in curly braces: ('{$dataArray[$i][0]}', '0', '2', '', '0', '', '{$dataArray[$i][3]}', '{$dataArray[$i][1]}', '{$dataArray[$i][1]}', See if those help you out.
-
I do not think it would be valid XML if you were to do the actual < and >. As it would break syntax. It has to be the entity. Instead of trying to get it to be the actual < why not just decode the entitiy on retrieval / display using html_entity_decode?
-
(badger) (badger) (badger)
-
Whale the badger had massive fangs and claws!
-
$showing = "Currently Showing {$page} - " . ($perpage * $page) . " of " . $totalresults;
-
Problems uploading images to PHP image gallery PLEASE HELP
premiso replied to waferdave's topic in Third Party Scripts
I did not realize that the comments / suggestions forum offered help. Intriguing!