Solved

A change from ASP to php.. sessions..Any ideas?

Posted on 2007-11-28
13
167 Views
Last Modified: 2013-12-12
I have a project that I have to add another page to the site. However the site has been written in asp and uses ms sql server for the database. I use mysql. The problem is that the visitors have to login to the site first and then they can go to the different pages on the site. I do most of work in php and I know that we can use sessions to do it however how do I get the sessions from asp? when the people logged in, how can I keep what they entered as their login and password when they come to my page and the information is not lost.

Thanks
0
Comment
Question by:syedasimmeesaq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 17

Expert Comment

by:nplib
ID: 20367305
you can't.
either make the whole site php or asp.
using both is a developer nightmare
0
 
LVL 20

Assisted Solution

by:Muhammad Wasif
Muhammad Wasif earned 100 total points
ID: 20367326
You can generate some random number and save it in cookie and database using asp. When user click on php pages, get the values from cookie and compare it with the value in database. If the match is found, you can give access to the users.

Use of random number is just an idea, you can use combination of random number and email address or something else.
0
 
LVL 17

Expert Comment

by:nplib
ID: 20367343
yes cookies can be created in any language and read in another
0
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 150 total points
ID: 20369039
There can be difficulties in reading cookies from one language to another.  The browser will have access to them and they can be read but sometimes you have to get the complete cookie and manually process it.  Also since the cookie is on the client side it is prone to more failure.

The best option is to use the database.  Are you migrating completely to MySQL for ASP and PHP?  The specifics can vary but the general idea Wasifg mentioned above will help.

You could also look at third party session management tools for your server.  I can't say for sure if there are some that will work in both languages but I believe so.  They are made to use the database to manage the session and if both languages can access the server and database then it should be possible.

If most of your site and session stuff will be in PHP now then I really recommend you consider getting rid of the ASP.  What is the point of it?  It will just add difficulty to what you want to do and make it more complex.  That just makes failures and issues more likely.

If you just had one, unimportant thing in PHP then I would say use cookies.  They will be easy and quick.  You just might have a little work to get PHP to read the ASP cookie.

If there will be a even mix of ASP and PHP using the session info then the database is your best option.  This of course assumes you will narrow down to one database.  I would recommend against using two, especially since both languages can access each of those databases.

I hope this helps.  Let me know if you have a question or need more info.

bol
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20369285
I think I can use mssql. How do I setup pp so it can access mssql?
I know I can change php.ini but do I need soomething more than that, any special downloads for extensions and dlls?

Thanks
0
 
LVL 17

Assisted Solution

by:nplib
nplib earned 250 total points
ID: 20369301
download php from php.net,
install,
make sure the extension php_mssql.dll is loaded in php.ini
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20369463
I have already downloaded php. I think that there should be another file in system32 directory of the machine. It says to put that file in \winnt\sytem32. I dont have a winnt directory. I have Windows\system32 directory. Is that the same?
0
 
LVL 17

Assisted Solution

by:nplib
nplib earned 250 total points
ID: 20369473
yes
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20369513
I just copied ntwdblib.dll to windows\system32 directory and took out the comment ; and made sure extension=php_mssql.dll is in php.ini file. But when I ran phpinfo() it still doesn't show mssql
Thanks
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 20369551
You might want to open a new question here for that new issue.  I can't help you specifically with it and no expert will know about this based on the question title and body above.  It really is a separate issue.

Do you have any more questions about this issue or need more info on it?

If you want to let the experts here know about the new question for the MSSQL setup issue then post the URL of the new question here.

bol
0
 
LVL 17

Assisted Solution

by:nplib
nplib earned 250 total points
ID: 20369572
make a php page
<?php
$connect = mssql_connect("server", "user", "password") or die("it doesn't work");
if ($connect) {
   echo "WOO HOO";
}
?>

make sure server is the FQDN or ip address of your actual sql server, username is a user that has rights to logon and password, the real password.

0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20369605
As from the respected expert advice, you may help me at this post
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_22989071.html
thanks
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 20369775
Thanks!  I'm glad I could help.  Thanks for the grade, the points and the fun question.  I'll take a look at the other question and post if I can help.  However that isn't something I have really messed with in PHP. :)

See you around!

bol
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question