Solved

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

Posted on 2007-11-28
13
162 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now