Jump to content

erikbeam

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

erikbeam's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wow, I hate syntax problems. Especially when it's almost midnight. Thank you second, and third, and forth sets of eyes. Working like a charm now. I hate feeling stupid, but it sure feels good when these problems go away.
  2. I've got a login page that goes through a php page to check the database, then it either routes to the content or to .../wrong_id.php. Here's the form I'm sending to login: <form name="login" method="post" action="login.php"> Username:<input name="user" type="text" size="16"/><br> Password:<input name="pass" type="password" size="16"/><br> <input type="submit" name="login" value="Login"/> <input type="reset" name="reset" value="Reset"/> </form> and the database checking .../login.php <?php $con=mysql_connect ("localhost", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("dbname", $con); $query = sprintf("SELECT username, password, email, gallery FROM customer WHERE username='%s' AND password='%s'", mysql_real_escape_string($user), mysql_real_escape_string($pass)); $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { $dbuser = $row['username']; $dbpass = $row['password']; $dbemail = $row['email']; $dbgallery = $row['gallery']; } echo $dbuser; echo $dbpass; if($dbpass) { $_SESSION['sessionuser'] = $dbuser; $_SESSION['sessiongallery'] = $dbgallery; $_SESSION['sessionpassword'] = $dbpass; echo "<meta http-equiv=\"refresh\" content=\"0;URL=gallery/index.php\">"; } else session_destroy(); echo "<meta http-equiv=\"refresh\" content=\"0;URL=wrong_id.php\">"; ?> I've got the echo's in there just to see if the variables are being passed. They are. On .../wrong_id.php I've got: <?php echo $_SESSION['sessionuser']; echo $_SESSION['sessiongallery']; echo $_SESSION['sessionpassword']; ?> just to see if the variables are in fact being read. They are. This works fine in IE, but not in Firefox. If the right user/password is entered, IE will route to the content. Firefox routes to .../wrong_id.php no matter what. The thing I don't get is since the variables are being passed, it means that the php is working, and since Firefox shouldn't even see the login.php site, why would it react any differently? The only thing I can think is that the data Firefox sends to the server must be different in some way between IE and Firefox. Any suggestions? Thanks.
  3. I've tried loading the page then going through Tools->Options->Delete All Files and the same old photo shows up. And the images are all in the same directory as the rest of the files. I had the page working using the exact code that shows up through View Source. I would like this to be one dynamic file though, rather than having a bigpicxxx.php file for each thumbnail on the list (for the whole site that could be thousands). I'm used to code giving my the death message when something crashes. This one's doing what it's supposed to (changing the x.jpg name) and still leaves me in the wrong. I'll keep plugging away at it, though. Thanks for the ideas.
  4. I hope I don't get too long-winded describing this. I've got the typical photo gallery. Using iframes, I've got menu on the left, the big image in the center, and a table of thumbnails on the right. The center iframe is .../bigpic1.php. Each thumbnail, when clicked will open .../bigpic1.php?thumb=1 or ...?thumb=2, etc... In /bigpic1.php, I'm using the trick where the image is the background and there's a transparent .gif file directly over it, so the callout for the actual image is in the style sheet: { background-image:url('<?php $thumbnum = $_GET['thumb']; echo $thumbnum; ?>.jpg') background-repeat: no-repeat; background-attachment: fixed; background-position: center; } Everything works perfectly as you click down the thumbnails, except the original background image never changes. When I view source on the center frame I see: { background-image:url('3.jpg') background-repeat: no-repeat; background-attachment: fixed; background-position: center; } Or whichever number thumbnail was clicked, the code is working, but I still see 1.jpg as the image. I thought it might have something to do with the iframes, so I right-clicked "Open in new window" and it's the same effect. I've verified that all the 1.jpg, 2.jpg, 3.jpg, etc... images are where they need to be, and even opened them manually .../1.jpg to see them. Is this something to do with refreshing the background? If I just hit refresh it does nothing, nor does Ctrl+F5. Any ideas?
  5. I've got a basic user login page where I start a session and pass on $_SESSION['sessionuser'] and $PHPSESSID to the next page. The format I have is: -login form (form.php) -verify login (login.php) -here if login matches the database I <meta http...> redirect to /gallery/index.php -if login does not match I <meta http...> redirect them to wrong_id.php to login again -just for testing I've got /gallery/index.php set to just: [ <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php echo $PHPSESSID; echo $_SESSION['sessionuser']; ?> This works fine. It shows the random string followed by the username. And if I close the browser and reopen to login again I even get a different $PHPSESSID. However, if I use the same browser, or open a new tab in the same browser, and try to login, I get the new username with the old $PHPSESSID. How do I clear $PHPSESSID as part of the login process? I've tried this in the login.php file: <?php if(isset($PHPSESSID)) { session_unset(); session_start(); } else { session_start(); } ?> This doesn't seem to work. I've also tried specifically using session_unset($PHPSESSID); with the same results.
  6. Perfect. That makes a lot of sense to me now. Thank you very much.
  7. I got this message: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/erikmcom/public_html/dbtest/insert.php on line 15
  8. My goal is to send an email link to customers that includes their gallery number in the URL, so the website knows which information they get to see after they create an account. Ex: Click here to view your gallery: www.xyz.com/form.php?gallery=123456 I've got /form.php setup to get username and password and send them to a dynamic page that will display their images based on the initial gallery number: <form action="insert.php?gallery=<?php echo $gallery;?>" method="post"> Username: <input type="text" name="username" /> Password: <input type="password" name="password" /> Then in "/insert.php" I want to post the username, password, and gallery number to the MySQL database: $sql="INSERT INTO customer (username, password, gallery) VALUES ('$_POST[username]','$_POST[password]','$_POST[gallery]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } The username and password both post to the database, but the gallery value is blank. The "?gallery=123456" part passes to /insert.php just fine, and to double check that the gallery value is passed I put in an: echo "Welcome to gallery " . $gallery . ", " . $username ."."; The gallery number shows up fine here. I've tried declaring "gallery" in the MySQL table as both VARCHAR and INT. VARCHAR will leave a blank value and INT leaves a value of 0. Any idea where I went wrong?
×
×
  • 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.