Jump to content

Shadowing

Members
  • Posts

    722
  • Joined

  • Last visited

Everything posted by Shadowing

  1. thanks Anon, acctually that was just a typo when i changed something before submiting to make it easier to read. my fatal error is coming from $army_id = $this->input->post['defender_planet']; Also missing a " would give a syntax error not a fatal error
  2. Hey guys im having a issue with getting a radio group check box to work. Not sure what im doing wrong this is giving me a fatal error. Wanting to make it where only one box can be checked at a time. and when the attack from button is hit it assigns the value to $defender_planet <input type="checkbox" name="defender_planet" value="58"/> <input type="checkbox" name="defender_planet" value="59" /> <input type="checkbox" name="defender_planet" value="60" /> if(isset($_POST['attack_from'])) { $defender_planet = $this->input->post('defender_planet'); $planet3 = "SELECT defender_planet FROM travel WHERE defender_planet = '" .($defender_planet')."'"; $planet2 = mysql_query($planet3) or die(mysql_error()); $planet1 = mysql_fetch_array($planet2); $_SESSION['attacking_from'] = $planet1['defender_planet']; header("Location: attack.php"); exit(); }
  3. Was wondering if anyone had any thoughts on how im running settings on my text base game. I currently have like 60 settings stored in the data base. These are only admin control settings. They set what things cost in the game and such. I was thinking today that would it be better instead of running a query on every page to grab the settings that page uses. I just simply do one huge select ALL query for the settings when a user logs in and turn all the setting into super global $_SESSION. Also this way any function i made i can simply use the SESSION instead of grabing settings out side the function or creating a query for it with in the function. So i was thinking doing this would extremly speed up my game wouldnt it? wondering if anyone has any thoughts on this
  4. omg after reading the guide some more. i see what you guys are saying now finally. I found a example in the manual that clicked with me lol. Now i understand how passing agruments work. to get the most out of my function function cell_alert_signup($cell_number) { $to = $cell_number; $from = "stargate@localhost.com"; $subject = "Stargate System Lords"; $message = "Alerts are now set up for Stargate System Lords"; mail($to, $subject, $message); } When I call the function I need to cell_alert_signup($cell_number); but since these is for cell texts and the message is only going to be so long. I should do this instead function cell_alert_signup($cell_number,$message) { $to = $cell_number; $from = "stargate@localhost.com"; $subject = "Stargate System Lords"; $message = $message; mail($to, $subject, $message); } cell_alert_signup($cell_number,$message); [/code] but since this is just a text message shouldnt I just use only the mail function and not even make a function. mail($to, $subject, $message); but then again i'll be posting this on several pages and less code on the page is better. Only going ot have 2 types of cell phone alerts anyways besides the sign up one.
  5. I think the larger problem is the way im thinking of how to speed my scripts up when accessing the data base. I wanted to use a varaible out side the function so I didnt use more server to add another query in the function. Is there a differance in speed from the two examples below? instead of selecting all 3 at once in one query. Only select 2 things then use another query to select 1 thing? Cause i would perfer to not use variables out side the function at all. I was just concern about to many queries $planets3 = "SELECT siege,name,address FROM planets WHERE name ='".($siege_list)."'"; mysql_query($planets3) or die(mysql_error()); OR $planets3 = "SELECT siege,name FROM planets WHERE name ='".($siege_list)."'"; mysql_query($planets3) or die(mysql_error()); $planets2 = "SELECT address FROM planets WHERE name ='".($siege_list)."'"; mysql_query($planets2) or die(mysql_error()); here is a function i made in question. "the top examples are not related to this function they were just examples" Im making a function page that sends diferant types of cell phone alerts to users. The function below is a text message they receive when they first add their number and cell provider. But i need their email address so i need to make a query to grab it. I kept the global thing in here to show what i was trying to do. Also because im sending a email i dont need to do a return at the end right? Since im not returning anything from the function function cell_alert_signup() { global $cell_number; $to = $cell_number; $from = "stargate@localhost.com"; $subject = "Stargate System Lords"; $message = "Alerts are now set up for Stargate System Lords"; mail($to, $subject, $message); return $cell_alert_signup; }
  6. I think im good now. I understand it shows a entire list of differant things i can set error reporting too. I currently have it set to E_ALL & ~E_NOTICE. i dont see anything in the constants talking about -1 though. but now i know why it wasnt showing me notices cause E notice means it doesnt show notices lol thanks guys
  7. It also didnt make me aware of this notice too Notice: A session had already been started
  8. yah i do have errors set to on but they apparently didnt make me aware of undefined index's. Notice: Undefined index: offense_level_points in C:\Software\XAMPP\xampp\htdocs\stargate\Users\battle.php on line 34 thats going to help me find errors much easier and makes things faster when there is a problem. i think i have mine set to E_ALL atm going to go check. if so wonder why it wasnt showing me these undefined index errors
  9. Scootstah is the normal thing to do is to attached the following to a page that is required on all my pages? cause i just attached this to my page that connects me to my database and i got hit with 3 Notices. ini_set("display_errors", "1");error_reporting(-1);
  10. Hey AyKay47 what do you mean by debuging it. do you mean by using this ini_set("display_errors", "1");error_reporting(-1); I just used this just now for the first time. so not sure what all it really displays, but im assuming it displays any errors and even if you start a variable out with _ how does everyone handle this. Should i just keep this on every page so its always active? Is that what most people do?
  11. thanks alot guys, came back a few days later to look this all over again. Im starting to make my own functions alot now. Also i just learn the need to use Global now. now that im lookig over Jcbones example. I have a question on whats going on here. so when you call "some_function you are actually making $var1 and $var2 = $my_first_name and $my_last_name ? if so then i notice you are replacing $var1 and $var2 again when you call the function a 2nd time "$get_name2 = some_function('Have Gun','Will Travel');" function some_function($var1,$var2) { return $var1 . ', ' . $var2; } $my_first_name = 'John'; $my_last_name = 'Smith'; $get_name = some_function($my_first_name,$my_last_name); $get_name2 = some_function('Have Gun','Will Travel');
  12. lol now im trying to think of ways i can take advantage of that in the future. letting me issue a header and still let it read true statements on the rest of the page. Cant believe all this time i thought header was a complete future code stop
  13. Oh wow. yah that fixed it. thats crazy i never ran into issues like this before. wow i need to go over 30 pages and add that to all headers. I think i never came accross this issue cause i rarely take advantage of the page flow to where id make things activate in order. thanks alot for the help
  14. I'm having a issue at the moment where my required page is being read when it shouldnt be. This if statement is true to where the first header in the if statement activates header("Location: forgotpassword.php"); but yet for some reason it reads the required safe page at the very bottom. if i disable the required safe.php the header works. Does required files not work with the flow of a page or something? Cause thats what appears to be going on here. // if npd is in the link the the user access the page from a link in their email cause they forgot their password if (isset($_GET['npd']) && (!isset($_SESSION['user_id']))) { // grabs user name and password from the link then seperates it into an array $seperate = explode("-", $_GET['npd']); $link_name = $seperate[0]; $forgotpd = $seperate[1]; // checks if username matches a deleted or banned account $count3 = "SELECT forgotpd FROM users WHERE name= '".mysql_real_escape_string($link_name)."' AND forgotpd= '".mysql_real_escape_string($forgotpd)."'"; $count2 = mysql_query($count3) or die(mysql_error()); $count1 = mysql_num_rows($count2); if($count1 < 1){ $_SESSION['mycache'] = "That recovery password link has already been used. If you didnt change your password after reseting your password then you will need to reset it again."; header("Location: forgotpassword.php"); }else{ // Search the database and get the password, id, and login ip that belongs to the name in the username field. $users3 = "SELECT login_ip,goauld,id FROM users WHERE name= '".mysql_real_escape_string($link_name)."' AND forgotpd= '".mysql_real_escape_string($forgotpd)."'"; $users2 = mysql_query($users3) or die(mysql_error()); $users1 = mysql_fetch_array($users2); // checks to see if the login ip has an ip already if(empty($users1['login_ip'])){ $users1['login_ip'] = $_SERVER['REMOTE_ADDR']; } // if the ip is different from the ip that is on the database it will store it $ip_information = explode("-", $users1['login_ip']); if (in_array($_SERVER['REMOTE_ADDR'], $ip_information)) { $users1['login_ip'] = $users1['login_ip']; } else { $users1['login_ip'] = $users1['login_ip']."-".$_SERVER['REMOTE_ADDR']; } // creates session for user id and login time $_SESSION['user_id'] = $users1['id'];// stores the id of the user $_SESSION['goauld'] = $users1['goauld']; $_SESSION['login_time'] = time(); // stores the log in time of the user $forgotpd= "UPDATE users SET password = '".mysql_real_escape_string($forgotpd)."' , login_count= login_count+1 , userip='".($_SERVER['REMOTE_ADDR'])."', login_ip='".($users1['login_ip'])."' , forgotpd= '' WHERE name= '".mysql_real_escape_string($link_name)."' AND forgotpd = '".mysql_real_escape_string($forgotpd)."'"; mysql_query($forgotpd) or die(mysql_error()); $_SESSION['mycache'] = "Your password has been reset. You will need to change your password in order to log in again in the future."; header("Location: account_settings.php"); } } require("safe.php");
  15. thanks for the responce PFMaBiSmAd what i dont understand is how can the code run again if the button "(isset($_POST['change_email']))" isnt pushed. if its not pushed its not isset right? or where am I off on how i thought this worked. plus the forms are empty on every refresh. So if there is no buffer then how does the form have information if the input fields are blank on each refresh? How i do my other forms i store it into a session, use a header then unset the session after its displayed. Which works fine. so i guess thats the only way to do it then. I guess i was just trying to understand why so i know exactly how its working. I need to make sure i understand this fully Also If i use a header i have to use a session other wise it wont echo at all. on page refresh
  16. Thanks for the responce cyberRobot yah i use sessions for other things I display. then unset the session after displaying it. But wondering if i can wipe out this buffer or what ever that exist that causes this to happen
  17. Here is a small example. if i change my email and it says "your email has been changed" If i hit refresh on the page it keeps saying it // change email if(isset($_POST['change_email'])) { if(!checkEmail($_POST['new_email'])) { echo 'Your email is not valid!'; }else{ if($_POST['new_email'] != $_POST['confirm_email']) { echo 'Your confirm email does not match your new email'; }else{ // Updates your email $update_email = "UPDATE users SET mail= '".mysql_real_escape_string($_POST['confirm_email'])."' WHERE id='".($_SESSION['user_id'])."'"; mysql_query($update_email) or die(mysql_error()); echo "Your email has been changed"; } } }
  18. anyone know how to get rid of an echo when you hit refresh on the browser? My browser is remembering the echo from with in a if statement when refresh is hit even if the if statement remains false on refresh.
  19. Turns out after googling the issue. that the problem is is a windows xp issue or from installing and uninstalling broswers. So working on trying to fix it
  20. In case no one was clear as to why you dont need to put php tags <?php *******php code******** ?> on every line its because you only use these php tags when you are going in and out of php. So for example <html> <body> <?php // php code here. ?> im ending the tag here cause the php code stops and html starts <form method="post" action=""> <input type="password" name="confirm" id="confirm" /> </form> <?php // php code here ?> im ending the tag here cause the php code stops and html starts </body> </html>
  21. Thanks for the responce dragon_sa Tried your approach with the same result I took a picture to help show whats going on If you look at the bottom of the screen it shows the correct link. If a copy that link and paste it in the browser it works fine. but for some reason as soon as I click Log in on the link it adds all this stuff before the link which makes it give a white page error res://ieframe.dll/syntax.htm#localhost/stargate/users/account_settings.php? npd=dda6979aa83d183bb602fb05860849fe
  22. Hey guys im having a problem with emailing a link using local host mail. I'm using out look express with Mercury. I shorten the email below as much as possible. Its really wierd the target for the link is correct but clicking on it gives me this res ieframe.dll res://ieframe.dll/syntax.htm#http//localhost/stargate/users/account_settings.php? npd=82b1e0df295ee681f1fa2f213ade823d $to = $_POST['resendemail']; $from = "stargate@localhost.com"; $subject = "Stargate System Lords Password Recovery"; $message = "<html> <body background=\"#4B4B4B\"> <h1>Stargate System Lords Password Recovery</h1> Dear ".$users1['name'].", <br> <center> <a href="localhost/stargate/users/account_settings.php?npd=$new_password ">Log In</a> <p> <br /> </font> </body> </html>"; $headers = "From: Stargate Game Password Recovery <stargate@localhost.com>\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $subject, $message, $headers);
  23. You should use php code tags when posting questions and format it better so its easy for us to read.
  24. Im seriously making the best text based strat game every created. The game is finished too. I just finished a few days ago. Now im doing some touch up on the site and some more site admin tools plus the guide to the game. Will probably launch it in Alpha stages in a month. You start out as a Goa'uld on a out back planet with a few loyal Jaffa. You conquer Star systems and I built one hell of a map lol. The AI I built into the map is pretty incredible. Ive been working 16 hours a day on this project for the last 3 months or so. The game mechanics is pretty high quality too its not cheap at all. I put alot of thought into it. You can attack with ships or attack through the stargate. There is a real calculation with distance between stars. I made the game as real as possible. I had to toss a few things away though to keep fun factor high. There is no game that i know of that is anything like what I built.
  25. Even though few will read this. I'd like to take some time out to thank Phpfreaks and everyone who helped me get as far as I am now with php. Thank you. I'm doing really now. Can actually understand the manual fully now. Special thanks to scootstah Pikachu2000 jcbones KevinM1 Muddy_Funster The Little Guy PFMaBiSmAd kicken Drummer litebearer
×
×
  • 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.