-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Display error above the login forum help!
MadTechie replied to supergrame's topic in PHP Coding Help
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--> -
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
-
No Total_found is an alias of COUNT(*)
-
Try creating a html form and testing it, Also try really small files incase its a timeout problem
-
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.
-
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"); ?>
-
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)
-
Welcome, If this is solved please click topic solved (bottom left)
-
Display error above the login forum help!
MadTechie replied to supergrame's topic in PHP Coding Help
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 -
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
-
$output1 = preg_replace('%src="(.*?)/img%i', 'src="\1/thumb', $output1);
-
In case their was confusion my past post was referring to this comment
-
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
-
you may want to encode the quotes as well <?php echo htmlentities($username, ENT_QUOTES) ?> Whats the message your getting ?
-
Your need to html encode it, IE <?php echo htmlentities($username) ?>
-
Needs also close a parentheses EDIT: add a ) to the if
-
Pay Period end date:: is 22 characters, so changing the 20 to 25 will add 3 dots
-
If you need more dots then increase it more
-
Ahhh.. okay.. personally (when possible) I try to keep it to the boards as anyone search will also get the solution,
-
Nothing wrong with it at all! can you post the lines around it, from 3 lines before to 3 lines after
-
$message_output .= str_pad(str_replace ( "_", " ", ucfirst ( $key ) ). ": ", 20,".")." ".build_message ( $value ) . PHP_EOL . PHP_EOL; added ." ". also notice up'ed it to 20
-
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)