Page 3 of 5

Posted: Sat Feb 19, 2005 2:19 pm
by feyd
whatever I tried passing to set.php, it always attempted to delete the cookie.

Posted: Sat Feb 19, 2005 2:23 pm
by theda
So what should I do?

Posted: Sat Feb 19, 2005 2:28 pm
by feyd
figure out whatever is going on in the script that keeps telling it to delete the cookie.. probably a simple logic error.

Posted: Sat Feb 19, 2005 2:38 pm
by theda
How am I supposed to know what the hell is going on? If I knew all of php, I wouldnt be asking you for help.

Posted: Sat Feb 19, 2005 2:39 pm
by feyd
want to post the entire script, or set of scripts maybe?

Posted: Sat Feb 19, 2005 2:40 pm
by theda
My index.php file is okay as long as the ver.php has $ver assigned to either en or de. If it isn't, then it gives errors.

set.php:

<?
setcookie("language", $ver, time()+604800);
?>

ver.php

<?
$ver = $HTTP_COOKIE_VARS["language"];
?>

Posted: Sat Feb 19, 2005 2:42 pm
by theda
Now as I said in my previous post, if I were to set ver.php to
<? $ver = "en" ?> then my index.php would show my index page. if I set it to $ver = "de" it would show my german page.

On the ver page, the job it has is to open the cookie up and find what it needs to set $ver to so that index.php knows what to load.

On the set page, it has to be able to set the cookie to either en or de, depending on what (set.php?blah=blah2) blah2 equals.

Edit: with the set.php page, I want to be able to put a link to be able to switch between the "en" and "de" side.

Posted: Sat Feb 19, 2005 2:43 pm
by theda
I could even put the ver.php code into index.php itself and get the same outcome.

Posted: Sat Feb 19, 2005 2:50 pm
by feyd
http://dumbass.ionichost.com/set.php?ver=super

Code: Select all

HTTP/1.1 200 OK
Date: Sat, 19 Feb 2005 20:45:56 GMT
Server: Apache/1.3.26 (Unix) PHP/4.0.6
X-Powered-By: PHP/4.0.6
X-Accelerated-By: PHPA/1.3.3r2
Set-Cookie: language=super; expires=Sat, 26-Feb-05 20:45:56 GMT
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

<noscript><script language="JavaScript">win155 = window.open('','cons723'); win155.blur();self.focus();var url = "http://" + self.location.host;var file = "/locmntl/hotfreebies.html";if (win155.document.URL.indexOf(url) == -1)    &#123;                                                                                                          win155.location.href = url + file;       &#125;</script>
at least it sets now, using the correct variable name.

what does index.php's code look like?

Posted: Sat Feb 19, 2005 2:51 pm
by theda

Code: Select all

<?php

include("ver.php");

// Style settings
include($ver."/style.php");

// Page identification
if (isset($id)) &#123;
	$id = $id;
&#125; else &#123;
	$id = $ver."/news";
&#125;

// Page Information Identification
if ($ver =="en" || $id == "news") &#123;
	// readable
	$sec_i = "Read about my eventful life here and make your judgements swiftly.";
&#125; elseif ($ver =="en" || $id == "gallery") &#123;
	// viewable
	$sec_i = "Look through snapshots of my life and criticize them as you feel.";
&#125; elseif ($ver =="en" || $id == "link" || $id == "cont") &#123;
	// valuable
	$sec_i = "If you actually like what is on this site, all the information you need is here.";

&#125; elseif ($ver =="de" || $id == "link" || $id == "cont") &#123;
	// valuable
	$sec_i = "Wenn Sie diese Netplatz magen, dann hier ist, alles das Sie möchten.";
&#125; elseif ($ver =="de" || $id == "news") &#123;
	// readable
	$sec_i = "Lesen Sie über meinem Leben und machen Sie eiligen Urteile.";
&#125; elseif ($ver =="de" || $id == "gallery") &#123;
	// viewable
	$sec_i = "Schauen Sie durch meinen Galerien und bemängeln Sie mir, dass Sie möchten.";
&#125;






// Begin output of page...
include($ver."/content.php");

?>
<noscript>
Edit: Not related to index.php, but if you notice that things go $ver."/page.php"

It stands for (if $ver = en), then it inputs "en/page.php"

Currently, all my files are in three directories. "en/" "de/" and "/" the main files like index.php, ver.php, and set.php are all in the "/" and the website content is in both "en/" and "de/"


feyd | :roll:

Posted: Sat Feb 19, 2005 3:02 pm
by feyd
visiting http://dumbass.ionichost.com/set.php?ver=en
then http://dumbass.ionichost.com/ should display data, however your logic for checking $id is off, as your default will be "en/news" not "news"

Posted: Sat Feb 19, 2005 3:03 pm
by theda
Huh?

Posted: Sat Feb 19, 2005 3:07 pm
by feyd
$sec_i will not be set if $id doesn't match 'news', 'gallery', 'link', or 'cont'. Furthermore, if $id is not passed in the request, your "default" '$id = $ver."/news"' will make it not match any of the $sec_i setting filters as well.

Posted: Sat Feb 19, 2005 3:09 pm
by theda
So what do you suggest?

Posted: Sat Feb 19, 2005 3:14 pm
by feyd
I'd suggest using a nested set of switches

Code: Select all

switch($ver)
&#123;
  case 'de':
    switch($id)
    &#123;
      case 'link':
      case 'cont':
        $sec_i = 'Wenn Sie diese Netplatz magen, dann hier ist, alles das Sie möchten.';
        break;

      case 'news':
      default:
        $sec_i = 'Lesen Sie über meinem Leben und machen Sie eiligen Urteile.';
        break;
    &#125;
    break;

  case 'en':
  default:
    switch($id)
    &#123;
      // etc
    &#125;
    break;
&#125;