General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 12th, 2003, 02:18 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
User Login - url redirection?

if i create a db table that has: USER, PASSWORD, URL

how can i make each user go to their specific url when they login.

user 1 goes to user1.htm
user 2 goes to user2.htm
and so on

i have no code to post because i have not started yet i am looking more for the pseudo code or theory. but i guess an exaple would help.

Thanks
Dave
www.fs3d.com

Reply With Quote
  #2  
Old July 12th, 2003, 02:55 PM
_rainbow_ _rainbow_ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Lj, Slovenia
Posts: 27 _rainbow_ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 0
The function you are looking for is header(). An example:

PHP Code:
 header("Location: user1.htm"); 


Be careful with this function. It sends raw HTTP headers, wich means you musn't print out any other chars, even a space is not allowed, wich is usually the common mistake.

If you find it difficult using it this way (if you keep getting errors) try using it with the ob_start() and ob_end_flush() functions to make your way around your errors. Hope it helps a bit.

Reply With Quote
  #3  
Old July 12th, 2003, 03:15 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
i want user user1.htm to be a from the data base how do i tell PHP that user1.htm correspondes to the user1 data base field or is there a way to tell PHP to look with in the same row for the URL.

i hope this is clear,

Thanks

Dave

Reply With Quote
  #4  
Old July 12th, 2003, 05:55 PM
_rainbow_ _rainbow_ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Lj, Slovenia
Posts: 27 _rainbow_ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 0
Well in that case, you have to get the users name from the database (I trust you know how to do that), then lets say you save that name in the variable $user. The line looks like this:

PHP Code:
 header("Location: $user.htm"); 


This will take each user to their site. But why are you doing this like this? Imagine that you have a large number of users, why bother making a site for each and every one of them. Make a template page and just change what you need for each user with a script. On the other hand if you have only a few users, could prove usefull. Anywayz, hope you explain a bit further why you need this to begin with.

Reply With Quote
  #5  
Old July 12th, 2003, 05:59 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
i am a small web designer and i want to create a place where my clients can log in and see their site before it is published and some other information that they may not want to be public. and lastly if it works out how i want it to it might be cool.

Thanks for the help, i think that will work perfect.

i am new to PHP

Dave

Last edited by dfano : July 12th, 2003 at 06:06 PM.

Reply With Quote
  #6  
Old July 12th, 2003, 06:03 PM
_rainbow_ _rainbow_ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Lj, Slovenia
Posts: 27 _rainbow_ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 0
Cheers. Glad to have helped.

Reply With Quote
  #7  
Old July 12th, 2003, 06:08 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
what if the user name is differnt from url
real example:

Username : jason
url : chandlerarchitecture.com

the way you posted before will work fine, im just curious.

Dave

Reply With Quote
  #8  
Old July 12th, 2003, 06:18 PM
_rainbow_ _rainbow_ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Lj, Slovenia
Posts: 27 _rainbow_ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 0
Well make another field in the database (lets say lates_site or something). Well all you have to do is to save the addres in there. In this case you could save the whole addres in there (with the extension .htm or .php) and use a simpler line:

PHP Code:
 header("Location: $latest_site"); 


Well I would do it like that...

Reply With Quote
  #9  
Old July 12th, 2003, 07:29 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
it would look in the same row that user is in?

Reply With Quote
  #10  
Old July 12th, 2003, 08:34 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
What you could do, is in your database where you have your client information stored, for example if you have it setup like this
Quote:
username, password, custname, coname , custaddress, custphone, customerurl


