Jump to content

oni-kun

Members
  • Posts

    1,984
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by oni-kun

  1. You can use sleep, but you must use flush and ob_flush with it I believe.. look at sleep's examples and there should be a tutorial on using the output buffer to sleep, and THEN display the buffer for the next part. EDIT: I found my working code! Try something with this.. if (ob_get_level() == 0) ob_start(); echo "I am the first"; echo str_pad('',4096)."\n"; ob_flush(); flush(); sleep(3); echo "I am the second, 3s later."; echo str_pad('',4096)."\n"; ob_flush(); flush(); sleep(3); ob_end_flush();
  2. Yes, $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); Is the example on php.net of mail, Your server may be doing something to it.. You can remove the \r and try, it might be a problem with your webserver's SMTP.
  3. First look at this web page here, I was wanting to do the same thing and I was able to. http://www.xentrik.net/php/flatfile.php I wrote functions to read/write the page, it very successfully appends and reads the users as arrays, with any extra data as needed.
  4. Use the header() function to go to.. ManageProjects.php?deleteid=1&deleted=true. If delete=true is there, then it should display 'record 1 deleted' instead of deleting the record, very simple to do with IF's and GET's. You have to place: <?php ob_start(); //at top //your code.. if (isset($_GET['deleted'])) { echo "Record ".$_GET['deleteid']." has been deleted!" } else { //delete record header(bla..&deleted=true); } at the top of your page, right after the <?php to be able to header if that's what you like, since the output buffer would stop you otherwise and throw an error.
  5. Well yeah, it'd be better to have $_GET's set up so you can view all the documents the way you wanted.. viewpdf.php?pdf=foo viewpdf.php?pdf=foo&fullscreen=true.. All you need is that one page, and simple $_GET and if statements to echo the <object> codes for each one.. no passing.. no ugly writing etc.. you can even go as simple as.. <object embed=".$_GET['pdf']." fullscreen=".$_GET['fullscreen']."> etc..
  6. Well what you're trying to do is this? die() exits the page, thus preventing the form from finishing etc. I'd recommend just doing this.. //Form code here... {<form>} if (!$resp->is_valid) { echo '<p class="response" style="height: 1px">'.$output.'</p>'; } else { echo 'Correct.'; //do something if captcha was correct! } Take out the previous 'if' from the captcha code, and place this new one wherever you wish for the error to be displayed, if that's what you wanted.
  7. Well first if I were you, I'd open up your text editor and replace all the single quotes with double quotes, and nest it all in single quotes. If you're wanting to 'pass' it along with an url, then use urlencode functions naturally, to convert space to %20 etc and urldecode if needed. Edit: 'href='http://SERVER PATH/link_fullView.php?link=$link', you're trying to link the object code? huh? That's one of the most messiest things i've ever seen. Make it.. link=vid1_full.. and if isset($_GET['link']){ if ($_GET['link']=='vid1_full') { echo '<object...>....'; } }
  8. Well yes, you'd write something like this.. so if they were sent to.. contact_us.php?sent=success it'd say.. if (isset($_GET['sent'])){ if ($_GET['sent']=="success") { echo "Message sent successfully!"; } else { echo "Message failed, please check your boxes"; } } Or something of the sort..
  9. You ARE asking in a php help section, I assumed you should be using php for that, lol. But yes, PHP is basically the only proper way you can list 'hello username' and list info about the forums etc, in the end it's all dynamic and not static.
  10. For safety of someone injecting queries into your database, you must always use precautions such as mysql_real_escape_string. This will make 'can't' into 'can\'t', the extra slash 'escaping' the single quote so it won't mess with your query.
  11. I'm not sure why you're doing it like this is all, If you're using php than stick with php to include all your menus /headers etc. If it's all PHP then apache would have to do less work and create less handles, making the site more optimal. PHP's include() function is faster as it compiles as well, it's no use using SSI's
  12. <!--#include FILE="sidebar.html" --> That code is an SSI, or server side include, and has nothing to do with PHP. It functions the same as php's <?php include('sidebar.html'); ?> so i'd recommend using that.. But other than that, it looks alright, I just wouldn't want to mix php with SSI with the chance of some problem happening..
  13. PHP will display the form, and when you hit submit it will place your 'Successful!'/'Failure!' message injected where the form was supposed to be, look at your HTML after submitting and you'd see it's doubled from each one.. I'd recommend header();ing to contact_us.php?submitted=true or similar, and that would cause the form not to exist, and the 'sent/fail' message to be there in place.
  14. This is what I do.. include(header.php); include(menu.php); include(sidebar.php); CONTENT include(footer.php); Just get whatever HTML you're using to display the sidebar, cut it out, put it in sidebar.php for example and link it with php's include where it was supposed to be, problem solved.
  15. I can't be assed to check if that declaration is right, but there is less than a 1% chance that is your problem. Go make sure it's exact, or look through your code, the browser does NOT set text color based on declaration of doctype.
  16. I'm so tired $_POST['attack']=="Flee" If it is not executing that, even though you said for it to, echo every step of the way what the values of $_POST['attack'] are so you can pin down why it is not displaying.
  17. http://us2.php.net/manual/en/control-structures.elseif.php The example says it won't even compile, nevermind then.
  18. They are serialized, to be placed into a database. The numbers generally depict the length of each string's variable.. You'd have to use unserialize to view it in an array or whatever it was stored in.
  19. Your syntax is wrong for the first part, 'else if' should be 'elseif', it should've thrown an error if it got to that. else if($_POST['attack']=="Flee"){ Should be: elseif($_POST['attack']=="Flee"){ Other than that there shouldn't be much of a reason from the code you provided that it doesn't work.
  20. default.php will have the form, with action=form.php. Form.php will have something like this: if isset($_POST['Laske']) { mail(.....); echo "E-mail sent!";// or use header(); to redirect } 'action=form.php': The action of the form, is to send POST data to form.php, if that makes more sense to you.
  21. Something like this? <?php if (!$_SESSION['MM_Username']) { echo 'You need to log in first!'; //If no session, not logged in } else { echo "<form> yeah! </form>"; //If logged in } ?> That'll check to see if the session contains a username, and if the user is logged in, elsewise display nothing or you can header() to a login page.
  22. Why can't you just separate it yourself? <div> <form method="post" style="margin: 0px;" action="form.php"> <div style="float: left;">X: </div> <div style="float: left;"> <input type="text" name="leveys" size="5"> </div> <div style="float: left;">Y: </div> <div style="float: left;"> <input type="text" name="korkeus" size="5"> </div> <input type="submit" name="button" id="button" value="Laske" /> </form> </div> Note I added 'action=form.php' so it'll POST to form.php (ie. your php code) and you can access it through $_POST['value'] (such as Laske)
  23. It's not valid because you're using commas within parentheses '()'. It'd take a lot of wasted time to write a custom 'echo', as echo is a language construct, not a function. You must use periods to concatinate in brackets. echo('this'. 'is'. 'a'. 'test'); If you're wanting to echo something delimited by commas, then replace them accordingly.
  24. If you're asking why there's no subfolder, than you or whoever wrote the script (HTML wise for the image, or PHP that is displaying it) did not point to the correct place. The href="" is pointing to /vermont/, shouldn't you just change it?
  25. Well this will get options=ANYTHING $option = $_GET['options'] If you're wanting to extract XXX=XXX&YYY=ZZZ, without knowing the names.. http://us3.php.net/manual/en/reserved.variables.server.php Look there for one of the variables that lists the query string.. you can use regex or explode to extract the GET's..
×
×
  • 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.