Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. okay here's a sample you can try, I cleaned it up a little, and added some more comments and it works (username='bob') <?php //init error message $error =""; //Check to see if the form as been posted if(isset($_POST['Send'])) { //Check username if($_POST['username'] == "bob") { header("Location: profile.php"); //redirect to profile.php exit(); }else{ //Username is incorrect //assign message for error $error ="Unknown user"; } } ?> Please Login:~ <!-- form --> <form action="" method="POST"> <input type="text" name="username" /> <input type="submit" name="Send" value="Login" /> </form> Blar Blar Blar Blar Blar <br /> <?php if(!empty($error)){ ?> <div clas="error"> <B><?php echo $error; ?></B> </div> <?php } ?> <br /> la la la la la la la la la la la <!--more HTML stuff here-->
  2. first off i skimmed the post (so i maybe way off track but from your form) the code would be more like this <?php $path="images/gallery/slideshow/"; //path of images if(is_dir($path)){ foreach($_REQUEST['chkFiles'] as $file){ if(file_exists($path.$file)) unlink($file); } } } echo"File Deleted" ?>
  3. While selecting files individually in HTML is a pain you could create many file inputs as an array (you could also do this in AS3) and then update the PHP code to upload via a loop, this will save the constant opening an closing of the FTP connection, PS i can't see any PHP problems, what about checking apache's error logs
  4. No Total_found is an alias of COUNT(*)
  5. Try creating a html form and testing it, Also try really small files incase its a timeout problem
  6. HUH!.. No matter how many times I read that it makes no sense! the link you supplied is a image.. thus its very unlikely that an image will contain html image paths! ~OR~ Why would you need to find the path of something that you only have the path to! The code you have accepts a URL that points to a html page, it then scrape all the image paths.. So update $masa="http://www.site.com/number/someting.html"; with the path of the page you wish to get the image paths from.
  7. Try this <?php session_start(); //clear session $_SESSION = array(); //set cookie to expire if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-86400, '/'); } //finally destroy session_destroy(); //redirect header("location: loggedout.html"); ?>
  8. jonsjava code should do that fine, however to save confusion remove this line $insert = mysql_query("INSERT INTO comments(`id`,`user_id`,`comment`,`created_at`) VALUES(0,".$_SESSION['logged_id'].",'".$comment."','".time()."')"); as its not used Try clearing all comments from a user in your database and re-testing (or create a new user)
  9. LOL, well you found it.. that's the main thing
  10. Welcome, If this is solved please click topic solved (bottom left)
  11. Personally i would have the PHP file include the HTML file, but at the start i would check to see if the form was posted, if it was then run the checks.. that way you can just echo the messages here's a very rough example (untested) <?php $error =""; if(isset($_POST['Send'])) { //check $_POST['username'] if($_POST['username'] == "bob") { header("Location: profile.php"); //redirect to profile.php exit(); }else{ $error ="Unknown user"; } } ?> <!--HTML stuff starts here--> <?php if(!empty($error)){ ?> <div clas="error"> <?php echo $error; ?> </div> <?php } ?><!--more HTML stuff here--> EDIT: oops noticed a few typos
  12. Maybe read the comment // here you add code to let user know incorrect code entered maybe add header("Location: fraserwoodhotelrate.php"); exit(); instead of leaving it blank
  13. I'm sure they do appear in source, you probably have echo "." in a loop some where
  14. $output1 = preg_replace('%src="(.*?)/img%i', 'src="\1/thumb', $output1);
  15. In case their was confusion my past post was referring to this comment
  16. I don't see any harm with not encoding ; \ ? or = you could of course wipe them out ie <?php echo htmlentities(preg_replace('/[;\\\\?=]/sm', '', $username), ENT_QUOTES); ?> but that's a little OTT
  17. you may want to encode the quotes as well <?php echo htmlentities($username, ENT_QUOTES) ?> Whats the message your getting ?
  18. Your need to html encode it, IE <?php echo htmlentities($username) ?>
  19. Needs also close a parentheses EDIT: add a ) to the if
  20. Pay Period end date:: is 22 characters, so changing the 20 to 25 will add 3 dots
  21. If you need more dots then increase it more
  22. Ahhh.. okay.. personally (when possible) I try to keep it to the boards as anyone search will also get the solution,
  23. Nothing wrong with it at all! can you post the lines around it, from 3 lines before to 3 lines after
  24. $message_output .= str_pad(str_replace ( "_", " ", ucfirst ( $key ) ). ": ", 20,".")." ".build_message ( $value ) . PHP_EOL . PHP_EOL; added ." ". also notice up'ed it to 20
  25. I have to agree with MatthewJ, Unless someone can tell me why I must add adding a database driven CMS to a single page website with interactive a flash movie... of course theirs benefits to adding it but theirs benefits to not adding it. simply put, if you have a HTML website that doesn't support any programming languages then its going to be cheaper, But lets add some PHP.. now you need to worry about apache and PHP (if one breaks your site goes down).. also we need to look closer and security.. okay now add MySQL.. now you need to worry about apache, PHP and MySQL (if one breaks your site goes down).. also we need to look even closer and security... lets add SQL injection to the mix.. Also you don't need to use a framework (of course theirs benefits to using them) you could create a simple PHP script that echo's the results from a SQL table (like in keldorn post)
×
×
  • 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.