Jump to content

cmb

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by cmb

  1. WOW im stupid i forgot that this was also in an if statement and i only corrected the one part instead of both thanks for the help
  2. this is what its out putting <a href='tag.php?tag=Ryan_S'Ryan_S>Ryan_S</a></div></div></li><li> also i don't think this is important but i am using this in the gallerific jquery plugin
  3. its not replacing the _ with a space
  4. all i want is for when their is a _ to be replaced with a space so i tried these and neither worked <?php $pmod = str_replace("_"," ",$p); $pmod = preg_replace("_"," ",$p); ?> so i was wondering if because this was in a while statement, is this the reason its not working, and if so how should i fix it (this is the while) <?php while ($z <= $w){ $p = $multi[$z]; $pmod = str_replace("_"," ",$p); echo "<a href='tag.php?tag=$p'" . $p . ">" . $pmod . "</a> "; $z++; } ?>
  5. i just broke up the echo so i could write this code here like this <?php while ($y <= $x){ $name = $tags[ $y . '.jpg']; $multi = explode(',',$name); $count = count($multi); echo "<li> <a class='thumb' href='../images/Sections/pinkpanthers/" . $year . "/" . $sessions . "/" . $day . "/" . $y . ".jpg' title=''><img src='../images/Sections/pinkpanthers/" . $year . "/" . $sessions . "/" . $day . "/thumbs/" . $y . ".jpg ' /></a><div class='caption'><div class='download'><a href='../images/Sections/pinkpanthers/" . $year . "/" . $sessions . "/" . $day . "/big/" . $y . ".jpg ' target='_blank' />Download</a></div><div class='image-desc'>"; if ($count == 1){ echo "<a href='tag.php?tag=$name'" . $name . ">" . $name . "</a>"; } if ($count > 1){ $z = 0; $w = $count - 1; while ($z <= $w){ $p = $multi[$z]; echo "<a href='tag.php?tag=$p'" . $p . ">" . $p . "</a> "; $z++; } } echo "</div></div></li>"; $y ++ ; } ?>
  6. cmb

    array spliting

    How can I spilt this part of the array [15.jpg] => Callum,Grant So it looks like this or means the same thing [15.jpg] => Callum [15.jpg] => Grant
  7. how would i do this while part <?php $z = 0; $w = $count - 1; while ($z <= $w){ $p = $multi[$z]; $keys = "<a href='tag.php?tag=$p'" . $p . ">" . $p . "</a>"; $z++; } ?> because how i have it now it only shows 1 of the keywords not all of them
  8. how can i put an if statement inside an echo this is what i want to do <?php echo "<li> <a class='thumb' href='../images/Sections/pinkpanthers/" . $year . "/" . $sessions . "/" . $day . "/" . $y . ".jpg' title=''> <img src='../images/Sections/pinkpanthers/" . $year . "/" . $sessions . "/" . $day . "/thumbs/" . $y . ".jpg ' /></a><div class='caption'> <div class='download'><a href='../images/Sections/pinkpanthers/" . $year . "/" . $sessions . "/" . $day . "/big/" . $y . ".jpg ' target='_blank' />Download</a> </div><div class='image-desc'>" . if ($count == 1){echo "<a href='tag.php?tag=$name'" . $name . ">" . $name . "</a>";}if ($count > 1){$z = 0;$w = $count - 1;while ($z <= $w){$p = $multi[$z];echo "<a href='tag.php?tag=$p'" . $p . ">" . $p . "</a>";$z++;}} . "</div></div></li>"; ?> all the code works wright up until i added the if statements in the last little bit
  9. right now my array is set up so the title of the picture (which is a number) is the key and the keyword or words associated with that picture are the values separated by commas: Array( [1.jpg] => Tyler [10.jpg] => Callum [11.jpg] => Callum [12.jpg] => Adam [13.jpg] => Justin [14.jpg] => Shane [15.jpg] => Callum,Grant [16.jpg] => Justin [17.jpg] => Justin [18.jpg] => Austin [19.jpg] => Jarod [2.jpg] => Tyler [20.jpg] => Austin [21.jpg] => Tyler [22.jpg] => Justin [23.jpg] => Tyler [24.jpg] => Jarod [3.jpg] => Callum [4.jpg] => Shane,Callum [5.jpg] => Adin [6.jpg] => Justin [7.jpg] => Callum [8.jpg] => Adam [9.jpg] => Callum [25.jpg] => Jarod ) im using the galleriffic jquery photo album and in the description area for the picture it shows the keywords in a hyperlink to another page were it shows all the pictures with that keyword but what i want is for when their are multiple keywords i want them to show up as separate hyperlinks
  10. Im very sorry to have wasted your time you were correct with the password not matching in the update query thank you for your help
  11. Ya and it works i tried a INSERT INTO query instead of the UPDATE one and that didn't work either
  12. i echoed $session $email $pas $ip $password and $key and everything is coming out correctly
  13. no that wasn't it because when i did that it just gives me the password doesn't match the database error the + works
  14. I'm not shore what to do this update code isn't updating my database this is just the update code for my login mysql_query("UPDATE users SET session_id='$session' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add session ID to DB mysql_query("UPDATE users SET login_ip='$ip' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add login IP to DB and this is all of it <title>Log In</title><?php require('database.php'); //Include DB connection information if (isset($_POST['login'])) { //Execute the following if form is submitted $ip = mysql_real_escape_string($_SERVER["REMOTE_ADDR"]); //Geet user's IP Address $email = mysql_real_escape_string($_POST['email']); //Post email from form $password = mysql_real_escape_string(sha1(md5($_POST['pass']))); //Post password from form and encrypt if (empty($email) || empty($password)) { //Check for empty fields die("<b>Error:</b> All fields are required to be filled in."); } $check = mysql_query("SELECT * FROM users WHERE email = '$email'") or die(mysql_error()); $check2 = mysql_num_rows($check); if ($check2 == 0) { //Check if account exists die("<b>Error:</b> Email and password do not match the database."); } $row = mysql_fetch_array($check); $db_password = $row['password']+$row['key']; if ($password != $db_password) { //Check if password is correct die("<b>Error:</b> Email and password do not match the database."); } $allowed = $row['u']; if ($allowed != 1) { //Check if they have permission die("<b>Error:</b> You do not have permission to view this section."); } function randomstring($length = 10) { $validCharacters = "abcdefghijklmnopqrstuxyvwz1234567890"; $validCharNumber = strlen($validCharacters); $result = ""; for ($i = 0; $i < $length; $i++) { $index = mt_rand(0, $validCharNumber - 1); $result .= $validCharacters[$index]; } return $result; } $session = randomstring(); $key = $row['key']; $pas = $password . $key; mysql_query("UPDATE users SET session_id='$session' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add session ID to DB mysql_query("UPDATE users SET login_ip='$ip' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add login IP to DB $level = $row['accounttype']; $u = $row['u']; $fs = $row['fs']; $bc = $row['bc']; $fam = $row['fam']; $future = time() + 1209600; setcookie("uemail", $email, $future); //Set cookie containing username setcookie("sessionid", $session, $future); //Set cookie containging session ID setcookie("acounttype", $level, $future); setcookie("u", $u, $future); setcookie("fs", $fs, $future); setcookie("bc", $bc, $future); setcookie("fam", $fam, $future); ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// //header("Location: undefined.php"); //Redirect to members page } else { //If form is not submitted display the form echo<<<login <center> <h1>Log In To The Undefiend Section</h1> <h2>Or GO <a href="../main.php">Home</a></h2> <form method="post" action=""> Email: <input type="text" name="email"><br> Password: <input type="password" name="pass"><br> <input type="submit" name="login" value="Login"><br><br> </form></center> login; } ?>
×
×
  • 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.