Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - get AthutorID?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

get AthutorID?

 Post Reply Post Reply Page  12>
Author
jarv View Drop Down
Groupie
Groupie


Joined: 15 December 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote jarv Quote  Post ReplyReply Direct Link To This Post Topic: get AthutorID?
    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?!
Back to Top
123Simples View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
Post Options Post Options   Thanks (0) Thanks(0)   Quote 123Simples Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jarv View Drop Down
Groupie
Groupie


Joined: 15 December 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote jarv Quote  Post ReplyReply Direct Link To This Post 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?!
Back to Top
123Simples View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
Post Options Post Options   Thanks (0) Thanks(0)   Quote 123Simples Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jarv View Drop Down
Groupie
Groupie


Joined: 15 December 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote jarv Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2009 at 9:28am
Here is my page: 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.")
 
Back to Top
123Simples View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
Post Options Post Options   Thanks (0) Thanks(0)   Quote 123Simples Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jarv View Drop Down
Groupie
Groupie


Joined: 15 December 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote jarv Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2009 at 1:31pm
done now thanks!
Back to Top
jarv View Drop Down
Groupie
Groupie


Joined: 15 December 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote jarv Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2009 at 1:33pm
now I have to get the data out and display it!
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.