-
Posts
70 -
Joined
-
Last visited
Never
About Jarod
- Birthday 11/23/1992
Contact Methods
-
MSN
thejaydawg@gmail.com
Profile Information
-
Gender
Male
-
Location
MS, Jackson
Jarod's Achievements
Member (2/5)
0
Reputation
-
How do I generate new random number if $_GET['script'] matces $random_num??
Jarod replied to Jarod's topic in PHP Coding Help
that did not work before, I tried that same exact thing the first time I tried to fix this problem (and you forgot to return it btw). -
Okay in my script I am getting the same output sometimes (the $_GET['script'] and $random_num) that match each other. I don't want them to match, so I'm trying to fix this so that $random_num doesnt match $_GET['script']. private function getRandomScriptId() { $sql = mysql_query("SELECT id FROM script"); $maximum = mysql_num_rows($sql); $minimum = ($maximum-$maximum)+1; // starts at 1 $random_num = rand($minimum, $maximum); if($_GET['script'] == $random_num) { // I tried in here, but it didnt work either, I got a error sometimes new $random_num; } else { return $random_num; } }
-
Well I give up on this... Even though I learned a lot about regex, but forget it... Anyways, I've been trying to figure out how I would handle my inputs so that it only looks at the numbers and nothings else. Check out 900,000,000,000 for example (900 billions btw). I enter it exactly as, but when it comes down for processing it I only want the numbers to go through, which would be 900000000000. I've heard of regex before, but never actually understood its purpose and how its suppose to be used. So anyways I used the expressions /[0-9]{1,3}[^,]*/, but the problem of that is I cant get it to only look at the numbers (omitting the commas and only using the numbers). Its array would output Array [0] ( $match[0] = 900; $match[1] = 000; $match[2] = 000; $match[3] = 000; ) Any way I can get it to look at the string like this??? (900000000000)
-
7.78% is not smaller than 0.778% I know it's bigger, which is why i mention manipulation. I want to manipulate it as 7.78, basically make it into a collusion. EDIT: I think substr() might be of use, should be, ill try it.
-
Okay I've done the math, but I want to turn it around to a smaller number, this is how my math goes though: Basically I have the number 0.778%, I want to turn that around to 7.78% though, is this possible? To get 0.778 I want did 309 divided by 397.
-
Oooo! Sure wasn't! Sorry for that, I'm still getting the hang of the session_start() thing .
-
Okay I'm not sure but I don't think I understand how to keep my users logged in anymore, anyways... I log in with my administrator account from the www directory and when I tried to access the admin area, which is in another directory called admin, I'm not logged in still, any reason why this is happening? My file structure is like this Website WWW ---Admin ------JS ------Images ------Index.php ---Images ---Includes ---Index.php Im logged in on the WWW directory, but not in the Admin directory, I'm using sessions by the way.
-
OK wut did I do wrong in this??? Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\practices\test\index.php on line 1 eval(" if( !isset($_SESSION['server']) ) { $_SESSION['server'] = \"Direct TV\"; echo $_SESSION['server']; } else { echo \"<b>Server</b> already set! (\". $_SESSION['server'] .\")\"; } ");
-
OK wut did I do wrong in this??? Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\practices\test\index.php on line 1 eval(" if( !isset($_SESSION['server']) ) { $_SESSION['server'] = \"Direct TV\"; echo $_SESSION['server']; } else { echo \"<b>Server</b> already set! (\". $_SESSION['server'] .\")\"; } ");
-
How do I use eval()? Man it's so confusing, I thought I had it at first. It work, but not until I really needed... I used it with a function and it's not doing so! // set_session("username", "user1"); function set_session($session, $username) { eval($_SESSION['$session'] = $_POST['$username']); }
-
Login bugged, any reason why? Im not really use to sessions by the way
Jarod replied to Jarod's topic in PHP Coding Help
Thanks, I just figured that out myself l0l.... -
Login bugged, any reason why? Im not really use to sessions by the way
Jarod replied to Jarod's topic in PHP Coding Help
That's not fixed anything, it's still clutching -
Login bugged, any reason why? Im not really use to sessions by the way
Jarod replied to Jarod's topic in PHP Coding Help
I guess, but I'm still having a buggy issue here :'(, any reason why the login is doing this?? (I changed them for true/false by the way) -
Login bugged, any reason why? Im not really use to sessions by the way
Jarod replied to Jarod's topic in PHP Coding Help
In my functions I always used 0 as true and -1 as false, maybe I should change up on that consider what you just said. I never thought of values being true or false that way to be honest. -
Okay I have a site im working on for the login, http://jarodsworld.ismywebsite.com/trookine/index.php You can log in using test for the username and password. When you log out the Member Access Feature is empty, but if you refresh page one more time it shows you are logged in. Any reason why it does that empty box content after redirect (when you successfully log in)? Here is my PHP code: <?php $login_message = "<p>Login with your existing account to access more features.</p>\n"; if(isset($_POST['islogging'])) { // User is attempting to login $username = mysql_real_escape_string($_POST['user1']); $password = mysql_real_escape_string($_POST['pass1']); $verification_result = $member_handler->verify_member($username, $password); if($verification_result == 0) { // User details are verified $username = $_POST['user1']; $_SESSION['username'] = $username; $_SESSION['islogged'] = true; } else { $login_message = '<p class="red_text">The submitted username and/or password is incorrect, please try again.</p>'."\n"; } } else { // Not attempting to login if(isset($_SESSION['islogged']) == true) { // Check if user is logged in if(isset($_GET['option']) == "logout") { // User is logging out --- See if they have clicked the logout button header("Location: logout.php"); } ?> <h4 class="hello_member">Hey there, <a href="#" title="Click here to view your profile"><?php print($_SESSION['username']); ?></a>! (<a href="?option=logout">Logout</a>)</h4> <p>An announcement was made while you were away. <a href="#">Check it out</a>!</p> <h4>Account Statistics</h4> <ul class="stats"> <li><b>Account type:</b><span class="list_info"><?php print($member_handler->member_type($_SESSION['username'])); ?></span></li> <li><b>New messages:</b><span class="list_info">0</span></li> <li><b>Total messages:</b><span class="list_info">0</span></li> <li><b>Total news comments:</b><span class="list_info">0</span></li> <li><b>Total guide comments:</b><span class="list_info">0</span></li> </ul> <h4>Runescape Statistics</h4> <ul class="stats"> <li><b>In-Game Name:</b><span class="list_info"><?php print($member_handler->rs_name($_SESSION['username'])) ?></span></li> <li><b>Quests Complete:</b><span class="list_info">0</span></li> </ul> <?php } else { // User is not logged in ?> <?php print($login_message); ?> <p><b>If you don't have an account yet, consider joining TrooKine today!</b></p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label for="user1">Username:</label> <input type="text" name="user1" id="user1" class="field" /> <label for="pass1">Password:</label> <input type="password" name="pass1" id="pass1" class="field" /> <input type="hidden" name="islogging" /> <input type="submit" value="Login" /> </form> <?php } } ?>