Print Page | Close Window

get AthutorID?

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=26944
Printed Date: 29 March 2026 at 12:35am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: get AthutorID?
Posted By: jarv
Subject: get AthutorID?
Date Posted: 05 February 2009 at 4:12pm
can some one please tell me how to get the AuthorID so i can use it in a different table in database?!



Replies:
Posted By: 123Simples
Date Posted: 05 February 2009 at 4:43pm
How do you mean "get the AuthorID" ?
If you could explain how you are thinking you want to implement it, then maybe someone can come up with an answer for you

It won't be me LOL Wink


-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: jarv
Date Posted: 05 February 2009 at 4:55pm
right, I am using the Webwizforum and I have added a table called tblFiles, I have a new file upload page which when you up load a file to a folder on my server the information goes into the database, I would like to use information from the forum...

For instance, you login to the forum, go to my new file upload page and when you up load a file it says the user who uploaded the file?!


Posted By: 123Simples
Date Posted: 05 February 2009 at 5:40pm
If you PM me Jarv with your forum address I can take a peek if you want, or better still, post it here, so others might be able to help too

-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: jarv
Date Posted: 06 February 2009 at 9:28am
Here is my page: http://www.animalwelfareplatform.eu/uploadTester.asp" rel="no follow - http://www.animalwelfareplatform.eu/uploadTester.asp
Here is my fileupload script  code:
[code]
<%@ Language=VBScript %>
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<!-- #include file="freeaspupload.asp" -->
<!-- #include file="common.asp" -->

<%


' ****************************************************
' Change the value of the variable below to the pathname
' of a directory with write permissions, for example "C:\Inetpub\wwwroot"
  Dim uploadsDirVar
  uploadsDirVar = "D:\home\Default\animalwelfareplatform.eu\htdocs\documents"
' ****************************************************

' Note: this file uploadTester.asp is just an example to demonstrate
' the capabilities of the freeASPUpload.asp class. There are no plans
' to add any new features to uploadTester.asp itself. Feel free to add
' your own code. If you are building a content management system, you
' may also want to consider this script: http://www.webfilebrowser.com/

function OutputForm()
%>
    <form name="frmSend" method="POST" enctype="multipart/form-data" action="uploadTester.asp" onSubmit="return onSubmitForm();">
    <B>File names:</B><br>
    File 1: <input name="FileName" type="file" size=35><br>
    <br>
    <!-- These input elements are obviously optional and just included here for demonstration purposes -->
    <B>Additional fields (demo):</B><br>
    <input type="hidden" name="DateUploaded" value="<%=Now()%>"><br>
   
    Drop-down list (with multiple selection): <br>      
    <select name="list_values" class="TextBox" MULTIPLE>
        <option value='frist' > First</option>
        <option value='second' > Second</option>
        <option value='third' > Third</option>
    </select><br>
    <textarea rows="2" cols="20" name="t_area">Test text area</textarea><br>
    <!-- End of additional elements -->
    <input style="margin-top:4" type=submit value="Upload">
    </form>
<%
end function

function TestEnvironment()
    Dim fso, fileName, testFile, streamTest
    TestEnvironment = ""
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    if not fso.FolderExists(uploadsDirVar) then
        TestEnvironment = "<B>Folder " & uploadsDirVar & " does not exist.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
        exit function
    end if
    fileName = uploadsDirVar & "\test.txt"
    on error resume next
    Set testFile = fso.CreateTextFile(fileName, true)
    If Err.Number<>0 then
        TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have write permissions.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
        exit function
    end if
    Err.Clear
    testFile.Close
    fso.DeleteFile(fileName)
    If Err.Number<>0 then
        TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have delete permissions</B>, although it does have write permissions.<br>Change the permissions for IUSR_<I>computername</I> on this folder."
        exit function
    end if
    Err.Clear
    Set streamTest = Server.CreateObject("ADODB.Stream")
    If Err.Number<>0 then
        TestEnvironment = "<B>The ADODB object <I>Stream</I> is not available in your server.</B><br>Check the Requirements page for information about upgrading your ADODB libraries."
        exit function
    end if
    Set streamTest = Nothing
end function

function SaveFiles
    Dim Upload, FileName, fileSize, ks, i, fileKey

    Set Upload = New FreeASPUpload
    Upload.Save(uploadsDirVar)

    ' If something fails inside the script, but the exception is handled
    If Err.Number<>0 then Exit function

    SaveFiles = ""
    ks = Upload.UploadedFiles.keys
    if (UBound(ks) <> -1) then
        SaveFiles = "<B>Files uploaded:</B> "
        for each fileKey in Upload.UploadedFiles.keys
            SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
            strSQL = "INSERT INTO tblFiles (FileName,FileSize,UploadedBy,Filepath) " & _
"Values ('"& Upload.UploadedFiles(fileKey).FileName & "'," & Upload.UploadedFiles(fileKey).Length & "," & _
"12,'"& Upload.UploadedFiles(fileKey).FileName & "')"

adoCon.Execute(strSQL)
        next
    else
        SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
    end if
    SaveFiles = SaveFiles & "<br>Enter a number = " & Upload.Form("DateUploaded") & "<br>"
    SaveFiles = SaveFiles & "Checkbox values = " & Upload.Form("checkbox_values") & "<br>"
    SaveFiles = SaveFiles & "List values = " & Upload.Form("list_values") & "<br>"
    SaveFiles = SaveFiles & "Text area = " & Upload.Form("t_area") & "<br>"


'rsCommon.Execute strSQL, adoCon


end function
%>

<HTML>
<HEAD>
<TITLE>Test Free ASP Upload</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
BODY {background-color: white;font-family:arial; font-size:12}
</style>
<script>
function onSubmitForm() {
    var formDOMObj = document.frmSend;
    if (formDOMObj.FileName.value == "" && formDOMObj.attach2.value == "" && formDOMObj.attach3.value == "" && formDOMObj.attach4.value == "" )
        alert("Please press the Browse button and pick a file.")
 


Posted By: 123Simples
Date Posted: 06 February 2009 at 12:29pm
Well the upload bit works Wink



But I would advise caution as to its deployment as the site suggests:
"Considerations about deployment

If you are adding an upload capability to your site (using this script or any other), you should consider who will have access to it, what files can be uploaded, and whether and how uploaded files are published on the site.

For example: it's a really bad idea if any visitor has access to the upload function and the files uploaded are automatically published on the site. If that is possible, then malicious visitors will quickly abuse your upload. More specifically, suppose you let anyone upload images to your web site directly, then your web site will soon be showing the wrong kind of images. Similarly, if you let users upload HTML pages to your site directly, then spammers will upload pages with links to their commercial sites.

There are three levels of prevention to avoid exploitation of your site's upload feature:

The most obvious and effective way of avoiding the upload of spamming content is to not publish automatically the uploaded files. If you review each uploaded file before publishing it, or if you don't publish uploaded files at all (very common) the spammers will not even be interest in your site. The FreeASPUpload script let's you select a folder on the web server where to save the uploaded files. It is recommended to pick an internal folder (a folder that is not part of the published folders).

If you really must allow anonymous upload of HTML pages and automatically publish them, then at least use robots.txt to block search engine spiders from that published directory.

Another easy way to protect your site is to restrict access to the uploaded page. For example: if you have a personal site, and you are the only one supposed to use the upload feature, create a special page just for the upload, do not link to it from any other page, and don't share the URL with others. Alternatively you can simply protect that page with a password. If your site is the kind that asks for authentication from the users (username and password), that may also help keep the casual spammers out.

Finally you can also to limit the kinds of files a user can upload. The types of file spammers will want to upload are .html, .htm, etc. Restricting the kinds of files are allowed to be uploaded requires some additonal ASP code, os it is not as easy as the first two strategies."

It would take a bit of tweaking but the idea situation would be for logged in users only to be able this page, and then add in some lines of asp that grab their usernames too


-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: jarv
Date Posted: 06 February 2009 at 1:31pm
done now thanks!


Posted By: jarv
Date Posted: 06 February 2009 at 1:33pm
now I have to get the data out and display it!


Posted By: jarv
Date Posted: 09 February 2009 at 10:15am
can anyone help?


Posted By: Scotty32
Date Posted: 09 February 2009 at 6:59pm
What is it you are trying to do?


-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net