Search
Left Quote    I find that the harder I work, the more luck I seem to have.
- Thomas Jefferson    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: I'm getting stuck at some point...
  This user is offline  lingh0e
  Subject: "I'm getting stuck at some point..." Posted: @ 8:46 pm on Mar 09 2007   

Member #: 291
Rank: User - (29)
Since: 03/03/07
Posts: 29
From: Ohio

I want to pull a value from a table and assign it as a variable

Here is what I have:


Code:
$q= mysql_query ("SELECT user_status FROM members WHERE username = '".$_POST[ 'username'].&qu ot;'");
$status = mysql_fetch_obj ect($q);

if($status==1) {
echo('<BR&g t;<BR>Sor ry. This username is not verified. Please check your email');
die;
}



I run it and try to log in with one of the membernames with a user_status value of 1 but the script goes right through and completes the login.

Where am I going wrong?


Feel free to kick me if I get annoying
    Viewed: 14,672 Times | Reply to This | To top
  This user is offline  misterhaan
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 8:57 pm on Mar 09 2007    

Member #: 5
Rank: User - (213)
Since: 02/11/05
Posts: 148
From: chair

$status is an object, which when you compare to 1 with == is going to be true (it converts them both to boolean or something odd like that).

try print_r($status ); to see what's in status (it's actually $status->use r_status you want)




please note that the above post is likely made up in its entirety.

    Viewed: 14,665 Times | Reply to This | To top
  This user is offline  lingh0e
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 8:51 pm on Mar 09 2007    

Member #: 291
Rank: User - (29)
Since: 03/03/07
Posts: 29
From: Ohio

wow... fixed my own problem again...

dumb luck.

I guess

Code:

if($status == 1



really needed to be


Code:
if($status-> user_status == 1



Now, I know I stumbled upon that only because I was looking through some other snippits of code, but can anyone explain to me why I needed to add that little bit to get it to work?

Sorry if it's a basic thing...




Feel free to kick me if I get annoying

    Viewed: 14,663 Times | Reply to This | To top
  This user is offline  lingh0e
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 9:06 pm on Mar 09 2007    

Member #: 291
Rank: User - (29)
Since: 03/03/07
Posts: 29
From: Ohio

Man... that only took me like, four or five hours.

Now on to the next task:

Scripting the verification e-mail and page that members will have to use. Y'all can expect a lot more posting from me in the next day or three, since it will probably take me that long.




Feel free to kick me if I get annoying

    Viewed: 14,659 Times | Reply to This | To top
  This user is offline  lingh0e
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 1:05 am on Mar 10 2007    

Member #: 291
Rank: User - (29)
Since: 03/03/07
Posts: 29
From: Ohio

So I've got a rough idea of how to implement the mail function to send the verification link to the user, but it's too rough for me to actually get it to work.

I need to get the hash generated a from the user_timestamp field onto the end of a link leading to the verification script, then send the link out to the user.

Here is what I have so far, placed towards the bottom of my registration form. Of course, it doesn't work :

Code:


if(isset($_POST ['submit']))< br /> {

$query = mysql_query(&q uot;SELECT user_timestamp FROM members WHERE user_email = '".$_POS T['email'].& quot;'") ;
$hash = mysql_fetch_obj ect($query);
$to = $_POST['user_e mail'];
$from = Sybaritic
$subject = "Sybariti c Account Verification&q uot;
$message = "This is an automated mail sent to verify registration at the Sybaritic community.\n If you did not initiate a registration, please disregard this email.\n To complete the registration process, please click on the link below, or cut and paste it into your browser window.\n
<a href="htt p://www.lingh0e .com/sybaritic/ index.php?p=ver ify_$hash" ;>http://www .lingh0e.com/sy baritic/index.p hp?p=verify_$ha sh
</a>

$sendmail = mail($to, $subject, $message);
if($sendmail == true)
{
echo"Mess age sent!"; }
else
{
echo "Error sending message";
}




Feel free to kick me if I get annoying

    Viewed: 14,652 Times | Reply to This | To top
  This user is offline  lingh0e
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 2:13 pm on Mar 10 2007    

Member #: 291
Rank: User - (29)
Since: 03/03/07
Posts: 29
From: Ohio

After taking a long break to the bar before returning for some quick reading I realized I was going about it all wrong... and I am now on the right track.

I've always been much better at learning by doing, and boy am I ever doing!




Feel free to kick me if I get annoying

    Viewed: 14,620 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 4:39 pm on Mar 10 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

well, please share if you will as I am dealing with this same issue and totally lost




Photo Hosting Scripts? It's what I do....

    Viewed: 14,616 Times | Reply to This | To top
  This user is offline  lingh0e
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 5:08 pm on Mar 10 2007    

Member #: 291
Rank: User - (29)
Since: 03/03/07
Posts: 29
From: Ohio

Well, after spending 30 hours fighting with various pages of code, I have completed a very rudimentary e-mail verification system.

I learned a lot in the process, but I still feel horribly confused by all the damn brackets, parenthesis and quotes.




Feel free to kick me if I get annoying

    Viewed: 14,610 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 5:25 pm on Mar 10 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

  lingh0e said...

< i> Well, after spending 30 hours fighting with various pages of code, I have completed a very rudimentary e-mail verification system.

I learned a lot in the process, but I still feel horribly confused by all the damn brackets, parenthesis and quotes.


I think gravy wants to see code




-bs0d | AllSyntax.com

    Viewed: 14,608 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 5:57 pm on Mar 10 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

LOL, yeah I do!




Photo Hosting Scripts? It's what I do....

    Viewed: 14,605 Times | Reply to This | To top
  This user is offline  lingh0e
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 8:13 pm on Mar 10 2007    

Member #: 291
Rank: User - (29)
Since: 03/03/07
Posts: 29
From: Ohio

My coding is too sloppy and disorganized to post.




Feel free to kick me if I get annoying

    Viewed: 14,599 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 8:42 pm on Mar 10 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

  lingh0e said...

< i> My coding is too sloppy and disorganized to post.

LOL, mine too, you should see what I just did to the comment script....Ugly I teels ya, UGLY!




Photo Hosting Scripts? It's what I do....

    Viewed: 14,597 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: I'm getting stuck at some poin..." Posted: @ 10:58 pm on Mar 10 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Ha ha! Well, it don't have to be pretty, as long as it works. I view it like anything else, the more you use it, the better you will get at it.

Also remember if you post code on here, check the "disable smilies" checkbox and it should help with getting smilies in your code. I think I still have to fix that on edit reply if you forgot to click the checkbox. Also, I saw a quote of code, and it didnt work - that sucks lol, there is always something to do!




-bs0d | AllSyntax.com

    Viewed: 14,590 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank