Jump to content

dman

Member
  • Posts

    708
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Everything posted by dman

  1. At the risk of getting trashed again (WTFC?) I am sticking my face back in this thread. I AM a programmer. Don’t know how my skills stack up against others on this board (I am mediocre at best in C++), but I am at least adequate enough for most tasks. I certainly can tell if code is real or not by watching it run. I have also stated that I would not endorse any code’s functionality without actually trying it, but the suggestion that what he shows is faked in patently untrue. I saw the live demo, even asked him to move a particular file (it was calc) and try to execute it. IE did indeed block its execution and remove it from the system, I saw it in real time. There was no way for him to anticipate what file I was going to ask him to use, so if it is a hoax, the hoax is more impressive than the actual code. Rhythm has apologized for his initial approach so why not cut him a little slack. This board is for exchange of ideas as well as code. Like I said before, watching the demo will maybe not convince you that IE will replace antivirus, but will convince you it is not a hoax done with paint or VB. It is very sophisticated, watching it run makes that readily apparent.
  2. You shouldn't have to configure anything (assuming PHP is working) except change XXX to correct values and name the file "something.php" seems like it is not processing the PHP and just returning text. I just tried copying from forum and pasting into new file and it is working OK.
  3. Here is PHP Manual. Else just google the function, you will turn up lots of hits. Did you get it to work?
  4. This should get you started... <head> <title>Freedll.xyz</title> </head> <body> <h1>Freedll.xyz</h1> <?php // Connecting, selecting database $link = mysql_connect('XXX', 'XXX', 'XXX') or die('Could not connect: ' . mysql_error()); mysql_select_db('XXXX') or die('Could not select database'); // Performing SQL query $query = 'SELECT file, version, size FROM dlls order by file'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $num=mysql_numrows($result); // Printing results in HTML $i=0; echo "<table border=\"1\"><tbody>\n"; echo "<tr><th>File</th><th>Version</th><th>Size in kb</th></tr>\n"; while ($i < $num) { $file=htmlspecialchars(mysql_result($result,$i,"file")); $version=trim(mysql_result($result,$i,"version")); $size=trim(mysql_result($result,$i,"size")); echo "\t<tr>\n"; echo "\t\t<td>$file</td>\n"; echo "\t\t<td>$version</td>\n"; echo "\t\t<td>$size</td>\n"; echo "\t</tr>\n"; $i++; } echo "</tbody></table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> </body> </html> look at the code and read the docs about the various functions, soon you will see how to extend it. EDIT: don't know why the code always loses it's indents when I paste into forum code tag?
  5. Just one quick note... You do not want to put any of this code on your live server until it is hardened up. Functionality first, then we harden it up, both the database and the PHP. Yes, believe it or not there are evil people out there that would love nothing better than to submit a SQL Injection attack and erase your database just for laughs, so test on local machine until it's done! If you do put it live make sure to back up often.
  6. Start Small... Evolve. It all becomes very simple, you just need to reach critical mass and it will all make sense. Now look at the count.php page. Your list code will be very similar to this... open db, get recordset, loop through records creating a table row once per loop. that is basics, then we add the links for each letter, finally the paging code to show limited number of records per page...
  7. what are you using to administer your db? I am using phpmyadmin. Just open the file and select all/copy and paste into sql window and run, same way as you are creating the tables. or use "browse" button and select the file and run.
  8. Here is link to sql insert file. This is Foxpro code I used to convert, just in case you are interested... fh = Fopen("c:\list.txt") strout = "" Do While !FEOF(fh) strtmp = "INSERT INTO dlls (file, size, version) VALUES ('" strtmp = strtmp + Fgets(fh) + "', '" strtmp = strtmp + Fgets(fh) + "', '" strtmp = strtmp + Fgets(fh) + "');" + Chr(13) + CHR(10) strout = strout + strtmp Enddo Fclose(fh) Strtofile(ALLTRIM(strout),"c:\dllinsert.sql")
  9. not sure why thats not working. might have something to do with the quotes. try this (I tested this time). we are adding a primary key field, dont ask why yet, but we will use it to relate our different tables to one another. CREATE TABLE `dlls` ( `pk` INT( 5 ) NOT NULL AUTO_INCREMENT , `file` VARCHAR( 134 ) NOT NULL , `version` VARCHAR( 138 ) NOT NULL , `size` INT( 11 ) NOT NULL , PRIMARY KEY ( `pk` ) )
  10. your list doesn't have version or size. need them too.
  11. You have to buy VFP. It is great language, but MS is trying to kill it in favor of .NET. They are letting it die slowly by not porting it to 64 bit, but it is still very useful. If you already have the list in that format that is fine, I can read it.
  12. The comma seperated values (name, version, size) would be easiest, but the sequential row listing would work also. (I use visual foxpro for this kind of thing, it has super file and string handling functions) Think maybe we should change "size" to numeric field so you can use it in stats for total bytes downloaded. The usual rule is to make numbers that will never need math done on them as varchar fields, like the version. Even though it is a number there is no math you can do on it. The size we can use to tally stats, so that can be numeric. CREATE TABLE 'dlls' ( 'file' VARCHAR( 134 ) NOT NULL , 'version' VARCHAR( 138 ) NOT NULL , 'size' INT( 11 ) NOT NULL ); this will create numeric field of type "Integer" (whole numbers) run "drop table 'dlls'; if you already created it, this will delete current structure
  13. a table is a database entity that is a group of related data items, like the file info all relates to the file. A database can have many tables, like yours will now have one for files to download, and one for download stats. Think of an HTML table with columns and rows... the columns are the data items you want to track, one row in the table for each record. hope this is clear, you could try reading mysql docs. a table column can have different data types. varchar is for strings, that is most common. could also be number, logical, date, etc. Yes, the number is the max amount of characters that column will hold. my numbers were just guesses, make it appropriate for your data. the list can be any text format, i will write util to read it. do you have a list, or still need to make one?
  14. Add this table to your database CREATE TABLE 'dlls' ( 'file' VARCHAR( 128 ) NOT NULL , 'size' VARCHAR( 20 ) , 'version' VARCHAR( 20 ) ); If you want to make the size and version mandatory add NOT NULL If you have a list of your files attach it and I will write a little util to convert it into SQL INSERT statements to load up the database.
  15. just something to call the list of files as opposed to the sum total. Call it anything you want. get some sleep
  16. Yes, you are better spending time up front with db rather than waste hours editing html pages. Here is update for the stats to give you a little more example on things you can do. This includes total downloads and sorts by most downloads. <head> <title>File Download Statistics</title> </head> <body> <?php // Connecting, selecting database $link = mysql_connect('localhost', 'root', '') or die('Could not connect: ' . mysql_error()); mysql_select_db('dbname') or die('Could not select database'); // Performing SQL query for total downloads $query = 'SELECT sum(count) as dlcount FROM dl_count'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); echo "<b>Total Downloads " . mysql_result($result,0,"dlcount") . "</b>\n"; // Free resultset mysql_free_result($result); // Performing SQL query for individual downloads $query = 'SELECT file, count FROM dl_count order by count desc'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $num=mysql_numrows($result); // Printing results in HTML $i=0; echo "<table><tbody>\n"; echo "<tr><th>Individual Downloads</th></tr>\n"; while ($i < $num) { $fname=htmlspecialchars(mysql_result($result,$i,"file")); $fcount=trim(mysql_result($result,$i,"count")); echo "\t<tr>\n"; echo "\t\t<td>$fname</td>\n"; echo "\t\t<td>$fcount</td>\n"; echo "\t</tr>\n"; $i++; } echo "</tbody></table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> </body> </html> Next question, one step at a time. First decide what info about the files you would like to present or track, eg. name, category, size, publisher, etc. Then we can make the database to reflect this data. That needs to be done before you can move on to the PHP.
  17. Yes, that's exactly what I mean. This is how the freeware page on my site operates as well. I didn't get real fancy yet but notice that I have broken the programs into groups... that is one of many ways to slice the data. I am going to add a search and filter as well.You are right, it saves a ton of edit time because you only need to change the code in one place inside the loop instead of editing each row by hand if you want to change or add something like the color or mouseover code. The php code for the count page is a pretty generic skeleton for creating this type of page, just need to expand your database and SQL selects, and give it a form to submit parameters to the code. I will try to help as I work on my site. It is good that we are both working on similar project at the same time. Your questions are helping to provoke many of my own.
  18. What do you mean by "more advanced'. What info do you want to show. You are only tracking the file name and number of downloads, but this could be modified to include date, time, requestors IP, browser type... all kinds of things. What data do you want to track is the question? You could also add filter to show only certain files or above certain level of downloads, or sort by the various fields of the db... you tell me. You might also want to consider putting your list of files in a db and creating your page of downloads on the fly with PHP in the same way as the stats.
  19. Your "download.php" script is working ok? and you are using the same user, pwd and db name in your count.php script?
  20. save as .php (like "showstats.php" or something) what part is not working?
  21. server will be "localhost" unless you are making a direct connection (you're not). username and password are whatever you set up. There will always be a username "root" databasename is whatever you called the database that you created the dl_count table in. $link = mysql_connect(*server*, *username*, *password*) or die('Could not connect: ' . mysql_error()); mysql_select_db(*databasename*) or die('Could not select database');
  22. Of course you don't know anyone that speaks like that. I will rephrase "Ugh... Grunt MMMM" Better? Try this for stats (change server, user, password & db name to suit) Pretty it up as you would like. <head> <title>File Download Statistics</title> </head> <body> <?php // Connecting, selecting database $link = mysql_connect('localhost', 'root', '') or die('Could not connect: ' . mysql_error()); mysql_select_db('dlstats') or die('Could not select database'); // Performing SQL query $query = 'SELECT file, count FROM dl_count order by file'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $num=mysql_numrows($result); // Printing results in HTML $i=0; echo "<table><tbody>\n"; echo "<tr><th>Download Count</th></tr>\n"; while ($i < $num) { $fname=htmlspecialchars(mysql_result($result,$i,"file")); $fcount=trim(mysql_result($result,$i,"count")); echo "\t<tr>\n"; echo "\t\t<td>$fname</td>\n"; echo "\t\t<td>$fcount</td>\n"; echo "\t</tr>\n"; $i++; } echo "</tbody></table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> </body> </html>
  23. jolly good show! It doesn't matter where you add the path, as long as it's correct when the script tries to use it. Really don't know about that book, sounds ok. I think you might be better off not using dreamweaver at first and just code in a PHP editor. This will give you better feel for the code IMHO. The PHP manual docs are really quite good, maybe look at them and search for tutes before buying anything, there is lots of free info out there. As for stats, you need some SQL code. What info do you want to present, a list of downloaded files with count? I will put together an example.
  24. sorry, you need to still add the backslashes and the rest of your path to the string. Somrething like $FILES_DIR = "/dll/" . $_GET['filedir'] . "/";
  25. Hi B.C. Instead of hard-coding the $FILES_DIR variable, pass it as another get parameter, like this.. href='download.php?file=A3D.RAR&filedir=A' in the download script, set it like this... $FILES_DIR = $_GET['filedir'];
×
×
  • Create New...