chriscloyd Posted December 8, 2008 Share Posted December 8, 2008 I'm have made a login script and now i have to process it i was trying to make it count to 10 like example Checking Admin 1 . 2 . 3 . 4 . 5 . 6 . 7 . 8 . 9 . 10 any one know how to actually make the numbers pop up while its counting to 10? Link to comment https://forums.phpfreaks.com/topic/136136-count/ Share on other sites More sharing options...
DeanWhitehouse Posted December 8, 2008 Share Posted December 8, 2008 Javascript Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-709987 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 theres a way in php i dont live javascript Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-709990 Share on other sites More sharing options...
flyhoney Posted December 8, 2008 Share Posted December 8, 2008 You could use flush() to flush the output buffer as you count. This isn't super classy or reliable and would make the login logic 10 times crazier <?php for ($x = 0; $x < 100; $x++) { echo $x; flush(); } ?> Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-709991 Share on other sites More sharing options...
genericnumber1 Posted December 8, 2008 Share Posted December 8, 2008 Code? Pretty much the only way you can output mid-execution like that in php is with flush(), otherwise you'd need javascript. edit: and nice ender's game quote poster above me Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-709996 Share on other sites More sharing options...
DeanWhitehouse Posted December 8, 2008 Share Posted December 8, 2008 there's a way in php i don't live javascript Nope, not without the page reloading, or using AJAX or it will just show 1 2 3 4 5 6 7 8 9 10 all at once. Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-709997 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 did that it just pops it up right away Checking Admin ...1...2...3...4...5...6...7...8...9... Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-709999 Share on other sites More sharing options...
flyhoney Posted December 8, 2008 Share Posted December 8, 2008 You are better off just displaying a loading gif. What you are asking to do requires javascript. Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710002 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 nope i got it <?php echo 'Checking Admin ...'; ob_start(); for($i=1;$i<11;$i++) { if ($i == 10) { echo $i; } else { echo $i.'...'; } ob_flush(); flush(); usleep(900000); } ?> Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710004 Share on other sites More sharing options...
flyhoney Posted December 8, 2008 Share Posted December 8, 2008 But what does this accomplish? You are forcing the user to wait? Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710007 Share on other sites More sharing options...
DeanWhitehouse Posted December 8, 2008 Share Posted December 8, 2008 Not bad, but not good! It would be better to use javascript or AJAX to show a real time loading Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710008 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 its just me that waiting its for a blog Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710009 Share on other sites More sharing options...
DeanWhitehouse Posted December 8, 2008 Share Posted December 8, 2008 Might sound random, but why?? Why are you forcing yourself to wait? Doesn't make any sense. Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710011 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 im not im making it check right now just testing crap out having fun im a patient person Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710013 Share on other sites More sharing options...
flyhoney Posted December 8, 2008 Share Posted December 8, 2008 im a patient person Just made my day. Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710018 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 opps lol didnt see that wow i guess i cant spell either ROFL Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710023 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 opps lol didnt see that wow i guess i cant spell either ROFL Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710027 Share on other sites More sharing options...
chriscloyd Posted December 8, 2008 Author Share Posted December 8, 2008 <?php echo 'Checking Admin '; ob_start(); for($i=1;$i<6;$i++) { echo $i.' '; if ($i == 1) { $check_user = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."' "); } if ($i == 2) { $num_users = mysql_num_rows($check_user); if ($num_users > 0) { $error = 0; } else { $error = 1; } } if ($i == 3) { if ($error == 0) { $check_user2 = mysql_fetch_assoc($check_user); } } if ($i == 4) { if ($error == 0) { if ($check_user2['password'] == md5($_POST['password'])) { $error = 0; } else { $error = 1; } } } if ($i == 5) { if($error == 0) { echo '<br>Login Succesful.<br> Being Redirected To Admin Page.'; $_SESSION['ccblog_admin'] = 'Chris Cloyd'; //header("Location: index.php"); } else { echo "<br>Could Not Log In.<br> Incorrect Information.<br> Being Redirected Back To The Home Page."; //header("Location: ../index.php"); } } ob_flush(); flush(); usleep(900000); } ?> Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710028 Share on other sites More sharing options...
DeanWhitehouse Posted December 8, 2008 Share Posted December 8, 2008 Question? Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710044 Share on other sites More sharing options...
chriscloyd Posted December 9, 2008 Author Share Posted December 9, 2008 yes i have an answer? if ur asking why i did it this way just because i wanted to experiment and have fun Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710230 Share on other sites More sharing options...
DeanWhitehouse Posted December 9, 2008 Share Posted December 9, 2008 No! I meant do you have a question or are you just randomly posting code. This is a help section on the forum, and normally is used to help people with there coding problems. Not just to show off code. Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710417 Share on other sites More sharing options...
redarrow Posted December 9, 2008 Share Posted December 9, 2008 here what u was trying to create ajax with php progress bar http://www.devpro.it/upload_progress/ Link to comment https://forums.phpfreaks.com/topic/136136-count/#findComment-710421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.