Jump to content

Niixie

Members
  • Posts

    108
  • Joined

  • Last visited

    Never

Everything posted by Niixie

  1. Try the following: <html> <head> <title>corners in running</title> </head> <body> <form method="post" action="<?php echo $PHP_SELF."?post";?>"> Corners:<br /> 10:<input type="radio" value="10" name="wholecorners"> 11:<input type="radio" value="11" name="wholecorners"><br /> <input type="submit" value="submit" name="submit"> </form> <?php if($_POST['submit'] && isset($_GET['post'])) { $corners = $_POST["wholecorners"]; if($corners>=10 && $corners<=10.99) {header('Location: http://maidenerleghweather.com/corners1.php?var1=' . $corners. '&var2='.$time ); } if($corners>=11 && $corners<=11.99) {header('Location: http://maidenerleghweather.com/corners2.php?var1=' . $corners. '&var2='.$time ); } } ?> Code is not tested! It should, if i remember right, only redirect you if the submit button has been activated, and extra secure by setting a ?post in the URL.
  2. Can a missing doctype really change the look in only two browsers?
  3. Hey PHPFreaks. I know that theres some special rules needed to make IE output look 100% as expected, mine doesn't. I have a little problem. Easiest way, www.ksites.sonderhede.dk . When opened in IE or Opera, it looks all wrong? - Thanks in advance.
  4. In the function prologin() you use the login function to validate if the user exists (fine). In the login() function you do not return any value thats useable for the prologin() function. Try returning 0 or 1 in the login() function, if the user exists or not.
  5. Can you send your full code with database connection and query, it'll be easier to picture what happens then.
  6. The system should return the value thats equal to the value from the database?
  7. This is my function as it is now, when i changed it for about 15 minutes ago. public function system($select) { Connection::Open(); $q = "select $select from system"; $result = mysql_query($q) or die(mysql_error()); if(!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $q; die($message); } while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $row[$select]; } Connection::Close(); } Still problematic.
  8. If you look at picture proof 1 in the very first post, then you can see that the numbers returns first 2 then 1. And the last problem i wrote, about nothing returning, is because of the function system that does not return anything, or it doesn't return the correct thing.
  9. I am in no doubt that your code may be faster, or better than mine but it does not really help when i have absolutely no idea of whats going on in the code?
  10. I found out that the returning number "1" is caused by the function mysql::system that i made; Old code ... Its the "return 1;" part, i need to replace the "mysql_fetch_row" with something else, what could handle it? EDIT: My fault, the function did not cause the number "1". For some reason it does not return anything when i changed the system function code? New code: Connection::Open(); $q = "select $select from system"; $result = mysql_query($q) or die(mysql_error()); if(!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $q; die($message); } while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $row[$select]; } Connection::Close();
  11. The hole code of my function is this: public function load_trades($sort) { Connection::Open(); if($sort == "*") { $q = "select * from itrades where active=1"; $result = mysql_query($q) or die(mysql_error()); if(!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $q; die($message); } echo '<table class="area" border="0"> <thead> <tr> <th>Annonce</th> <th>Dato</th> <th colspan="2">Opretter</th> <th>Læst</th> <th>Besvaret</th> </tr> </thead> <tbody>'; while($array = mysql_fetch_assoc($result)) { echo ' <tr> <td class="headline"><a href=trade.php?show='.$array['tradeid'].'>'.$array['headline'].'</a></td> <td class="date">'.$array['date'].'</td> <td class="picture"><a href="profile.php?show='.$array['itraderid'].'"><img src="images/profile/'.user::get_picture(user::get_email($array['itraderid'])).'" width="33" height="32"/></a></td> <td class="name"><a href="profile.php?show='.$array['itraderid'].'">'.user::get_name(user::get_email($array['itraderid'])).'</a></td> <td class="read">'.$array['read'].'</td> <td class="counter">'.itrade::count_messages($array['tradeid']).'</td> </tr> '; } echo '</tbody> </table>'; } else if($sort !== "*" && is_numeric($sort)) { $q = "SELECT * FROM itrades WHERE active = 1 ORDER BY RAND() LIMIT $sort"; $result = mysql_query($q) or die(mysql_error()); if(!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $q; die($message); } echo '<h3>Kørende I-Trades</h3> <dl class="list1">'; while($array = mysql_fetch_assoc($result)) { echo ' <dt>'.user::get_name(user::get_email($array['itraderid'])).'</dt> <dd> <p><i>'.$array['date'].'</i><br /><strong>'.$array['headline'].'</strong><br />'.$array['shortdis'].'</p> <a href="trade.php?show='.$array['tradeid'].'" class="link1">Se Trade</a> </dd>'; } echo '</dl>'; } mysql_free_result($result); return 1; Connection::Close(); } But it only counts from the else if part.
  12. Hello PHP people. I have a problem with my php function, which i hope is a small problem. When i get the result of my function, the numbers "1" and "2" appear, the number "2" above the area, and the number "1" under the area. Picture proof. What i don't get, is where the numbers are coming from, because when i check the database, there is only one row with the numbers "1" and "2", but the numbers appear no matter which row i return. Heres a piece of my code, I hope that you can see the problem somewhere? $q = "SELECT * FROM itrades WHERE active = 1 ORDER BY RAND() LIMIT $sort"; $result = mysql_query($q) or die(mysql_error()); if(!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $q; die($message); } echo '<h3>Kørende I-Trades</h3> <dl class="list1">'; while($array = mysql_fetch_assoc($result)) { echo ' <dt>'.user::get_name(user::get_email($array['itraderid'])).'</dt> <dd> <p><i>'.$array['date'].'</i><br /><strong>'.$array['headline'].'</strong><br />'.$array['shortdis'].'</p> <a href="#" class="link1">Se Trade</a> </dd>'; } echo '</dl>'; And, if you're wondering, then the numbers appear before and after the function result. Picture proof. Thanks in advance! Niixie
  13. i ran this code UPDATE `itrades` SET `shortdis`="æøå" WHERE `tradeid` = 2; but still the same errors?
  14. I set all tables in the database to utf8_danish_ci, manually, still nothing. I have this in all the pages that has the <head> tags; <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Nothings wrong there, as i can see?
  15. I tried them both now, none of them fixes the problem? :s
  16. Hey PHPFreaks! I have some problems with the charset on my site, i don't know if it's the MySQL databases charset or the webpages charset thats wrong, my bet is the database. When i see the text on the page, it loads like this; Dell b�rbar S�lger min Dell, da jeg har k�bt en anden (EDIT: The &#######; is the questionmarks) The questionmarks was supposed to be either 'æ', 'ø', or 'å', but when i write in the PHP document, under the MySQL processed text, it's all fine? How can i change the charset on the MySQL database, so it's alright for special danish characters? Thanks in advance Niixie
  17. I added the "// <--" manually when i copied it to here. Can you explain what you are doing there? EDIT: I found a way myself, thank you very much for helping me anyways!
  18. Yes, the value from 'show' is '1', but no value is returned into the hidden field.
  19. Hey all, i have a little problem. I have a form, and when submitting, i need to use the ID that i put in the $_GET array earlier. When you're entering my site, and clicks a certain link, the $_GET will store show=1, and when you're submitting the form on the page, the value of 'show' is needed on the redirect page.. I thought that it would be smart to transfer it with a hidden textfield, but somehow it fails? <form id="comment-form" action="comment_profile.php" method="POST"> <fieldset> <div class="field"> <textarea name="comment-field" rows="2" cols="66"></textarea> <input type="hidden" name="pofileid-field" value="<?php echo $_GET['show']; ?>" /> // <--- Here is the hidden field. <input type="submit" name="submit-field" class="submit" value=""/><i> (HTML tags kan bruges)</i> </div> </fieldset> </form> Above you can see a piece of my code, and i marked the hidden field aswell. What i do not understand is, why isn't the hidden fields value return the value of show when i check in comment_profile.php, as that is where it returns? Thanks in advance -Niixie
  20. Hey, i have a small problem with the logout part of my account system. When i click the logout link, it directs me to the index page with an error (custom error stuff i made). Heres my logout code <?php echo 'Behandler ...<br />'; if(isset($_SESSION['logged']) && isset($_SESSION['email']) && $_SESSION['logged'] == 1) { echo 'Logger ud, vent venligst...'; unset($_SESSION['logged']); unset($_SESSION['email']); header('location: index.php?p=success&ploca=login&pid=1'); exit(); } else { header('location: index.php?p=error&ploca=login&pid=5'); // This is where it jumps to directly. exit(); } ?> The weird thing is, that the sessions email and logged is set, as you can see here; //Printed with print_r($_SESSION); Array ( [psite] => index [logged] => 1 [email] => a@b.c ) Anyone sees my problem?
  21. Even if I add method="POST" in the form, it doesn't work. This is my form <form action="login_attempt.php" id="login-form" method="POST"> <fieldset> <div class="field"> <label>Email-addresse<br /></label> <input type="text" class="text" value="" name="loginname"/><br /> <label>Adgangskode</label> <input type="password" class="text" value="" name="loginpass"/><br /> <input type="submit" value="" class="submit" name="loginsubmit"/><a href="register.php"><img style="margin-top:5px;margin-left:5px;" src="images/opret-bruger.gif" width="70" height="16" alt="opret-bruger"/></a> </div> </fieldset> </form> And heres all my login_attempt.php session_start(); $e = $_POST['loginname']; $p = $_POST['loginpass']; $s = $_POST['submit']; if(!$s) { header('location: login.php?p=error&ploca=login&pid=0'); // This is what it returns all the time. exit(); } if(empty($e) || empty($p)) { header('location: login.php?p=error&ploca=login&pid=1'); exit(); } if(!validate::email($e)) { header('location: login.php?p=error&ploca=login&pid=2'); exit(); } if(mysql::is_registered($e)) { mysql::login($e, $p); } I can't see whats wrong?
  22. I made some changes to the code snippet, and debugged it. This is the code. include "sources/php/class.php"; $e = $_POST['loginname']; $p = $_POST['loginpass']; $s = $_POST['submit']; if(empty($e) && empty($p)) { echo "Display form"; exit(); } else{ echo "process form data"; exit(); } if(!$s) { header('location: '.$_SESSION['psite'].'.php?p=error&ploca=login&pid=0'); $_SESSION['debug'] = 1; exit(); } And this is the result Undefined loginname undefined loginpass undefined submit
  23. I do not see the 'here' anywhere, thats the weird thing? My form <form action="login_attempt.php" id="login-form"> <fieldset> <div class="field"> <label>Email-addresse<br /></label> <input type="text" class="text" value="" name="loginname"/><br /> <label>Adgangskode</label> <input type="password" class="text" value="" name="loginpass"/><br /> <input type='hidden' name='submit2' /> <input type="submit" value="" class="submit" name="submit"/> </div> </fieldset> </form>
×
×
  • 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.