Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old January 20th, 2007, 10:29 PM
trochia trochia is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 22 trochia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
Send a message via AIM to trochia
Incorrect setcookie link

Timothy ~~

http://codewalkers.com/tutorials/60/4.html

Path opens up incorrectly & local

Jim

Reply With Quote
  #2  
Old January 21st, 2007, 06:23 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Incorrect setcookie link

fixed..thanks.

Reply With Quote
  #3  
Old January 21st, 2007, 06:44 PM
trochia trochia is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 22 trochia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
Send a message via AIM to trochia
RE: Incorrect setcookie link

Matt?.. NO !! <laugh> Thank-you for the wonderful site.

Sorry to bother you, but I'm pretty new at php and I proof read some php for a guy...mainly typos...got it working.. It's creates ( and appends to download_log ) then, somehow ?? I guess it creates a new log file ?? somehow ?? at the end of the month in the flat files?

I was wondering if it really does that, and where I could reference/read up on it in best "laymans" terms plese..

Reply With Quote
  #4  
Old January 22nd, 2007, 12:58 AM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Incorrect setcookie link

Well, if it does that it would have an IF statement in there somewhere that checked to see if it was a new month. It's hard to say exactly what it would look like without seeing the code.

Reply With Quote
  #5  
Old January 22nd, 2007, 01:12 AM
trochia trochia is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 22 trochia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
Send a message via AIM to trochia
RE: Incorrect setcookie link

I thought I just posted it?...I don't see it.

Jim...<sorry, new here>

Reply With Quote
  #6  
Old January 22nd, 2007, 01:13 AM
trochia trochia is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 22 trochia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
Send a message via AIM to trochia
RE: Incorrect setcookie link

