Setting and reading a session - session

I have a couple of classic ASP pages that require a user to enter their email and a specified 'keycode' that they have been given in order to gain access to a voucher that they can have emailed to them.
A voucher code is then dynamically generated and (currently) sent in the query string of the url to a second page that would then give the user the option to have the voucher emailed.
I now want to change this so that the voucher code is set as a session, rather than passing it via the url. But i'm having trouble trying to set the session.
I have pasted the code here in a Gist on github: http://gist.github.com/187622
The code errors on Line 47 as follows;
Microsoft VBScript runtime error '800a01a8'
Object required: 'Session'
/bennettsget/default.asp, line 47
I was wondering if anyone would be able to help? Apologies if my explanation or terminology is not correct. Classic ASP is not my language of choice, but it is one of those sites you inherit when starting a new job.
Thank you.

Remove the word "Set". Try
Session("fullcode") = fullcode
Set is usually used in conjunction with a full-blown object. When you're working with a Session, you're really setting a value for a collection rather than the creation of an object.

Related

Oracle Apex using Mailto with Variable page date

I'm trying to use a button which opens an email with pre populated information. But require variables from page elements.
so for example P45_DATE get the update date and P45_DATA gets the data.
I tried different element identifiers like : , & or #. but if used nothing gets return upto the first identifier.
mailto:test#test.com&cc=someoneelse#test.com?Subject=Extension report for &P45_DATE. &body=Please see Extension below. &P45_DATA
Is this even possible
Oracle 11g2
apex 4.2.5.00.08
many thanks
Depends on where you are defining this string and if you want client or session state values.
If as part of JavaScript expression, you might use something like:
'mailto:test#test.com&cc=someoneelse#test.com?Subject=Extension report for '+$v('P45_DATE')+'&body=Please see Extension below. '+$v('P45_DATA')
Bear in mind this isn't escaping the data. Also check to see if any errors are appearing in the JavaScript console.

Customizing Tank_Auth table field names for CodeIgniter

I am a beginner learning codeigniter to build a website. For authentication feature, i use tank_auth library and it works fine if I dont alter the tank_auth table field names.
Then, to combine the tank_auth's 'users' table with my existing 'users_info' table, I modified the field names 'new_email_key' and 'username' as NewEmailKey and UserName respectively.
The above specified field name changes were done in libraries\Tank_auth.php, models\tank_auth\users.php and controllers\auth.php files.
In the database, the submitted data are stored right in the table. But in the activation email received, i am getting the following errors:
Message: Undefined variable: username
Filename: email/activate-html.php
Message: Undefined variable: new_email_key
Filename: email/activate-html.php
Is it safe to use the tank_auth table field names as it is in our CI projects?
Is there any clear documentation written on how to customize and use the tank_auth 'users' table field names?
I am stuck with these error messages as i dont figure out where else the field names need to be altered in tank_auth.
Any help appreciated.
These errors you are listing are simple "undefined variable" errors, like it says, I'm not sure what is confusing here.
Have you looked at the mailing function? Or googled the error meaning? Tank Auth's mail uses an array for sending mail.
$data['username'] = "Bob";
$data['new_email_key'] = "1249ufasiojlk215ifasdy243jhaslkjhasjkghasd";
mail_function_name($data)
that data is passed to the mail function which uses the /email/activate-html.php view/template.
I don't believe there is Tank_Auth modification documentation as the PHP is VERY straight forward, and well commented, if you are having trouble with it, it means you don't understand the code, and the fault lies in your ability to understand WHAT is being done in the code, not in the documentation of TankAuth. Documentation won't really save you here.
Learn what the errors are (ie, undefined variable) and try to fix them one by one.
Since Tank_auth's documentation does not seem to mention config setting for this,
sending such an error message is unexpected and may be taken as a bug.

CakePHP Auth Loads Too Many Session Variables

Using CakePHP2.0 Beta I managed to write a custom login handler for my existing database schema. All's well, except that upon logging in I printed out the session variables stored and what Cake's Auth component did is store the entire record from the "Member" table (where my usernames+hashes come from) in session. It is storing an array with data fields that are totally irrelevant to the session. For instance it stores the date the member was created, their address, etc. All pretty useless information for me as I basically only need their ID and maybe username, name, email address.
The offending lines for me are found in: /lib/Cake/Controller/Component/AuthComponent.php line 512. It states,
$this->Session->write(self::$sessionKey, $user);
So my custom authenticate component returns $user and it throws this whole thing into the session. Now, I don't want to go about editing in the core libraries because this project is definitely going to be upgraded when 2.0 comes out. Is there any way to store less information in sessions? I want to keep this whole thing more lightweight.
Possible solution: Change my custom authentication component to only return the fields I need into the $user variable. Are there any concerns about what data I should/shouldn't be returning?
I've solved the problem using my "possible solution". In /app/Controller/Component/auth/MyController.php, I changed the "ClassRegistry::init($userModel)->find" method to have a parameter for 'fields' where I specify only the fields I need. Works like a charm.

Automating filling Forms

Renting houses can be nasty so I need to automate it. Please, have a look at here. If you make a mistake, all of your changes are gone. I tried to insert the values in the url like:
https://www.hoas.fi/web/hak_inet.nsf/WebHakemus?OpenForm&02.07?PersonFirstName=Alex?PersonLastName=Smith
but it does not work. What is the problem?
Firstly, your query string is incorrect. It should be:
https://www.hoas.fi/web/hak_inet.nsf/WebHakemus?OpenForm&02.07&PersonFirstName=Alex&PersonLastName=Smith
Secondly, in order to pre-populate the page with the results of the query string, the developer of the page would have had to added logic to extract the query string values and pre-populate the page with those values. In this case, it does not appear that they have done that.
You could try saving the page locally as HTML. Then you could modify the HTML to include your default values. You would also need to update any relative paths to point to the server as a full URL. Then you could open the page on your machine and hopefully post to the server. This assumes that they are not injecting any session or other temporary information in the page that they validate.

How do I pass data using sessions in Ruby CGI?

I am working on a guess-a-number game with Ruby that will be online. I know I need to pass the SESSION somehow to keep the number that they are guessing, but I have tried a ton of methods with no luck. My code is here.
Any thoughts on what I can do get this code working? I have declared each of my sections.
A session is, usually, a combination of a cookie (session cookie), or some session id tacked onto the url, which has some unique identification of the current "session" and a way to save the data on the server and retrieve it when given the id from the cookie.
So I would set a cookie based on for example ip + Time.now.to_i and then save that ID and the values I want set into a database or a text file on the hard drive. Note that there is probably a lot better ways to create a unique ID but aim for the simple stuff first. :)
I also recommend that you look into CGI::Session which you require with require 'cgi/session'.

Resources