![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Ninjakreborn
Members-
Posts
3,922 -
Joined
-
Last visited
Everything posted by Ninjakreborn
-
Then it's something definitely related to your webhost. Try if (mail(stuffhere)) { echo "Mail sent"; }else { echo "Mail not sent. }
-
The "rapid development framework" doesn't mean the system itself run's rapidly (though it should). It means it's meant to help you developer site's and web applications more "rapidly".
-
$_FILES['filename']['size'] This contains a value, that valued contained therein is the size of the image. Or get_image_size($image); it's actually better because it returns the type and everything else in a massive and very helpful array.
-
Try this mail("xyz@yahoo.com.au", "testing", "testing www.escapesmoking.com", $headers); mail("xyz@yahoo.com.au", "testing", "testing", $headers); and make sure the headers variable has something in it.
-
Asking you to save the file is normally caused by improper server configurations. Set error_reporting("E_ALL"); put that at the top of your scripts to see. If not, then place some echo's in, and see what is not working. See how far the script is working, there isn't an "easier" way to do it thought, debugging is debugging no mater how you look at it.
-
Magic quotes, it's the evil encarnation in PHP. It's evil functionality has turned many programmers Astray. I would disable it and run your own. You will notice in almost all situations with magic quotes you will be miserable. believe me I have spent countless, countless, countless hours dealing with magic quotes, and trying my hardest to uncover problems. Find it in the ini file and disable it. Then your script should work, then you can add them as needed, they won't be added everywhere automatically.
-
Ok so you figured out the problem, and created a solution?
-
<?php if (isset($_SESSION['whatever'])) { echo "Logged in"; }else { echo "Not logged in"; } ?>
-
If you removed the form and put it on a page (example.php) Then at the top of the page above the form all you put is <?php if (isset($_POST['submit'])) { print_r($_POST); } ?> show me the page with the test form and that above. None of the other code, not the layout, not anything but the form and that code at the top. if show, then show me the layout, and the code behind the page. ONLY the test page, shouldn't have anything bu tthe form with that above it.
-
Yes, but why are you asking for help if you aren't going to try it. That is all the advice I can offer unless you try it. My advice is change include => require_once Remove the form into a seperate form and tested it as I mentioned. I can't help you any more until you try those, let me know if you try those. I have looked over evertying, I have given all the generaly help I can without some effort from you to help me hunt down the problem. All I can do now is help you isolate and find the problem, once found I can help you fix it.
-
Also just to rule it out, on the 2 includes, change include to require_once this will verify for sure if it's an issue with one of those includes.
-
Let's do this systematically. First remove everything that isn't related to the form. Take just the form itself, and put it on a seperate test page. Test.php. Then have it submit it to itself, with nothing but if (isset($_POST['submit'])) { print_r($_POST); } put that at the top of the page, in php tags for the page that the form is on. Once we try this we'll know if it's the form or not. Once we rule that out we can test the other half of the script.
-
I apologize, my fault. Try this <?php session_start(); if(!isset($_SESSION['myusername'])) { echo "<font color="red">Please log in using the form below</font>"; } else { echo "Welcome " . $_SESSION['myusername']; } ?> There you go, that should work fine.
-
I found the problem, it was the ini file. I had just 8 so it was too small, then I tried 8mb, didn't work 8M worked, it was 1 that was returned in the error, which meant it was the ini file was not allowing it to upload. I fixed the issue and it's uploading alright.
-
I try echoing out an array fo the file's, however it's passing the name, but the other stuff is coming up blank. The error array is returning 1, the name is coming through and "all" other variables in the array are coming up empty.
-
Then the problem is something to do with your form. The post variables are not passing, and I can't begin to tell you how. I think you placed that code in teh wrong place because when I go to the url, I see the array, it should be I see the form, then when you click submit, it sends the post.
-
<?php session_start(); if(!isset($_SESSION['myusername'])) { header("location:index.php"); } ?>
-
if (!isset($_POST[submit])) { There in your code, will see that line. Put what I showed you right below that, before the $show variable.
-
Change that to <?php session_start(); if(isset($_SESSION['myusername'])) { header("location:index.php"); } ?>
-
See, I don't understand what you are doing with some of this. For instance global $join_sex_sel, $eye_color_sel, $hair_color_sel, $skin_tone_sel; Why do these need to be global, what is the purpose for all for for statements at the beginning of the document. You may have to clean that up just a little, put in some indentation. I can make out some of the logic behind the code, but it's hard telling what does what, I know it's part of a game it looks like, but I can't tell, you have a lot of things all over hte page.
-
As I mentioned right below if (isset($_POST['submit'])) { Also in order to make it easier for other people, put code tag's, like this. <?php //Include mklib.php and main_style.css and connnect to the database include "engine/mklib.php"; include "engine/main_style.css"; connect(); //Start Code //check submitted info //get aray values from mklib.php for character physical features global $join_sex_sel, $eye_color_sel, $hair_color_sel, $skin_tone_sel; //sex foreach ($join_sex_sel as $sex) { $sex_option .= "<option value = \"$sex\">$sex</option>"; } //end foreach //eye color foreach ($eye_color_sel as $eye_color) { $eye_color_option .= "<option value = \"$eye_color\">$eye_color</option>"; } //end foreach //hair color foreach ($hair_color_sel as $hair_color) { $hair_color_option .= "<option value = \"$hair_color\">$hair_color</option>"; } //end foreach //skin tone foreach ($skin_tone_sel as $skin_tone) { $skin_tone_option .= "<option value = \"$skin_tone\">$skin_tone</option>"; } //end foreach $display = "<center>\n"; $display .= "<form action = \"$_SERVER[php_SELF]\" method = \"post\">\n"; $display .= "<table border = 0>\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">First Name:</td>\n"; $display .= "<td><input type =\"text\" name = \"f_name\" size = 15 maxlength = 50></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Last Name:</td>\n"; $display .= "<td><input type = \"text\" name = \"l_name\" size = 15 maxlength = 50></td>\n"; $display .= "</tr>\n\n"; $display .= "<td align = \"right\">Email:</td>\n"; $display .= "<td><input type = \"text\" name = \"email\" size = 15 maxlength = 100></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Sex:</td>\n"; $display .= "<td><select name = \"sex\">$sex_option</select>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Height:</td>\n"; $display .= "<td><input type = \"text\" name = \"height\" size = 4 maxlength = 4></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Weight:</td>\n"; $display .= "<td><input type = \"text\" name = \"weight\" size = 3 maxlength = 3></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Eye Color:</td>\n"; $display .= "<td><select name = \"eye_color\">$eye_color_option</select></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Hair Color:</td>\n"; $display .= "<td><select name = \"hair_color\">$hair_color_option</select></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Skin Tone:</td>\n"; $display .= "<td><select name = \"skin_tone\">$skin_tone_option</select></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">Birth Place:</td>\n"; $display .= "<td><input type = \"text\" name = \"place_birth\" size = 15 maxlength = 100 value = \"London, England\"></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td></td>\n"; $display .= "<td><input type = \"submit\" name = \"submit\" value = \"Join MK\"></td>\n"; $display .= "</tr>\n"; $display .= "</table>\n"; $display .= "</form>\n"; $display .= "</center>\n"; if (!isset($_POST[submit])) { $show_form = "yes"; } elseif (isset($_POST[submit])) { $errorlist = 0; $error = ""; //check fist name and last name $query = "SELECT * FROM e_character WHERE f_name = '$_POST[f_name]' AND l_name = '$_POST[l_name]'"; $result = mysql_query($query) or die(mysql_error()); $check_name = mysql_num_rows($result) or die(mysql_error()); if ($check_name > 0) { $errorlist++; $error .= "ERROR: That name already in use. \n"; $show_form = "yes"; } if (empty($_POST[f_name])) { $errorlist++; $error .= "ERROR: You must have a first name for your character. \n"; $show_form = "yes"; } if (empty($_POST[l_name])) { $errorlist++; $error .= "ERROR: You must have a last name for your character. \n"; $show_form = "yes"; } //check email $query = "SELECT * FROM e_character WHERE email = '$_POST[email]'"; $result = mysql_query($query) or die(mysql_error()); $check_email = mysql_num_rows($result) or die(mysql_error()); if ($check_email > 0) { $errorlist++; $error .= "ERROR: That email is already in use. \n"; $show_form = "yes"; } if (empty($_POST[email])) { $errorlist++; $error .= "ERROR: You must enter a valid email address. \n"; $show_form = "yes"; } //check other fields if (empty($_POST[height])) { $errorlist++; $error .= "ERROR: You must enter a height for your character. \n"; $show_form = "yes"; } if (empty($_POST[weight])) { $errorlist++; $error .= "ERROR: You must enter a weight for your character. \n"; $show_form = "yes"; } if (!is_numeric($_POST[weight])) { $errorlist++; $error .= "ERROR: The weight field must be numeric. \n"; $show_form = "yes"; } if (empty($_POST[place_birth])) { $errorlist++; $error .= "ERROR: You must enter a birth place for your character. \n"; $show_form = "yes"; } if ($errorlist == 0){ $show_success = "yes"; } } //end if //get the form is show form == yes if ($show_form == "yes") { $display_block = $display; } elseif ($show_success == "yes") { $f_name = $_POST[f_name]; $l_name = $_POST[l_name]; $email = chop($_POST[email]); $sex = $_POST[sex]; $height = chop($_POST[height]); $weight = chop(round($_POST[weight])); $eye_color = $_POST[eye_color]; $hair_color = $_POST[hair_color]; $skin_tone = $_POST[skin_tone]; $place_birth = chop($_POST[place_birth]); //give the new player a password $code = rand(100000,999999); $password = md5($code); //get the current year for birth year $query = "SELECT * FROM time WHERE timeID = '1'"; $result = mysql_query($query) or die(mysql_error()); $time = mysql_fetch_array($result) or die(mysql_error()); $birth_year = $time[year] - 16; //get the new player's ip address $ip = getenv("REMOTE_ADDR"); //finally insert the new player into the database $query = "INSERT INTO e_character (e_characterID, f_name, l_name, email, password, sex, height, weight, eye_color, hair_color, skin_tone, place_birth, birth_year, ip, family, reg_date) VALUES('', '$f_name', '$l_name', '$email', '$password', '$sex', '$height', '$weight', '$eye_color', '$hair_color', '$skin_tone', '$place_birth', '$birth_year', '$ip', '$l_name', NOW())"; $result = mysql_query($query) or die(mysql_error()); //send email with password and a message $to = $email; $subject = "MK Verification."; $headers = "From: Medieval Kingdoms <medievalkingdoms@hotmail.com>"; $message = "SENT FROM MEDIEVAL ADMINISTRATION\n"; $message .= "Subject: User Verification.\n"; $message .= "Message: Thank you for joining Medieval Kingdoms, your password is $code. Make sure you join the forums to get masked at z10.invisionfree.com/MKS, again thank you and enjoy playing Medieval Kingdoms.\n\n"; mail($to, $subject, $message, $headers); $display_block = "You have successfully joined Medieval Kingdoms! Check your email for password. Make sure you go to the forums and get masked.\n"; $display_block .= "If you are absolutely new to MK please read the <a href = 'rules.php'>Rules[/url] and if needed <a href = 'faqs.php'>FAQs[/url] pages.\n"; } ?> <html> <head> <title>MKtemplate</title> </head> <body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- ImageReady Slices (MKtemplate.psd) --> <center> <table width="901" height="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" background = "images/MKtemplate_01.gif" width="900" height="168" align = "right" valign = "bottom"><?php print time_display(); print month();?></td> <td> <img src="spacer.gif" width="1" height="168" alt=""></td> </tr> <tr> <td rowspan="3" valign = "top"> <img src="images/MKtemplate_02.gif" width="242" height="299" border="0" usemap="#Map"> <map name="Map"> <area shape="rect" coords="134,90,175,101" href="index.php"> <area shape="rect" coords="119,116,195,127" href="join.php"> <area shape="rect" coords="115,144,199,156" href="rules.php"> <area shape="rect" coords="117,171,195,183" href="faqs.php"> <area shape="rect" coords="89,199,222,210" href="z10.invisionfree.com/MKS" target = "_blank"> <area shape="rect" coords="88,224,225,235" href="credits.php"> <area shape="rect" coords="81,252,237,264" href="nations.php"> <area shape="rect" coords="123,279,192,291" href="mkmap.php"> </map></td> <td background = "images/MKtemplate_03.gif" width="658" height="53" align = "center"> <h3>Join English</h3></td> <td> <img src="spacer.gif" width="1" height="53" alt=""></td> </tr> <tr> <td background = "images/MKtemplate_04.gif" width="658" height="224" align = "center" valign = "top" style = "background-repeat:repeat-y;"> <?php print "$error"; print "$display_block"; ?></td> <td> <img src="spacer.gif" width="1" height="224" alt=""></td> </tr> <tr> <td rowspan="2" background = "images/MKtemplate_05.gif" width="658" height="55" align = "center" valign = "top"> [<a href = "index.php">Home[/url]] [<a href = "join.php">Join M.K.[/url]] [<a href = "rules.php">M.K. Rules[/url]] [<a href = "faqs.php">M.K. FAQs[/url]] [<a href = "z10.invisionfree.com/MKS" target = "_blank">M.K. Forums[/url]] [<a href = "credits.php">M.K. Credits[/url]] [<a href = "nations.php">Nations[/url]] [<a href = "mkmap.php">M.K. Map[/url]] [[<a href = "rdrvision.com" target = "_blank">RDRvision[/url]]] ---- [<a href = "admin_login.php">Admin.[/url]] Version 1.0 <?php print "$hits"; ?></td> <td> <img src="spacer.gif" width="1" height="22" alt=""></td> </tr> <tr> <td background = "images/MKtemplate_06.gif" width="242" height="33" align = "center" valign = "top" style = "background-position:top; background-repeat:repeat-y;"> </td> <td> <img src="spacer.gif" width="1" height="33" alt=""></td> </tr> </table> </center> <!-- End ImageReady Slices --> </body> </html>
-
[SOLVED] requesting help with simple replace+math script
Ninjakreborn replied to ultrus's topic in Regex Help
Get the email file (in a txt file or something) run it through number_format and string replace. Or take all numbers from the email, change them into the format you want (all regular expressions), then replace the old numbers with the new ones. -
Actually to make it easier for you, replace both those session register functions with this $_SESSION['myusername'] = $_POST['myusername']; $_SESSION['logged'] = "yes"; This will set the username, then you can use logged to test if they are logged in or not after authorization.
-
That is a mess, I looked over it, I know it's not going blank because of an error without error reporting being on or it would show a blank screen. That is highly unreadable. With the jumbled mess of code, I am guessing it's something to do with a "logic" error. You might want to rewrite some of it, put some indentation. Echo out the following for (after) the form is submitted and tell me what happens. echo "Post"; echo "<br />"; print_r($_POST); exit; Put that onto the screen right after you check if submit is set for the form submission. Put here what comes up.
-
You are registering a name, and not a session. You are telling it to create a session with a blank value, and either way you don't want session_register do session_register("myusername"); session_register("mypassword"); $_SESSION['myusername'] = "value"; You DO-NOT want to register a session with the password, you don't want to and have no need to it's a security risk. I advice just registering the username, as shown above.