php Code:
Original - php Code
  1.  
  2. <?php
  3.  
  4. // localhost/cname/index1.php?action=getfile&file=/cname/bmp+files/piano_left.bmp
  5.  
  6.     // Session
  7.     include("code_session.php");
  8.  
  9.     $s_email = $_COOKIE["s_email"];
  10.     $s_first_name = $_COOKIE["s_first_name"];
  11.     $s_last_name = $_COOKIE["s_last_name"];
  12.     $s_company = $_COOKIE["s_company"];
  13.     $s_title = $_COOKIE["s_title"];
  14.     $s_address1 = $_COOKIE["s_address1"];
  15.     $s_address2 = $_COOKIE["s_address2"];
  16.     $s_city = $_COOKIE["s_city"];
  17.     $s_state = $_COOKIE["s_state"];
  18.     $s_zip = $_COOKIE["s_zip"];
  19.     $s_country = $_COOKIE["s_country"];
  20.  
  21.    $s_action = strtolower($HTTP_GET_VARS["action"]);
  22.     $fileName = $HTTP_GET_VARS["file"];
  23.     $dirName = $HTTP_GET_VARS["dir"];
  24.  
  25.     // if we specified a file name then our action is to retrieve
  26.     if ($HTTP_GET_VARS["file"] != '') {
  27.          $s_action = "getfile";
  28.     };
  29.  
  30.     // the default action is Login
  31.     if ($s_action == "") {$s_action = "logout";};
  32.     if ($s_email == "") { $s_action = "login"; };
  33.  
  34.  
  35.    // Check for a logout command first and bail if we have it.
  36.    switch ($s_action) {
  37.       case "logout":
  38.          header("location:file_login.php?file=$fileName&dir=$dirName");
  39.            session_destroy();
  40.          break;
  41.  
  42.         case "login":
  43.             $s_email = ($HTTP_POST_VARS["u_email"]);
  44.             $s_first_name  = ($HTTP_POST_VARS["u_first_name"]);
  45.             $s_last_name  = ($HTTP_POST_VARS["u_last_name"]);
  46.             $s_title = ($HTTP_POST_VARS["u_title"]);
  47.             $s_company = ($HTTP_POST_VARS["u_company"]);
  48.             $s_address1  = ($HTTP_POST_VARS["u_address1"]);
  49.             $s_address2  = ($HTTP_POST_VARS["u_address2"]);
  50.             $s_city = ($HTTP_POST_VARS["u_city"]);
  51.             $s_state = ($HTTP_POST_VARS["u_state"]);
  52.             $s_zip = ($HTTP_POST_VARS["u_zip"]);
  53.             $s_country = ($HTTP_POST_VARS["u_country"]);
  54.  
  55.             $cookieTime = time() + 60*60*24*120;
  56.             setcookie("s_email", $s_email, $cookieTime);
  57.             setcookie("s_first_name", $s_first_name, $cookieTime);
  58.             setcookie("s_last_name", $s_last_name, $cookieTime);
  59.             setcookie("s_title", $s_title, $cookieTime);
  60.             setcookie("s_company", $s_company, $cookieTime);
  61.             setcookie("s_address1", $s_address1, $cookieTime);
  62.             setcookie("s_address2", $s_address2, $cookieTime);
  63.             setcookie("s_city", $s_city, $cookieTime);
  64.             setcookie("s_state", $s_state, $cookieTime);
  65.             setcookie("s_zip", $s_zip, $cookieTime);
  66.             setcookie("s_country", $s_country, $cookieTime);
  67.  
  68.  
  69.             //  if (strpos($s_email, "@") < 1) {$s_email = "";};
  70.  
  71.             if ($s_email == "") {
  72.            header("location:file_login.php?file=$fileName&dir=$dirName");
  73.         }
  74.             else {
  75.  
  76.                 // determine the log file name (one per month)
  77.                 $logFileName = "download_log.".strftime('%Y-%m');
  78.                 $line = strftime('%c').",".$s_email.",".$fileName.
  79.                         ",".$s_first_name.
  80.                         ",".$s_last_name.
  81.                         ",".$s_title.
  82.                         ",".$s_company.
  83.                         ",".$s_address.
  84.                         ",".$s_address1.
  85.                         ",".$s_address2.
  86.                         ",".$s_city.
  87.                         ",".$s_state.
  88.                         ",".$s_zip.
  89.                         ",".$s_country.
  90.                         "n";
  91.  
  92.                 $handle = fopen($logFileName, "a");
  93.                 fwrite($handle, $line);
  94.                 fclose($handle);
  95.  
  96.                 // write out log entry DATE,EMAIL,FILE
  97.                 //file_put_contents($logFileName, strftime('%c').",".$s_email.",".$fileName."n", FILE_APPEND);
  98.  
  99.  
  100.                 if ($fileName == "") {
  101.                     header("location:TI_install-oview.html");
  102.                 } else {
  103.                     header("location:".$fileName);
  104.                 };
  105.             };
  106.             break;
  107.  
  108.         case "getfile":
  109.             // determine the log file name (one per month)
  110.             $logFileName = "download_log.".strftime('%Y-%m');
  111.             $line = strftime('%c').",".$s_email.",".$fileName.
  112.                     ",".$s_first_name.
  113.                     ",".$s_last_name.
  114.                     ",".$s_title.
  115.                     ",".$s_company.
  116.                     ",".$s_address.
  117.                     ",".$s_address1.
  118.                     ",".$s_address2.
  119.                     ",".$s_city.
  120.                     ",".$s_state.
  121.                     ",".$s_zip.
  122.                     ",".$s_country.
  123.                     "n";
  124.  
  125.             $handle = fopen($logFileName, "a");
  126.             fwrite($handle, $line);
  127.             fclose($handle);
  128.  
  129.             // write out log entry DATE,EMAIL,FILE
  130. //      file_put_contents($logFileName, strftime('%c').",".$s_email.",".$fileName."n", FILE_APPEND);
  131.             if ($fileName == "") {
  132.                 header("location:TI_install-oview.html");
  133.             } else {
  134.                 header("location:".$fileName);
  135.             };
  136.  
  137.             break;
  138.  
  139.         default:
  140.             include("html_header.php");
  141.             echo "bad command: ".$s_action;
  142.             include("html_footer.php");
  143.             break;
  144.  
  145.     };
  146.  
  147. ?>

Reply With Quote