Jump to content

rxgvhqkrywq6cxdjoar

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by rxgvhqkrywq6cxdjoar

  1. I had no idea what Daniel was referring to until you enlightened me. Thanks all. Over and Out. rx
  2. salathe another great solution that solves my problem. thanks all.
  3. freakstyle, you are a saint. thank you so much!
  4. Hey everyone, PHP is not co-operating today! I'm having issues creating new lines... This is my code: <?php $a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z')); print_r ($a); echo "first line". "\n"; echo "second line\n"; echo "third line \n"; echo "..."; ?> The expected output is: Array ( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ) ) first line second line third line ... The actual output is: Array ( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ) ) first line second line third line ... Which is hardly readable when using large arrays! Any help us much appreciated Thanks in advance!
  5. Thanks so much cags and asmith, I have got my site working now thanks to both of you. asmith, i'm now using the index page you have supplied - and I have read over it and understood why we must do it this way. got it - all logic must be performed (especially headers) before any output is to be displayed. thanks all - this issue has been marked as resolved!
  6. Hey folks, A quick question regarding headers and stuff... I'm getting the following error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/i_betcha_wanna_know/public_html/index.php:5) in /home/i_betcha_wanna_know/public_html/phpfunctions/sitewidefunctions.php on line 3 I read a lot of articles online about this error, and found a couple closed topics about it here on phpfreaks - but these topics do not suffice to answer my questions. My code is below... I've echoed out the first 10 lines or so rather than straight HTML because I read somewhere online that the first thing that should always appear in your .php pages is a <?php tag, and it should always end it with a ?>, with no white space above or below. I can recall getting other errors if this was not the case. After reading several other resources online, it appears that I must somehow call the session information before anything is sent to the browser. Do echoes count as something sent to the browser? This code works perfectly on my localhost WAMPserver, when I upload it to my web host however, I start getting all these retarded errors. How could I possibly extract the session information out of this log in page - it's embedded deep down in a few if statements, for loops, etc. session_start() is located at the very top of the sitewidefunctions.php function library I have created. The sitewidefunctions.php page is referenced in all pages that will either need sessions, or any other complex functions that specific page would need. For example, getmainlinksfade(), as shown below is located in this library. <?php echo " <html> <head> <title>TITLE</title> <link rel='stylesheet' type='text/css' href='CSS/global.css'/> <script type='text/javascript' src='JS/util-functions.js'></script> <script type='text/javascript' src='JS/clear-default-text.js'></script> </head> <body> <div id='wrap'> <div id='content'> <div class='maintitle'>TITLE</div>"; error_reporting(E_ALL & ~E_NOTICE); include "phpfunctions/sitewidefunctions.php"; include "phpfunctions/uniquevisitorcounter.php"; if(loggedin()) { header("Location: home.php"); exit(); } getmainlinksfade(); getsubtitlefade('Books'); getbooksfade('copyright'); $username = $_POST['username']; $password = $_POST['password']; $rememberme = $_POST['rememberme']; if($username&&$password) { $qry = mysql_query("SELECT * FROM users WHERE username='$username'"); if(mysql_num_rows($qry)==0) echo "<div id='index_errorlogin'> No user found <br/></div>"; else { while($row = mysql_fetch_assoc($qry)) { $db_password = $row['password']; if(md5($password)==$db_password) { $loginok=TRUE; mysql_query("UPDATE users SET isOnline=1 WHERE username='$username'"); } else { $loginok=FALSE; echo "<div id='index_errorlogin'>$username found! - Incorrect password <br/></div>"; break; } if($loginok==TRUE) { if($rememberme=='on') { setcookie("username", $username, time() + 7200); $_SESSION['username']=$username; } else $_SESSION['username']=$username; header("Location: home.php"); exit(); } else die(""); } } } else echo "<div id='index_errorlogin'>To view the entire library - Please log into the system below<br/></div>"; echo" <div id='index_form'> <form action='index.php' method='post'> <input type='text' name='username' value='username' class='cleardefault'><br/> <input type='password' name='password' class='cleardefault'><br/> <input type='checkbox' name='rememberme'><span id='index_rememberme'>Remember Me</span> <input type='submit' name='login' value='Login' id='index_login'> </form> </div> <br/><br/>"; getindexstats(); getfooter(); echo" </div> </div> </body> </html>"; ?> Can someone point me in the right direction? Alex from PHPAcademy uses this log-in technique - I watched his videos on Youtube and embedded his logic into my page. Again, this works perfectly on my WAMP! I know my question is kind of vague but any help is appreciated. Thanks and Cheers! rxgvhqkrywq6cxdjoar
  7. Hello Crayon, Since PHP is server side, and Javascript is client side - how do you propose I send data from one to the other? Must I POST the data? Please provide an example. Cheers & Thanks for your help. JA
  8. Hello folks, I just joined the forums - looks like quite a valuable resource here. I'm having trouble with some html/php I just wrote...this is an extremely strange bug - hoping someone can shed some light. I have this code: if($sequence == 1) return "<a href='".movedown($sequence)."'><img src='down_arrow.gif'></a>"; Which in english translates to: if the sequence variable (pulled from the database) is equal to one, show a image called down_arrow and make that image link to a php function called movedown. Problem is... the movedown function is firing on page refreshes (it's not waiting for me to click it). Inside of the movedown function, there is an SQL statement that increments the sequence in the database. Good news is, that the function works, bad news is - it's incrementing without me clicking the down_arrow image! Any ideas? Thanks all, JA
×
×
  • 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.