Jump to content
#StayAtHome ×


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About larry29936

  1. Does this look right? <?php session_start() function getUserIpAddr(){ if(!empty($_SERVER['HTTP_CLIENT_IP'])){ //ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ //ip pass from proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; }else{ $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } $session = array[ses] $ses[] = $session_id; $ses[] = $ip; INSERT INTO LOGIN (session_id, when_login, ip_address) VALUES ($ses[0], now(), ses[1] ); ?> <!DOCTYPE html>
  2. What data type should I use for ip_address? I guess I should convert to a string and store as a varchar.
  3. Thank you VERY much. 20 years ago, I was writing front-ends for industrial databases. Now you've triggered memories of how to build sql queries, joins, foreign-keys, etc. You also provided the knowledge of how to use the data on the website. Time for a little study before proceeding. Thanks again, Larry BTW-How do I mark this as solved?
  4. This is my first stint as a "webmaster" and in many ways, ignorant. I'm learning as I go. So, I should go to my web host and set-up a mysql db for two single field tables, one for website hits and one for downloads? EDIT: If I capture the url for both, I can join the tables and know who visited AND downloaded. (It's been 20 years since I worked with any databases)
  5. The only thing I need to store is a number. Couldn't that be stored in a text file? When the download button is clicked, read the value in the text file, increment +1, and write it back to the text file? A read of the text file and display in text box.
  6. I have a download section in my index.php that I'd like to add a download counter to but have no idea how to accomplish this. The existing code works perfectly but I'd like to know how many times the file is downloaded. Would prefer not to use a database. <!-- DOWNLOAD --> <div id="download" class="stylized"> <div "myform"> <div class="container"> <div class="row"> <div class="download"> <br /><br> <h1><center>FoxClone Download Page</center></h1> <?php $files = glob('download/*.iso'); $file = $files[count($files) -1]; $info = pathinfo($file); $filename = basename($file); $filename = ltrim($filename,'/'); $md5file = md5_file($file); ?> <div class="container"> <div class="divL"> <h3>Get the "<?php echo "{$filename}";?>" file (approx. 600MB)</h3> <center> <a href="<?php echo "/{$file}";?>"><img src="images/button_get-the-app.png" alt=""></a> </center><br /> <h3 style="margin-bottom: 0.5rem;">The MD5sum for "<?php echo "{$filename}";?>" is "<?php echo "{$md5file}";?> Thanks in advance, Larry
  7. Since I installed apache2, php, and phpmyadmin on my linux machine when I click on a .php file it downloads instead of opening in a web browser. It didn't do this prior to the install, so I suspect it's a config error. Can someone help me on this? Thanks in advance, Larry
  8. Problem resolved. <?php $files = array(); $files = glob('download/*.iso'); $file = $files[count($files) - 1]; $info = pathinfo($file); $filename = basename($file); $filename = ltrim($filename,'/'); ?>
  9. @requinix - I do want the file extension and I should be getting it with the code that I have. I just don't want the leading "/".
  10. I tried the following: <?php $files = array(); $files = glob('download/*.iso'); $file = $files[count($files) - 1]; $info = pathinfo($file); $filename = basename($file,'.'.$info['extension']); ?> It is giving me "Get Foxclone "/foxclone30-1"". How do I get rid of the leading "/"?
  11. I have the following code in my index.php: <?php $files = array(); $files = glob('download/*.iso'); $file = $files[count($files) - 1]; $strlen ( string $file ) : int /* length of $file */ $filelen = $strlen -9 /* length of unwanted characters - "download/" */ $filename = /* how do I get the filename starting at the 10th position */ ?> <div class="container"> <div class="divL"> <h3>Get the latest version of FoxClone iso</h3> <a href="<?php echo "/{$file}";?>"><img src="images/button_get-the-app.png" alt="" width="200" height="60"></a> I'd like to replace "Get the latest version of FoxClone iso" in the next to last line with "Get Foxclone "<?php echo "/{$filename}";?>". How do I extract just the file name from $file? I know that I have to: 1. get the length of $file 2. subtract the number of unwanted character to determine the start character (In this case, start at 10th character) 3. and extract everything from the 10th character to length of $file. Step 3 is where I just don't know how to accomplish the task. I'd appreciate some help on this. Thanks in advance, Larry
  • 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.