Jump to content

Search the Community

Showing results for tags 'user login on if count'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I can't seem to get the session array to work. I am using a if count to make sure the password matches on the username and password. This is my login script. This page executes after typing in your username and password. $db_name="wcdmembers"; $tbl_name="members"; mysql_connect("$host", "$username", "$password"); mysql_select_db("$db_name"); $wcdname=mysql_real_escape_string($_POST['wcdname']); $pword=mysql_real_escape_string($_POST['pword']); $sql="SELECT * FROM $tbl_name WHERE wcdname='$wcdname' and pword='$pword'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ $_SESSION['wcdname'] = 'wcdname'; $_SESSION['pword'] = 'pword'; } else { echo "Wrong Username or Password. <a href=index.html>Try Again</a>"; } $sql="SELECT * FROM $tbl_name"; $result1=mysql_query($sql); while ($row = mysql_fetch_array($result)) { $fname= $row["fname"]; echo "Welcome <a href=myaccount.php style=color:#000000 onMouseover=showmenu(event,linkset[6]) onMouseout=delayhidemenu()>$wcdname!</a>"; } ?> <?php session_start(); $_SESSION["wcdname"] = $wcdvalue; ?> <?php echo "Today is "; echo date('l \t\h\e jS \o\f F Y') ; ?> In the code above you also see a select * from before it displays the Welcome $wcdname. I had to use the select * because I wanted to show the first name and not the username. Now im not sure on how or what to do because I want to use the username on the comments table because people can have the same first name. Unless I want to go by ID? I do have an ID auto inc set on each user in wcdmembers. ----- EDIT I created the session array after the welcome display. I attempted to put it all in the same php block but it would give me an error. Right now it will display the wcdname(username) but now the date wont appear with the 2nd php block session. I am attempting to have the user leave a comment and carrying over information to the next page. This way when they leave a comment it will recognize the username and store it in a new table. This is my current comment.php page code. Its not much because I cant get the session to start. <?php session_start() $wcdvalue = $_SESSION['wcdname']; (line 156) echo "Welcome $wcdname"; ?> This is where I get the error : Parse error: syntax error, unexpected T_VARIABLE in /home/content/80/11355280/html/comment.php on line 156
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.