Jump to content

ShaunO

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Everything posted by ShaunO

  1. What is the echo actually outputting?
  2. echo '<img src="stackm.jpg" id="Image2" alt="test!" onmouseover="ChgText($number); MM_swapImage(\'Image2\',\'\',\'stackmrollover1.jpg\',1);" onmouseout="MM_swapImgRestore()" />'; Basically you're having to do multiple escaping, because you are dealing with multiple parsers. First you have PHP parsing the code so anything in between [echo " "] that contains a " has to be escaped like \" - hence we have echo "<img src=\"...jpg\">"; - however if we use single quotes we only have to escape single quotes rather than double quote and because we need double quotes more in the HTML it's easier to just start with single quotes. The reason the code doesn't work with all single quotes within the double quotes is because in the HTML you are beginning a javascript block with single quotes and using unescaped single quotes within it.
  3. SELECT * FROM genres g INNER JOIN genrelinkcd gl ON g.genre_id = gl.genre_id WHERE g.moj_genre = '$row' Is that what you're after?
  4. What is the full absolute URL that you are typing into the web browser?
  5. Personally I would code it like this; <?php $filename = substr($_SERVER["SCRIPT_FILENAME"], strrpos($_SERVER["SCRIPT_FILENAME"], "/") + 1); switch($filename) { case "index.php": echo "Plague Infected | Index"; break; case "contact.php": echo "Plague Infected | Contact"; break; case "portfolio.php": echo "Plague Infected | Portfolio"; break; default: echo "Plague Infected Designs | Freelance art and web design and development in Fort Worth TX and Puerto Rico"; break; } ?> But that's just me anyway.
  6. UPDATE is to update an already existing row(s) in a database table INSERT is to create a new row(s) in a database table Should be easy to figure out what you need based on what the two different functions actually do.
  7. A client side solution would be to assign the overflow-x: scroll property to the container of the text and setting a fixed width but otherwise the regex solution above ^^ should cause the words to wrap properly.
  8. Suppose I would do it like this. $query = "SELECT * FROM tbl order by ID ASC"; $result = mysql_query($query) or die(mysql_error()); $lastChapter = ""; while($row = mysql_fetch_array($result)) { if($row['Chapter'] != $lastChapter) { $lastChapter = $row['Chapter']; echo "<br />" . $lastChapter . "<br />"; } echo "<br />" . $row['id'] . " - " . $row['Name'] . " - " . $row['Description'] . "<br />"; }
  9. file_get_contents($file) -- the $file is only giving you the actual filename, you need to add the file directory as it is located on the server before it, like file_get_contents($path . $file)
  10. It's because you're calling this: $register->define_inputs(); Without having any values in $_POST You need to make a form and post the values
  11. You want to be looking at the file_get_contents() function - you are on the right track though.
  12. It's basically an interface for web servers/applications to have a way to talk to PHP and execute code. PHP has an apache module so it doesn't need to use it but for example lighttpd uses FastCGI to talk to PHP.
  13. Sweet, just check the casing on the 'submit' is still just like that as well.
  14. Oh I see the problem. Basically your if/else nesting is wrong. You're showing the error message when the submit button has not been pressed, rather than if the login has failed. This should work. <?php include_once('functions.php'); if(isset($_POST['submit'])){ $username = protect($_POST['user']); $password = protect(encrypt($_POST['password'])); $query = "SELECT username, password AND u_LV FROM user WHERE username ='$username' , password = '$password' AND u_lv BETWEEN 1 AND 6"; $result = mysql_query($query)or die("Error, please contact staff. $bugE"); if(mysql_num_rows($result)>0){ $r=mysql_fetch_array($result);//Fetch arrays $login_username=$r["username"];//Make $login_username = to there username session_register("login_username");//Register a session Header("Location: logged_in.php"); } else { //Failed login, give error message. echo "<div align=center><b>Oops! Your login is wrong. Please click back and try again.</b></div>"; } } close()//Close Database ?>
  15. That's bizarre, on the first page load that should never be set. So even if you close the browser, go back into, ctrl+refresh/shift+refresh to clear cache, it still has the error message?
  16. It's this line: header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/loggedin.php"); The dirname function is adding the extranous slash on the end, why not just use this? header ("Location: ./loggedin.php");
  17. IF OBJECT_ID('Users') IS NOT NULL TRUNCATE TABLE `Users`
  18. How about you guys just stop bickering about an endless argument and realise the question at hand. How to get the last reboot time on Windows using PHP..
  19. Here's a fun one that I just made up now. $lastRebootDate = exec("net statistics workstation | find /i \"Statistics since\""); $lastRebootDate = str_replace("Statistics since ", "", $lastRebootDate); echo $lastRebootDate;
  20. Take a look at the number_format() function This will do what you need
  21. Maybe bin2hex() does what you need?
  22. Yep, that makes sense, it wont really matter where the files are stored in that case. Don't get caught up in the hype of storing file binary data in databases, in most general cases it is not necessary. To begin, look into the move_uploaded_file() function and that should give you a lot of hints and tips to start a basic upload script. I'm sure others here can share some wisdom
  23. He is right. You can't put a php header redirect right there.. what happens is when PHP checks the code first, it doesnt care about the JavaScript and will just run the code You will need to use a JavaScript redirect (window.location)
  24. Only if the images aren't meant to be public Actually if you are using apache you can use a .htaccess file to disallow viewing of them It's just something you need to be mindful about as you create the script
×
×
  • 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.