-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
oops sorry syntax error function insert() { return '<a href="'.c2c_get_custom("main image").'" rel="lightbox" title="'.c2c_get_custom("title").'"><img src="'.c2c_get_custom("thumb").'" width="60" height="45" alt="df" /></a>'; }
-
sure let me use my psychic abilities to divine what your how your script is written, give some insight
-
you specify the path to the uploaded file via the move_uploaded_file() function. If you supply a different path, it will have a different name. IE instead of the path being path/to/myfile.txt, you can change the path to be path/to/otherfile.txt
-
im not wading through that mess of HTML , post the relevant php code in php/code tags
-
is that a php function? if so you are getting errors because you are trying to open php tags in php tags. why are you doing that? and yes the multiple closing/opening single quotes are coinciding. Next time put code in code tags function insert() { return '<a href="'.c2c_get_custom("main image").'" rel="lightbox" title='".echo c2c_get_custom("title")."'><img src='".c2c_get_custom("thumb")."' width="60" height="45" alt="df" /></a>'; }
-
i havent read your code at all, but if you want to print what the user has submit, then just do echo $_POST['MyFormInputTextFieldName'];
-
if I were to do it I would just set my register page to update your own mysql table, and the phpbb's table, and when you login, register a cookie/session for your login, and the forums
-
try $myFile = $filename.".txt"; i dont see how much of a difference that will make tho
-
if (is_numeric($cc) && luhn_check($cc)) $error = false; else $error = true; well asuming you want error to be true when the luhn check is true and isnumeric is true, than the logic is wrong. right now, if the cc number is numeric, and the luhn check runs true, $error will be false. try if (!is_numeric($cc) || !luhn_check($cc)) $error = false; else $error = true;
-
hmm, I don' see anything particularly wrong with this code. are you sure your filename is right, and that you are opening the right file name? try to echo out the variable. remember, since you have the open mode to 'w', it will overwrite anything that was previously there before. you can append information with 'a'
-
you can use PHP's url=http://us3.php.net/manual/en/function.date.php]date[/url] function also to get time. You can use javascript to validate the checkbox is checked before you let the user submit, but you want to validate it with PHP also, since the user can turn javascript off. also, to get a users IP, use the following $ip=$_SERVER['REMOTE_ADDR'];
-
what is the error? btw you can just do this return ($total % 10 == 0);
-
quite easy <form> <!-- form stuff --> <?php if (isset($_POST['username'])){//whatever the username input field is //paste your login check stuff here } ?> you can either set the action of the form to the same page, OR just don't set an action at all. If you don't set an action on the form, the action will by default be the page of the form. the isset() checks of the post variable is set. and the only way the post variable will be set is if the user filled out the form and clicked submit. then it does the check login stuff. this is actually a very common thing for people to do
-
IP addresses by themselves can not give you a location of someone. IP addresses can often lie also (depending on the ISP) for example, a lot of AOL users can appear to be living in virginia (US aol users that is) when they in fact may live in california, or Florida. Not to mention that, since IP addresses aren't region specific (they are not like telephone numbers, which give you an area code) you would need some sort of 3rd party information. why not just provide a link to the website in different languages at the home page?
-
$steam_W = ($steam_Z*2) + 76561197960265728 + $steam_Y); echo (int)$steam_W; maybe?
-
have you looked into strtotime?
-
[SOLVED] Fatal error: Cannot access empty property
mikesta707 replied to Locked's topic in PHP Coding Help
dont forget the topic solved button at the bottom of the screen -
does common.php have session_start() at the top of the page?
-
[SOLVED] Fatal error: Cannot access empty property
mikesta707 replied to Locked's topic in PHP Coding Help
the correct way to access data members is $this->name. you don't need the $ next to the name of the var $this->$adder=$var; //should be $this->adder=$var you will need to change the way you access all your data members -
try $steam_W = ($steam_Z*2) + 76561197960265728 + $steam_Y); echo (float)$steam_W;
-
well that probably has to do either with the server settings, or the upload script itself. None of the code i have seen in this post would cause that
-
Problem with file upload and INSERT to database
mikesta707 replied to Rboz's topic in PHP Coding Help
the following is a bad way to check the file extension. first of all, you would be checking, for example, gif == " gif", which of course is false. put your code in code tags too... another thing, why do you have the file extensions as a string, and then convert it to an array... just make an array $allowed_ext = "jpg, gif, png,"; // These are the allowed extensions of the files that are uploaded $max_size = "50000"; // 50000 is the same as 50kb $max_height = "100"; // This is in pixels - Leave this field empty if you don't want to upload images $max_width = "100"; // This is in pixels - Leave this field empty if you don't want to upload images // Check Entension $extension = pathinfo($_FILES['file']['name']); $extension = $extension[extension]; $allowed_paths = explode(", ", $allowed_ext); for($i = 0; $i < count($allowed_paths); $i++) { if ($allowed_paths[$i] == "$extension") { $ok = "1"; } } // Check File Size if ($ok == "1") { If the filetype isn't correct, than that if statement will throw an undefined variable error try $extension = pathinfo($_FILES['file']['name']); $extension = $extension[extension]; $allowed_paths = array('jpg', 'png', etc); if (!in_array($extension, $allowed_paths){ echo "Incorrect file type"; exit(); } //continue uploading much simpler and elegant. you should also check that your file uploaded before you insert info the your database. IE if(!move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name'])){ echo "Upload failed!" exit(); } //upload didnt fail, insert into database idk if you made this yourself, or got it from some website, but a lot of this stuff is kind of pointless. this is how i would do it $allowed = array('jpg', 'png', etc); $uploaddir = "uploads"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777! $max_size = "50000"; // 50000 is the same as 50kb $max_height = "100"; // This is in pixels - Leave this field empty if you don't want to upload images $max_width = "100"; //check extension $ext = end(explode('.', $_FILES['file']['name'])); if (!in_array($ext, $allowed)){ echo "FIle extension is incorrect"; exit(); } //check size if($_FILES['file']['size'] > $max_size) { print "File size is too big!"; exit; } //check dimensions list($width, $height, $type, $w) = getimagesize($_FILES['file']['tmp_name']); if($width > $max_width || $height > $max_height) { echo "File height and/or width are too big!"; exit(); } //all checks were passed, now try to move the file if(!move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']) && !is_uploaded_file($_FILES['file']['tmp_name'])){ echo "Upload failed!" exit(); } //upload succeeded, now go on to SQL stuff edit: a couple of syntax and logical errors -
with this if statement if($_FILES["file"]["size"][$i] > 1000) { continue; } unless all your files are below 1000 bytes (less than a kilobyte!) it will skip every step after that. remember, file is in bytes, so you may want to change that
-
um.. all scripts send headers for the most part... but yeah if you are using the $_SESSION super global you need to have session_start() at the beginning of the page