Solved

Not Getting Client ID

Posted on 2015-02-01
6
52 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 31

Expert Comment

by:Marco Gasi
ID: 40582558
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
ID: 40582565
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40582566
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

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

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 40582590
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
ID: 40582592
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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…

911 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