FAQ |
Kalender |
![]() |
#1 | |||
|
||||
Mycket flitig postare
|
Kör XAMPP på en serverburk där vårt intranät ligger. Jag har nu bytt ut vårt nyhetsscript mot ett annat som uppfyller kraven på säkerhet. För att jag ska kunna få in nyheterna på intranetets startsida vill den att jag infogar följande kod:
Kod:
<?PHP $number=20; include("C:\xampp\htdocs\cutenews\backup/show_news.php"); ?> Vora bra om du visste var jag ändrar säkerheten i xampp när det gäller include ac C:\. Kör senaste versionen av XAMPP. Tack på förhand! |
|||
![]() |
![]() |
![]() |
#2 | |||
|
||||
Mycket flitig postare
|
Xampp kör ju en vanlig apacheserver bör jag tillägga.
hittas på http://www.apachefriends.org/en/xampp.html Hoppas målnet klarnade lite iaf ;-)! |
|||
![]() |
![]() |
![]() |
#3 | ||
|
|||
Nykomling
|
Hallå se7en
Problem här har inte med xampp att göra utan handlar om att backslash \ används i strängar för att utföra så kallade escapes. Om du skriver om includeraden till include("C:\\xampp\\htdocs\\cutenews\\backup\\show _news.php"); så kommer det fungera bättre. Även vanliga slashar kan anges i windows, typ include("C:/xampp/htdocs/cutenews/backup/show_news.php"); Hoppas det löser problemet |
||
![]() |
![]() |
![]() |
#4 | |||
|
||||
Mycket flitig postare
|
Citat:
![]() Såhär ser mitt script ut i index.php ut (det som hämtar nyheterna): Kod:
<?PHP if($_POST['do'] == "search" or $_GET['dosearch'] == "yes"){ $subaction = "search"; $dosearch = "yes"; include("cutenews/search.php"); } elseif($_GET['do'] == "erbjudanden"){ include("cutenews/backup/erbjudanden.php"); } elseif($_GET['do'] == "links"){ include("cutenews/backup/lankar.php"); } elseif($_GET['do'] == "tel"){ include("cutenews/backup/telbok.php"); } elseif($_GET['do'] == "abg"){ include("cutenews/backup/abg.php"); } elseif($_GET['do'] == "manus"){ include("cutenews/backup/manus.php"); } elseif($_GET['do'] == "nyhet"){ include("cutenews/backup/show_news.php"); } elseif($_GET['do'] == "stats"){ echo"You can download the stats addon and include it here to show how many news, comments ... you have"; /* include("$path/stats.php"); */ } else{ include("cutenews/backup/show_news.php"); } ?> Och ser her ser koden ut i show_news.php: Kod:
<?PHP error_reporting (E_ALL ^ E_NOTICE); $cutepath = __FILE__; $cutepath = preg_replace( "'\show_news\.php'", "", $cutepath); $cutepath = preg_replace( "'/show_news\.php'", "", $cutepath); require_once("$cutepath/inc/functions.inc.php"); require_once("$cutepath/data/config.php"); // If we are showing RSS, include some need variables. if($template == 'rss'){ include("$cutepath/data/rss_config.php"); } //---------------------------------- // Check if we are included by PATH //---------------------------------- if($HTTP_SERVER_VARS["HTTP_ACCEPT"] or $HTTP_SERVER_VARS["HTTP_ACCEPT_CHARSET"] or $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"] or $HTTP_SERVER_VARS["HTTP_CONNECTION"]){ /* do nothing */ } elseif(eregi("show_news.php", $PHP_SELF)){ die("<h4>CuteNews has detected that you are including show_news.php using the URL to this file.<br> This is incorrect and you must include it using the PATH to show_news.php</h4><br>Example:<br> this is <font color=red>WRONG</font> : <?PHP include(\"http://yoursite.com/cutenews/show_news.php\"); ?><br> this is <font color=green>CORRECT</font>: <?PHP include(\"cutenews/show_news.php\"); ?><br> <br><BR>// <font size=2>if you think this message shouldn't be shown, open show_news.php and delete it from there</font>"); } //---------------------------------- // End of the check //---------------------------------- if(!isset($subaction) or $subaction == ""){ $subaction = $POST["subaction"]; } if(!isset($template) or $template == "" or strtolower($template) == "default"){ require_once("$cutepath/data/Default.tpl"); } else{ if(file_exists("$cutepath/data/${template}.tpl")){ require("$cutepath/data/${template}.tpl"); } else{ die("Error!<br>the template <b>".htmlspecialchars($template)."</b> does not exists, note that templates are case sensetive and you must write the name exactly as it is"); } } // Prepare requested categories if(eregi("[a-z]", $category)){ die("<b>Error</b>!<br>CuteNews has detected that you use \$category = \"".htmlspecialchars($category)."\"; but you can call the categories only with their <b>ID</b> numbers and not with names<br> example:<br><blockquote><?PHP<br>\$category = \"1\";<br>include(\"path/to/show_news.php\");<br>?></blockquote>"); } $category = preg_replace("/ /", "", $category); $tmp_cats_arr = explode(",", $category); foreach($tmp_cats_arr as $key=>$value){ if($value != ""){ $requested_cats[$value] = TRUE; } } if($archive == ""){ $news_file = "$cutepath/data/news.txt"; $comm_file = "$cutepath/data/comments.txt"; }else{ $news_file = "$cutepath/data/archives/$archive.news.arch"; $comm_file = "$cutepath/data/archives/$archive.comments.arch"; } $allow_add_comment = FALSE; $allow_full_story = FALSE; $allow_active_news = FALSE; $allow_comments = FALSE; //<<<------------ Detarime what user want to do if( $CN_HALT != TRUE and $static != TRUE and ($subaction == "showcomments" or $subaction == "showfull" or $subaction == "addcomment") and ((!isset($category) or $category == "") or ($requested_cats[$ucat] == TRUE ) ) ){ if($subaction == "addcomment"){ $allow_add_comment = TRUE; $allow_comments = TRUE; } if($subaction == "showcomments"){ $allow_comments = TRUE; } if(($subaction == "showcomments" or $allow_comments == TRUE) and $config_show_full_with_comments == "yes"){$allow_full_story = TRUE; } if($subaction == "showfull") $allow_full_story = TRUE; if($subaction == "showfull" and $config_show_comments_with_full == "yes") $allow_comments = TRUE; } else{ if($config_reverse_active == "yes"){ $reverse = TRUE; } $allow_active_news = TRUE; } //----------->>> Detarime what user want to do require("$cutepath/inc/shows.inc.php"); if($_GET['archive'] and $_GET['archive'] != ''){ $archive = $_GET['archive']; } // stupid fix ? unset($static, $template, $requested_cats, $category, $catid, $cat,$reverse, $in_use, $archives_arr, $number, $no_prev, $no_next, $i, $showed, $prev, $used_archives); ?> Hur jag än gör får jag inte med svenska tecken (äöå) med i nyheterna. De skrivs rätt i databasen men hämtas ut som konstiga tecken?? |
|||
![]() |
![]() |
![]() |
#5 | |||
|
||||
Mycket flitig postare
|
Efter många veckor av trixande löste jag problemet genom att spara om php filen från UTF-8 till ANSI. Fungerar klockrent! Lite irriterad är jag men det funkar!
|
|||
![]() |
![]() |
Svara |
|
|