then you could pull the customers url out of the database and send that information to the header, ie:
PHP Code:
if ($dbConn){ //this assumes that you already 
    //successfully connected to the database
    
$strQuery "select * from siteusers "
    
$strQuery .= "where username = '$username'"
    
$strQuery .= " and password = '$userpass'"
//This also assumes that you already have the username and password
    
$results mysql_query($strQuery); 
    
$result mysql_fetch_row($results); 
    if (
$result){ 
        
$CustURL $result[6]; 
        
header("Location: $CustURL");
    } else{ 
        echo 
"No results returned.";
    } 



That would pull the information you would need to redirect to the customers website, otherwise it would justecho "No results returned." or something similar. Of course you would need to make sure that the customer would put their url in propper format when they sign up, or whatever you are doing..

Hope this helps.

Reply With Quote
  #11  
Old July 12th, 2003, 09:21 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
justin i was hoping you would read this, i was going to send you a private message actually, but i didnt want to bother.

_rainbow_ had some really good info though

Thanks

Dave

hey check out the site and give me some feed back
www.fs3d.com i just finished it today

Reply With Quote
  #12  
Old July 12th, 2003, 10:21 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
No worries, let me know if you need any more help

Reply With Quote
  #13  
Old July 13th, 2003, 12:37 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
AHHHHH

okay i thought i could do, I was wrong, dead wrong.
this what i have that works (i got with the help of Dreamweaver)

__________________________________________________ __

<html>
<head>
<title>Untitled Document</title>


<?php
$hostname_fs3d = "localhost";
$database_fs3d = "*";
$username_fs3d = "*****";
$password_fs3d = "****";
$fs3d = mysql_pconnect($hostname_fs3d, $username_fs3d, $password_fs3d) or die(mysql_error());
?>

<body>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<p>
<input name="Username" type="text" id="Username">
user name</p>
<p>
<input name="Password" type="password" id="Password">
password</p>
<p>
<input type="submit" name="Submit" value="login">
</p>

</form>


</body>
</html>

__________________________________________________ _

where the heck do i go from here.

thanks

Dave

Last edited by dfano : July 15th, 2003 at 04:12 PM.

Reply With Quote
  #14  
Old July 14th, 2003, 04:27 AM
avit avit is offline
Not Yet Perfect
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Squamish, BC
Posts: 111 avit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via ICQ to avit
Hey there,

It looks like you need to define the $loginFormAction. If you like, you can simply replace that <?php ?> block with the name of the php script that will process your login (e.g. "login.php"). That login script should contain the code you were given a few posts back by nicat23.

What about the database itself? have you built your table and put some rows into it?

Also, you don't need the database connection block on this form page. It's simply a form for collecting the info. Your second script (login.php) will handle the checking of the info. It's technically possible to have the same script check the form input, but to cut the confusion, skip that method for now--at least until you get it working.

Reply With Quote
  #15  
Old July 14th, 2003, 08:17 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
For what it's worth, if you do plan to use localized pages in some cases, you probably ought to design one such page that checks the username and password and displays custom info rather than maintaining a separate page for each user. This is of course assuming that there are common elements to all such pages.

Reply With Quote
  #16  
Old July 14th, 2003, 10:08 AM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
thats probably the best thing to do likr _Rainbow_ said before, but that would mean that i have to know how to work with templates and i dont know how to do that yet. im going to tackle that next.

Thanks for the input,

Dave

Reply With Quote
  #17  
Old July 14th, 2003, 06:45 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
okay im getting this:

Quote:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/virtual/site33/fst/var/www/html/php/sendinfo.php on line 24
No results returned.


im using this code:

Quote:
<?php
$Host = "localhost";
$db_User = "user";
$db_password = "password";
$db_name = "db_name";

$dbConn = mysql_connect ($Host,$db_User,$db_password);

if ($dbConn){ //this assumes that you already
//successfully connected to the database
$strQuery = "select * from Users ";
$strQuery .= "where username = '$Username'";
$strQuery .= " and password = '$Password'";
//This also assumes that you already have the username and password
$results = mysql_query($strQuery);
$result = mysql_fetch_row($results);
if ($result){
$custurl = $result[6];
header("Location: $custurl");
} else{
echo "No results returned.";
}
}
?>




im almost there thank in advance

Dave

Reply With Quote
  #18  
Old July 14th, 2003, 07:25 PM
_rainbow_ _rainbow_ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Lj, Slovenia
Posts: 27 _rainbow_ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 0
Well, a lot could be wrong. For instance, where do you get those variables $Username and $Password (by the way, it looks kinda silly capitalized, don't you think )? GET, POST, somewhere else, cause it is not evident from the script. If you have your register_globals to off (default) in your php.ini file, you should use special variables (I forgot how you call them in english ).

PHP Code:
 $_POST['variable']; //for post variables
$_GET['variable']; //for get variables 


Clear? And another thing that could have gone wrong is your query. Is it set up according to your database? Try adding or die() on the end like this:

PHP Code:
 $results mysql_query($strQuery) or die("Something went wrong: ".mysql_error()." : ".mysql_errno()); 


You can also add this to any other mysql function.

You could also check if your query actually returns any values. If the supplied $result is empty (and this could be the case here), PHP returns an error. Test your result like this:

PHP Code:
// the part where you get your result from your query
if(mysql_num_rows($result))
{
    
// the bit with your header function
}
else
{
    
// report that something went wrong



How 'bout now? Still returning an error?

Reply With Quote
  #19  
Old July 14th, 2003, 08:16 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Quote:
Originally posted by dfano
okay im getting this:



im using this code:




im almost there thank in advance

Dave


Dave, the code is fine, but that was just an example, I wasn't meaning for you to use that exact code

You'll have to make sure that $username and $password have a value in them.. also in the query, make sure that Users is the table name... that was just another example

Also, keep in mind that the table names and fields are case sensitive, so if the table is named users and not Users, or the fields are named Password and not password, then you will get an error when trying to use that query.

Also, you aren't selecting your database, you're just connecting to the server.

Change this in your code:
PHP Code:
 $svrConn mysql_connect ($Host,$db_User,$db_password); 
if(
$svrConn){
    
$dbConn mysql_select_db($db_name,$svrConn); 
} else {
    echo 
"Not able to connect to the database server.";


That should fix your problem, let me know.

Reply With Quote
  #20  
Old July 14th, 2003, 09:09 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
it does not give me an error, but it's not sending me any where. all the names and case are correct (wrong conventions, im still learning).

it keeps giving me "No results returned."

this is the data base info from the interface that my hosting service provides:

Quote:
Field Type Attributes Null Default Extra Action
Username varchar(32) No 0 Change Drop Primary Index Unique
Password varchar(32) No 0 Change Drop Primary Index Unique
custname varchar(32) No 0 Change Drop Primary Index Unique
coname varchar(32) No 0 Change Drop Primary Index Unique
custaddress varchar(32) No 0 Change Drop Primary Index Unique
custphone varchar(32) No 0 Change Drop Primary Index Unique
custurl varchar(32) No 0 Change Drop Primary Index Unique

hers the db content
Quote:
Username - dave
Password - 1234
custname - dave
coname - fusion studios
custaddress - 4884
custphone - 305-525-5412
custurl - http://www.miami.com



and here is the code:

Quote:
<?php
$Host = "localhost";
$db_User = "fs3d";
$db_password = "*";
$db_name = "*";

$svrConn = mysql_connect ($Host,$db_User,$db_password);
if($svrConn) {
$dbConn = mysql_select_db ($db_name,$svrConn);
} else {
echo "did not connect to database";
}

$_POST['Username'] = "$Username";
$_POST['Password'] = "$Password";

if ($dbConn){ //this assumes that you already
//successfully connected to the database
$strQuery = "select * from Users ";
$strQuery .= "where Username = '$Username'";
$strQuery .= " and Password = '$Password'";
//This also assumes that you already have the username and password
$results = mysql_query($strQuery);
$result = mysql_fetch_row($results);
if ($result){
$custurl = $result;
header("Location: $custurl");
} else{
echo "No results returned.";
}
}
?>


hers the form:

Quote:
<form name="form1" method="POST" action="sendinfo.php">

<input name="Username" type="text" id="Username">
user name</p>

<input name="Password" type="password" id="Password">
password</p>

<input type="submit" name="Submit" value="login">


</form>


sorry for the long post

thanks

dave


Last edited by dfano : July 15th, 2003 at 04:09 PM.

Reply With Quote
  #21  
Old July 14th, 2003, 09:12 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
No problems about the big post

I think I may have found your problem then

Quote:
$_POST['Username'] = "$Username";
$_POST['Password'] = "$Password";

Reverse that -- make it read
PHP Code:
 $Username $_POST['Username'];
$Password $_POST['Password']; 

Reply With Quote
  #22  
Old July 14th, 2003, 09:31 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
same deal

you can see it at

http://www.fs3d.com/php/adminlogin.php

user : dave
Password : 1234

and your supposed to go to www.miami.com if it works

Thanks

Dave

Reply With Quote
  #23  
Old July 15th, 2003, 02:20 AM
avit avit is offline
Not Yet Perfect
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Squamish, BC
Posts: 111 avit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via ICQ to avit
Reading through, I can't spot the bug, but there are other things I should point out:

mysql_fetch_row() will return your DB record as a numeric array with all of the columns:

$result[0] == "dave"
$result[1] == "1234"
$result[2] == "dave"
$result[3] == "fusion studios"
$result[4] == "4884"
$result[5] == "305-525-5412"
$result[6] == "http://www.miami.com"

(Assuming that your columns are in this order.) It would be better for your query to specify the exact columns you need:

PHP Code:
 $strQuery  "SELECT Username, Password, custurl FROM Users ";
$strQuery .= "WHERE Username = '$Username' ";
$strQuery .= "AND Password = '$Password'"


Then set $custurl to the right result field by number:

PHP Code:
// using the above query:
$custurl $result[2]; 


Debugging trick: try echoing your $strQuery onto the page to see if it makes sense with the variables inserted. It should print back 'dave' and '1234' in your query:

... FROM Users WHERE Username = 'dave' AND Password = '1234'

If that part works, verify your DB. Can you use the command line mysql command or phpMyAdmin to test the results of your select statement?

Reply With Quote
  #24  
Old July 15th, 2003, 09:32 AM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
i had a mistake in the posted code, justin had writtn that in his code, im talking about the [#]. but why did you write [2] if the custurl is ==[6], or was that just an example.

im sorry im not getting this stuff. i have no programing background what so ever i am actually an architecture grad student - i just really enjoy web design.

therefore, im going to ask alot of stupid questions.

Thanks alot for the help

Dave

Reply With Quote
  #25  
Old July 15th, 2003, 11:00 AM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
The reason why avit put 2 instead of 6 like I did, was the fact that there would only be 3 items assigned to the array that mysql_fetch_row() will return if you used his query. If you used mine then it would return 7 items... His array results would be Username, Password, and custurl... Arrays start at zero, and incriment from there so:

$results[0] = Username
$results[1] = Password
$results[2] = custurl

Reply With Quote
  #26  
Old July 15th, 2003, 11:19 AM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
oh okay, i built it like you did with 7 columns

but it still is not working

im connecting to the db

it processing the form

but it is still going to the "else" after the header part. it's like it is not finding the username and password.

Thanks

Dave

Reply With Quote
  #27  
Old July 15th, 2003, 11:25 AM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Did you do like avit recomended and echo the query?

Reply With Quote
  #28  
Old July 15th, 2003, 12:21 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
i did this: echo "$strQuery"; (i hope that is right)

i got this

SELECT Username, Password, custurl FROM Users WHERE Username = '' AND Password = ''

Reply With Quote
  #29  
Old July 15th, 2003, 12:42 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Ok then the reason why it's not working is that your query is requesting blank information... Did you fix the part for getting $username and $password? That's the only thing that would be holding this up at this time

add this to the code before you run the query
PHP Code:
echo "Username value : $Username\n<br>";
echo 
"Password value : $Password\n<br>"

to make sure that $Username and $Password at least have values in them...

Reply With Quote
  #30  
Old July 15th, 2003, 12:56 PM
dfano dfano is offline
Always Learning (I Think)
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: NYC Baby!!!!
Posts: 123 dfano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via AIM to dfano Send a message via Yahoo to dfano
they are coming up empty

www.fs3d.com/php/adminlogin.htm

check it out

here is the php one more time, just in case i screwed it up.

Quote:
<?php
$Host = "localhost";
$db_User = "*";
$db_password = "*";
$db_name = "*";

$svrConn = mysql_connect ($Host,$db_User,$db_password);
if($svrConn) {
$dbConn = mysql_select_db ($db_name,$svrConn);
} else {
echo "did not connect to database";
}

$_POST['Username'] = "$Username";
$_POST['Password'] = "$Password";

echo "Username value : $Username\n<br>";
echo "Password value : $Password\n<br>";

echo "<P>";

if ($dbConn){ //this assumes that you already
//successfully connected to the database
$strQuery = "SELECT Username, Password, custurl FROM Users ";
$strQuery .= "WHERE Username = '$Username' ";
$strQuery .= "AND Password = '$Password'";
//This also assumes that you already have the username and password
$results = mysql_query($strQuery);
$result = mysql_fetch_row($results);
if ($result){
$custurl = $result[2];
header("Location: $custurl");
} else{
echo "No results returned.";
}
}
echo "<P>";
echo "$strQuery";

?>


thanks alot

dave

Last edited by dfano : July 15th, 2003 at 04:11 PM.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > User Login - url redirection?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap