Solved

Not Getting Client ID

Posted on 2015-02-01
6
49 Views
Last Modified: 2015-02-01
I am trying to grab the ClientID when I make a new record but it's always coming up 0.  So the 7formsubmit.php isn't grabbing it.  Am I missing something?  Is it something to do with opening a SESSION?  I grabbed the code from the clientlogin.php.
clientlogin.php
7formsubmit.php
0
Comment
Question by:DS928
  • 3
  • 2
6 Comments
 
LVL 30

Expert Comment

by:Marco Gasi
Comment Utility
At the first look, I see you don't have session_start() in 7formsubmit.php: you have to put session_start in every script, otherwise wou'll can't access session data.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
0
 
LVL 30

Expert Comment

by:Marco Gasi
Comment Utility
In both script is missing a line where you put the clientID in the session array, nor I see any form where the user can do the login nor I see any code which processes user data and checks username and password... That is I don't see anything I should see :-) Am i blind?
0
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.

 

Author Comment

by:DS928
Comment Utility
I am sorry.  I think this is beyond me at this point.  How do I add session start to 7formsubmit.php
0
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 500 total points
Comment Utility
Simply writing

session_start();

at the very top of the script. But you have to put the clientID into the session array first. Unless you did it on another part of your code...
0
 

Author Closing Comment

by:DS928
Comment Utility
This worked.  Thank you.

<?php
//set_error_handler("var_dump");
              include("7conn.php");
              $mode=$_GET["mode"];
              session_start();
              if($mode=="add") {
                    $recordCust=$_POST["recordCust"];
                  $recordSite=$_POST["recordSite"];
                  $recordUser=$_POST["recordUser"];
                  $recordPass=$_POST["recordPass"];
                  $sql="insert into records(recordCust,recordSite,recordUser,recordPass,recordDateAdded) values('" . $_SESSION['clientID'] . "','$recordSite','$recordUser','$recordPass', Now())";
                  $result=mysql_query($sql,$connection) or die(mysql_error());
                  header("location: clientlogin.php");
              } elseif($mode=="update") {
                    $recordSite=$_POST["recordSite"];
                  $recordUser=$_POST["recordUser"];
                  $recordPass=$_POST["recordPass"];
                  $recordId = $_POST["recordId"];
                  $sql="update records set recordSite='$recordSite',recordUser='$recordUser',recordPass='$recordPass'  where recordId='$recordId'";
                  //echo $sql;
                  $result=mysql_query($sql,$connection) or die(mysql_error());
                header("location: clientlogin.php");
              }
?>
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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

7 Experts available now in Live!

Get 1:1 Help Now