I want to do something that should be simple, it is in php, but i can't seem to find any array functions in asp to do this. I have an array with x number of items (the x may change, could be 10/50/etc.) that will start with 1 and end with x.
For example (excuse my poor syntax):
myArray[0] = 1
myArray[1] = 2
myArray[2] = 3
myArray[3] = 4
etc.
What I want is to call a function and randomize the array as a new array, so for example:
randArray[0] = 3
randArray[1] = 1
randArray[2] = 4
randArray[3] = 2
I was asked to create a test with 50 questions using MS Access (that's all we can afford). All question will load then show in random order (no duplicates, plus a link for the next question) then provide a "Thank you!" page at the end. This is so even when two people take the test they will have all 50 questions but each in a different order. I've found several samples, some would let display the questions but in the same order everytime, while others would randomize them but with duplicates and I would'nt know when I got to the end because it would keep randomizing all day long.
how can i randomize pages ? Eg. when a user login and he click on a link, he will come to a start page(start.asp) and when he click on the button continue (take_test.asp), he will get the randomized page (question_1.asp or question_4.asp...question_3.asp etc)
sql = "SELECT * FROM kbs WHERE kbs.id = " & rdm & " AND kbs.subject NOT IN (20,21)" set rs=conn.execute(sql) %>
It's selecting a range of product IDs and it's s'posed to exclude all IDs whose subject is either subjectID 20 or 21. It works fine except when it comes to items with those subjects and then it displays this error message:
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
I am designing Admin pages for my web site.I am using HTML frames, VBscript, Javascript, ASP , Microsoft Access as database etc.
I want when any Administrator put focus on any perticular frame and press some shortcut keys (like CTRL+A) then in the same frame one link called 'Admin' should be visible and active which then drive Administrator in Admin area to make necessary changes.For the rest user this Admin section would not be visible at all.
I would like to implement user authentication and session management for my applications. I've been using solution 1 (below) for most of my applications in the past since the target audience is mostly intranet based.
Now that I'm creating a more global application, I want to use a method that does not require cookies, yet maintain a farily high level of security and fault tolerance.
Is there a better way to handle this problem? What method does the big Internet shopping companies use?
Scenario:
A user is authenticated and is given a session key. The session key is passed to the user in an HTML page and returned to the server using a query string. The user then copies the URL and gives it to his friend to see. Since the URL now contains the session key, how does the server distinguish between the authenticated user and his friend?
Solution 1:
Use an ASP session variable to store the session key between page requests. This solution requires that the client have session cookies enabled. If the session is not encrypted (i.e. SSL), the ASP session id is still passed via. clear text, and is vulnerable.
Solution 2:
Use a session key that identifies the location (IP address) of the user. If the submitted session key doesn't match the user's location, then the session key is invalid. The session key can be passed as part of the URL and does not require cookies. This method is vulnerable to IP spoofing, and breaks if the user is behind a NAT server, or web caching server that masks the true IP address.
Solution 3:
Have the session key returned to the server via an HTTP POST request. This method does not require cookies, but is clear text and vulnerable if the session is not encrypted. The session key is lost if the user navigates to a page manually issuing an HTTP GET request.
Is it possible to get a key from the registry if a remote machine?We have three print servers (tin) serving an ERP application for different areas of the business.Currently someone has to logon and check to see if the servers are still running each morning.
However while they are running they increment a key in the registry once every second each time they poll. If I can get ASP to read this value, I should be able to setup a webpage to monitor the situation.I've found RegObj.dll on the Microsoft site, but this doesn't seem to work in ASP.
creating a script that will create a primary key base on the date today and a number ( ex. 1124204-1, 112404-2) with the last number increasing by one. the script should automatically increase the number if the key has already been used.
I'm trying to insert into a table with foreign keys. The statement works in query analyzer but not when I do it in asp to insert the data from a form. Code:
I'm using cookies to maintain a shopping cart. I can find plenty of tutorials and articles on deleting a cookie, but only deleteing a single key within a cookie is harder to find...
Surely there is a more efficient way to remove a cart item from my cookie than setting it equal to "", isn't there?
I mean, technically the cookie will still hold the text cartitem1 = "", right? Which takes up unnecessary space...
I have disabled the function keys (F1-F12). I would like each funtion key to submit a form. I'm not quite sure how to tell each function key to submit (post) for me.
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Sybase][ODBC Driver]Integrity constraint violation: no primary key value for foreign key 'MemberCode' in table 'PersonMember' /admin/Member_New-Sybase.asp, line 39
What i am doing is first i have added a record to my persons table the next step is i need to add this person id to the PersonMember table with a new MemberCode and then finally add more information to a membership table. Code:
This query sort on the basis of Lft and Rgt columns.
The name of the array is: aEmp.
My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.
Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.
In working with arrays, I have found that I am unable to dimension and array with a variable that has an integer value but I can redimension one this way. I haven't see any information that tells me if this is a requirement, although it appears to be because I get an error if I try it.
Ex.
Dim b b = 10 Dim a(b) ' this errors out but Dim a() ' this Redim a(b) ' works
I want to create a new array called arrNames2 and copy contents of arrNames to arrNames2.
I then want to loop through my db and add more names (while going through the loop) to arrNames2. What is the best way to do this? Do I have to keep redim the array wehn I add more names?
I have a page in my admin system where the user can edit products they have added. The problem I am having is with Related Products. These are all listed in a multiple list. What I need to do is have those selected when the product was added, already be highlighted in the multiple list on the product edit page. Here is my post from another forum.
For some reason, when I try to run the following array, I'm getting an error:
dim cat(0)
cat(0)="0407" cat(1)="0102"
'I will be adding more to this array, but just trying with two for starts.
for counter = 0 to 1
itno=cat(counter)
'I get an error when it runs through this function
Function rightvar(theVar,lengthNeeded) Dim sResult sResult=theVar if Len(theVar)< lengthNeeded then sResult= String(lengthNeeded - Len(theVar)," ")& theVar rightvar=sResult End Function
The problem is that in my 5 years of programming in various languages i have never really understood arrays (DUMB @$${lol}) What i want to do is offer an advanced search of a database table on my website. I currently offer the functionality so that the whole of the database can be viewed within the web page so that it doesn't need to be downloaded/need access to view it. What i need to do is run a script that takes all of the column headings that i have and put them into an array. Then with the array i need to output each element into a drop down box.
Ok what I have is a little script which runs through my stock compares how many of one item we have compared to what we need and displays the out come.
What id like to do is make an array with the item name so lets say If how many is needed is greater then 0 then add the name of that consumable to an array and move on until the end.
Then I want to use the arry to display each consumable on an order form. Anyone have any idea how to do this in ASP or can give me any advice on a better way to do it?