Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Help Error PHP
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Li1M0ST3Rz" data-source="post: 332569" data-attributes="member: 1271"><p><img src="http://i59.tinypic.com/sgj38g.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> </p><p>I know i havent been on for a while and i haven't code for a while so help me out.</p><p>- func.php</p><p>[PHP]<?php</p><p>$min=1;</p><p>$max=60000;</p><p>$user1 = $_SESSION['user'];</p><p>$req = mysql_query("SELECT * FROM user WHERE username='$user1'");</p><p> while($rows = mysql_fetch_array($req))</p><p> if($rows['rank'] == 5):</p><p> echo '<a href="./adm/login.php">Control Panel</a>';</p><p> endif;</p><p>$result = mysql_query("SELECT * FROM maintenance");</p><p> while($row = mysql_fetch_array($result))</p><p> if($row['status'] == 0):</p><p> header("Location: ./main.php");</p><p> endif;</p><p>function timeAgo($time_ago){</p><p> $t = mysql_query("SELECT * FROM message WHERE to = '".$_SESSION['user']."'") or die(mysql_error());</p><p> $fetch = mysql_fetch_assoc($t) or die(mysql_error());</p><p> while($time = mysql_fetch_array($t))</p><p> {</p><p>$cur_time = time();</p><p>$time_ago = $time["time"];</p><p>$time_elapsed = $cur_time - $time_ago;</p><p>$seconds = $time_elapsed ;</p><p>$minutes = round($time_elapsed / 60 );</p><p>$hours = round($time_elapsed / 3600);</p><p>$days = round($time_elapsed / 86400 );</p><p>$weeks = round($time_elapsed / 604800);</p><p>$months = round($time_elapsed / 2600640 );</p><p>$years = round($time_elapsed / 31207680 );</p><p>// Seconds</p><p>if($seconds <= 60){</p><p> echo "$seconds seconds ago";</p><p>}</p><p>//Minutes</p><p>else if($minutes <=60){</p><p> if($minutes==1){</p><p> echo "one minute ago";</p><p> }</p><p> else{</p><p> echo "$minutes minutes ago";</p><p> }</p><p>}</p><p>//Hours</p><p>else if($hours <=24){</p><p> if($hours==1){</p><p> echo "an hour ago";</p><p> }else{</p><p> echo "$hours hours ago";</p><p> }</p><p>}</p><p>//Days</p><p>else if($days <= 7){</p><p> if($days==1){</p><p> echo "yesterday";</p><p> }else{</p><p> echo "$days days ago";</p><p> }</p><p>}</p><p>//Weeks</p><p>else if($weeks <= 4.3){</p><p> if($weeks==1){</p><p> echo "a week ago";</p><p> }else{</p><p> echo "$weeks weeks ago";</p><p> }</p><p>}</p><p>//Months</p><p>else if($months <=12){</p><p> if($months==1){</p><p> echo "a month ago";</p><p> }else{</p><p> echo "$months months ago";</p><p> }</p><p>}</p><p>//Years</p><p>else{</p><p> if($years==1){</p><p> echo "one year ago";</p><p> }else{</p><p> echo "$years years ago";</p><p> }</p><p>}</p><p>}</p><p>}</p><p>function getRandomString($length = 24) {</p><p> $validCharacters = "abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ+-*#&@!?";</p><p> $validCharNumber = strlen($validCharacters);</p><p> $result = "";</p><p> for ($i = 0; $i < $length; $i++) {</p><p> $index = mt_rand(0, $validCharNumber - 1);</p><p> $result .= $validCharacters[$index];</p><p> }</p><p> return $result;</p><p>}</p><p>?>[/PHP]</p></blockquote><p></p>
[QUOTE="Li1M0ST3Rz, post: 332569, member: 1271"] [IMG]http://i59.tinypic.com/sgj38g.png[/IMG] I know i havent been on for a while and i haven't code for a while so help me out. - func.php [PHP]<?php $min=1; $max=60000; $user1 = $_SESSION['user']; $req = mysql_query("SELECT * FROM user WHERE username='$user1'"); while($rows = mysql_fetch_array($req)) if($rows['rank'] == 5): echo '<a href="./adm/login.php">Control Panel</a>'; endif; $result = mysql_query("SELECT * FROM maintenance"); while($row = mysql_fetch_array($result)) if($row['status'] == 0): header("Location: ./main.php"); endif; function timeAgo($time_ago){ $t = mysql_query("SELECT * FROM message WHERE to = '".$_SESSION['user']."'") or die(mysql_error()); $fetch = mysql_fetch_assoc($t) or die(mysql_error()); while($time = mysql_fetch_array($t)) { $cur_time = time(); $time_ago = $time["time"]; $time_elapsed = $cur_time - $time_ago; $seconds = $time_elapsed ; $minutes = round($time_elapsed / 60 ); $hours = round($time_elapsed / 3600); $days = round($time_elapsed / 86400 ); $weeks = round($time_elapsed / 604800); $months = round($time_elapsed / 2600640 ); $years = round($time_elapsed / 31207680 ); // Seconds if($seconds <= 60){ echo "$seconds seconds ago"; } //Minutes else if($minutes <=60){ if($minutes==1){ echo "one minute ago"; } else{ echo "$minutes minutes ago"; } } //Hours else if($hours <=24){ if($hours==1){ echo "an hour ago"; }else{ echo "$hours hours ago"; } } //Days else if($days <= 7){ if($days==1){ echo "yesterday"; }else{ echo "$days days ago"; } } //Weeks else if($weeks <= 4.3){ if($weeks==1){ echo "a week ago"; }else{ echo "$weeks weeks ago"; } } //Months else if($months <=12){ if($months==1){ echo "a month ago"; }else{ echo "$months months ago"; } } //Years else{ if($years==1){ echo "one year ago"; }else{ echo "$years years ago"; } } } } function getRandomString($length = 24) { $validCharacters = "abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ+-*#&@!?"; $validCharNumber = strlen($validCharacters); $result = ""; for ($i = 0; $i < $length; $i++) { $index = mt_rand(0, $validCharNumber - 1); $result .= $validCharacters[$index]; } return $result; } ?>[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Help Error PHP
Top