Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 23rd, 2004, 03:11 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default Asp (master-)detail's page future's records viewin

I have a site, constructed with dreamweaver, that contains a master-detail page set.
I have make some changes to the code (although I 'm not a programmer, I am beginner), so that I can insert records that will

be displayed when the date of the record is equal to the current date(server's date).

The detail page is something like http://localhost/1.asp?id=495

My problem: I discovered that anyone that hits to the browser any other id number by hand(example

http://localhost/1.asp?id=496), can view the records I wanted to be displayed when the appropriate date come!

So, I have not any way to protect my records from these people?

What can I do, so that nobody can see the future's records above the current date?


Please give me some guidelines, I can provide you the code if you want.


Reply With Quote
  #2 (permalink)  
Old March 23rd, 2004, 03:32 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi karib,

I assume you have the date stored in the database somewhere as well? e.g. a column like DoNotShowBefore or something like that?

If that is the case, you can add a WHERE clause to your select statement that restricts the records returned from the database to those with that date less than or equal to today. e.g.:

SELECT Column1, Colund2 FROM MyTable WHERE DoNotShowBefore <= Date()

How exactly you implement this depends on your database. You can construct the entire query in ASP and then send it to the database.
Alternatively, you can let the database figure out what day it is today. In that case, you can use Date() for an Access database, but you'll need GetDate() for a SQL Server database.

Does this help?

<Plug type="Shameless">
  If you want to be a programmer, and no longer a beginner anymore, I suggest you check out Beginning Dreamweaver MX 2004. It deals with stuff like this in great detail, with loads of examples and explanations.
</Plug>

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old March 23rd, 2004, 03:51 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your response.

I think it was my fault, I did not made clear the situation.

The master page already has a 'where' statement, and displays only the records with date=< current date.

My problem is at the detail page.

Suppose someone hit in the browser, just because he wants to cheat me, write another id in address bar, replacing the one the browser currently displays.

Thenhe has discover a brand new page which should be online in the future.

That's my problem.

It would be nice if I could hide the real address from browser address bar.

Or if I could somehow change it in order not to reveal the real address and this could make it more difficult for someone to reveal future's pages.

I know the use of frames hides such information(exact address) but as far as I know this solution has many disadvantages.

What do you think about this problem?

Thanks in advnace

Reply With Quote
  #4 (permalink)  
Old March 23rd, 2004, 04:48 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any suggestions?

Reply With Quote
  #5 (permalink)  
Old March 23rd, 2004, 07:18 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do you have any suggestions?

Reply With Quote
  #6 (permalink)  
Old March 23rd, 2004, 10:42 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yeah, I hear you. I just wasn't here to respond right away.

Maybe you misunderstood what I was saying in my first post. I proposed to add the WHERE clause to the Detail page as well.
That way, you can never request a future article, simply because the Details page doesn't allow it.

That way, you can have your Master page and Details in sync: only what is visible on the Master page can be requested on the Details page.

Does that make sense?

Hiding the address from the address bar is pretty useless. A determined cheater will easily find out how to cheat anyway.....

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #7 (permalink)  
Old March 23rd, 2004, 12:26 PM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your response.




This is the code we have to take a look to, from master page:


                  <%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_dytika29_STRING
Recordset1.Source = "SELECT * FROM 29articles WHERE datew<=now() ORDER BY datew DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>






Now this is what the detail page has untill now:

<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("Id") <> "") Then
  Recordset1__MMColParam = Request.QueryString("Id")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_dytika29_STRING
Recordset1.Source = "SELECT * FROM 29articles WHERE Id = " + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>


Can you please tell me the new code of detail page?

Thanks in advance

Reply With Quote
  #8 (permalink)  
Old March 23rd, 2004, 12:35 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

It'll be pretty much the same as in the Master page:

Recordset1.Source = "SELECT * FROM 29articles WHERE Id = " +
Replace(Recordset1__MMColParam, "'", "''") + " AND datew <= Now()"


Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #9 (permalink)  
Old March 23rd, 2004, 12:45 PM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your response


I added to the detail page the code you told me above.

Here is what the detail page now gives:


Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-3.23.56-nt]You have an error in your SQL syntax near 'datew <= Now()' at line 1
/main/29includes/from1.asp, line 18

where line 18 is the following:

Recordset1.Open()


What is wrong?


Thanks in advance

Reply With Quote
  #10 (permalink)  
Old March 23rd, 2004, 01:02 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Are you using MySQL?

You should use the exact same code as you did on the Master page. If it works there, it should work here too. Just make sure it;s all on one line.

Otherwise, post the line of code you use for the Source property...

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Wizard on Master Page AspNetGuy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 June 5th, 2008 09:19 AM
Using Master Page in ASp.net 2.0 dilipv .NET Framework 2.0 1 March 4th, 2008 07:00 AM
VS2008 Master page error in <asp:contentPlaceHolde JesseTutterrow ASP.NET 2.0 Basics 1 December 10th, 2007 12:17 PM
ASP.NET and Master Page ayazhoda ASP.NET 2.0 Basics 5 May 14th, 2007 04:22 PM
JScripts on ASP.NET Master page? woojtii Javascript How-To 0 March 28th, 2007 05:54 AM



All times are GMT -4. The time now is 11:24 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.