guyfromfl
-
Posts
286 -
Joined
-
Last visited
Never
Posts posted by guyfromfl
-
-
I've been working on this for baout 9 damn hours and can't get it working. only 1 person on 3 forums has written back
i give up.
-
i copied from my linux server to WAMP server (Windows, Apachem MySQL, PHP) and its not working.
not 100% sure whats going on here
-
i wrote this login script about a year and a half ago, and it works perfect on my other projects.
thats what is baffling me.
-
Its not passing session data.
The only difference is that I am doing this project on my WAMP server not my linux box. is there a problem with WAMP and sessions??
Im gonna start googling
Thanks for the help
-
Ill check it out..
I did some changing and now footer.php retruns:
Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in C:\wamp\www\bli\includes\footer.php on line 7
so the session never started
-
yea the SESSION variable isn't getting data passed to it. I don't know.
I tried include had the same result.
What's weird is this login script is from other projects that work fine, I Just copied and pasted it.
Thanks for lookin at it tho
-
NOBODY????????????????
-
change the function in the while loop from mysql_fetch_array to mysql_fetch_assoc
-
oh and the code for the $db->checkUser($username, $password); call
dblib.php
class dblib { // Other stuff function checkUser($user, $pass) { /* * Description: Validate a user by his log in creditials. A * user with user_id of zero is a normal web surfer * and cannot access company privilege info. * * Date: April 1, 2009 */ $sql = "SELECT id FROM bli.users WHERE bli.users.username='$user' AND bli.users.password=MD5('$pass')"; $result = $this->query($sql); list($user_id) = mysql_fetch_row($result); if (empty($user_id)) { $user_id = 0; } return $user_id; } // More other stuff } $db = new dblib();
-
I cannot figure out why this login script will not work. I have simply copied and pasted it from code that works. If I ask it to return $_SESSION['user_id'] from inside login.php it echos the correct value. If you put it anywhere else it says undefiened index.
no matter what I get redirected to the login page.
I don't think the $_SESSION data is getting passed to the other pages.
PLEASE HELP
pretty simple code snipets:
header.php
<?php include('includes/format.php'); include('includes/dblib.php'); $config = $db->getConfig(); $format = new format(); session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Broadway Limited Imports Service Department</title> <link href="http://bli.servehttp.com/bli/knowledgebase/includes/bliprint.css" rel="stylesheet" type="text/css" media="print" /> <link href="includes/css/bli.css" type="text/css" rel="stylesheet" media="screen, tv, tty" /> <link href="http://bli.servehttp.com/bli/knowledgebase/includes/jquery-ui-1.7.2-custom.css" type="text/css" rel="stylesheet" /> <script src='lib/jquery/jquery.js' type="text/javascript"></script> <script src='includes/corners.js' type="text/javascript"></script> <script src='includes/ui.core.js' type="text/javascript"></script> <script src='includes/ui.datepicker.js' type="text/javascript"></script> <!-- Functions --> <script type="text/javascript"> $(function() { $("#datepicker").datepicker(); $("#format").change(function() { $('#datepicker').datepicker('yy-mm-dd', {dateFormat: $(this).val()}); }); }); </script> </head> <body> <!-- <body onload="document.frmSearch.search.focus()"> --> <!-- Begin Wrapper --> <center> <div id="wrapper"> <!-- Logged in Status --> <?php echo ($_SERVER['user_id']); if (isset($_SESSION['user_id'])) { echo "<div style='float: right; font-size: 12px; padding-right: 10px; top:0' id='userPanel'> <span style='color: #777;'><a href='issueList.php'>Issue Tracker</a> | </span> <span style='color: #777;'><a href='admin/'>Admin Control Panel</a> | </span> <a href='logout.php'>Logged in as " . $db->getUserfNameById($_SESSION['user_id']) . "</a></div>"; } else { echo "NOOOOOOOOOOOOOO"; } ?> <!-- Begin Header --> <div id="header"> <p style="color:#ccc; valign: middle; text-align: left"> <a href="<?php echo $config['companyWebsite']; ?>"><img style="padding-left: 10px" src="img/HeaderLogo.png" alt="Broadway Limited Imports" /></a> <a href="http://bli.servehttp.com">Knowledge Base</a> </p> </div> </div> <!-- End Header -->
index.php
<?php require('includes/header.php'); //echo $_SESSION['user_id']; //die(); if (isset($_SESSION['user_id'])) { ?> <h3>Main Menu</h3> <table id="menu"> <tr> <td><img src='img/icons/128/Tools.png' /><br />Repairs</a></td> <td><img src='img/icons/128/Components.png' /><br />Parts</a></td> </tr> <tr> <td><img src='img/icons/128/Issue.png' /><br />Issues</td> <td><a href='customer.php?action=menu'><img src='img/icons/128/Customers.png' /><br />Customers</a></td> </tr> </table> <?php } else { header("Location: login.php"); } require('includes/footer.php'); ?>
login.php
<?php require('includes/header.php'); ?> <br /><br /> <div id="login"> <?php // Check if user wants to login if(isset($_GET['try'])) { // Check info was entered if(empty($_POST['username']) OR empty($_POST['password'])) { // not everything was entered echo "<span style='color: red'>Please fill in all the fields.</span>"; } else { // Check credentials $username = mysql_real_escape_string($_POST['username']); //$password = md5($_POST['password']); $password = $_POST['password']; $checkUser = $db->checkUser($username, $password); if ($checkUser == 0) { echo "<span style='color: red'>Invalid login!</span>"; } else { // CREATE SESSION $_SESSION['user_id'] = $checkUser; echo $_SESSION['user_id']; // $db->logUser(); header("Location: index.php"); } } } ?> <form action="login.php?try=validate" method="post"> <p> <strong>Login<br /></strong> Username: <input type="text" name="username" class="login" /><br /> <br /> Password: <input type="password" name="password" class="login" /><br /> <br /> <input type="submit" value="Login" /> </p> </form> </div><br /><br /> </div> <?php include ('includes/footer.php'); ?>
-
thanks for the tool...i should be able to figure it out from here...lol
-
I am building a php page, and was wondering if a disabled input text box is passed through GET and POST?
I could have sworn it was passed, but I cant tell if there is an error in my code, or if disabled form elements get passed through GET and POST
-
Thats it!
Thanks for the help!
-
I didn't want to have a bunch of td's with the id=complete so i think that might do it.
Such an obvious solution! thanks, Ill give it a shot!
-
I am trying to make it so you can click the checkbox at the top, and it will hide all rows where the data of the Status column is "Complete"
I am trying to decide the best way to do it, either check the data that is in the innerHtml, or like I have now, php determines what the value from the database is and adds class='complete' to the tr tag.
Any suggestions?
Here is the test table:
-
Yea I know about JS to do that, but what I was working towards would be a more complex table where you can change the status by clicking the row and a few other things that would rely on the database. I figured starting with the hide might be a good baby step. I definatly could be wrong about that
-
I am new to Ajax and was wondering if anybody knew of any good primers?
I am trying to take this table and when you click the checkbox it hides completed issues. I am assuming Ajax would be the best way to do it.
Here is my test page
-
You're mixing html and php code all over the place.
record 1
Name=
FirstName=Joe Bob
record 2
Name=Billy Bob
FirstName=
record3
Name=Peggy Sue
FirstName=Peggy
echo "<b>Database Contents</b>"; foreach ($rec as $record) { if ($Name) { echo "Name: " . $Name[$rec] . <br />"; } if ($FirstName) { echo "First Name: " . $FirstName[$rec]; } echo "<br />"; }
Is that what you are looking for?
-
yum only gives you packages for the distro you have plus i think the previous 2. so if you are using distro 7 but latest is 10 you cant get anything through yum any more.
-
right then it goes on to make the <td> that has the "The One and Only" row....
then in there there should be the rating <td> then the <td> that has either you're logged in so vote or you're not logged in so go login part I sent you...
-
im looking for a
while ($row=mysql_fetch_array($result)) { echo "<td>Data</td>"; }
-
so you are hand writing every movie and every song that you are following???
what I'm getting at is you need to control the variables that are being put into that input statement.
-
can you post the code that tells that input to be written?
-
ok
so now
where it says this:
<input name="MusicID" type="hidden" id="MusicID" value="6651" readonly="readonly" />
is that generated by php?
[SOLVED] SESSION help! about to jump off a bridge
in PHP Coding Help
Posted
im on 2 other boards nothing.
this is such a stupid thing to be caught on.
im just gonna re write the WHOLE project i guess.
thanks for your help man