Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. change $num= $num*2; to $num= "$num"*2; EDIT: cont.
  2. Okay I have taken your first code and added some basic error checking, I have kept it simple so it should make sense <?php if(isset($_POST['submit']) || isset( $_POST["submit_x"])) { $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $dropdown = $_POST['enqtype']; //*******************************************************************************// //Validate $hasError = false; //check all have data if(empty($name)) $hasError = true; if(empty($email)) $hasError = true; if(empty($message)) $hasError = true; //check email syntax if (!preg_match('/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$/m', $email))$hasError = true; //any errors goto error page if(isset($hasError)) header('Location: contacterror.html'); //*******************************************************************************// $to = ""; //has email address that is getting sent to but im not putting in for obvious reasons lol $subject = "Art Epona Reply From: " . trim($_POST['name']) . " - " . trim($_POST['enqtype']); $emailfrom = ""; //ditto above $headers = "From: --\r\n"; //^^ $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $Body = '<body><center>'; $Body .= '<table width="450" border="1" rules="all" cellpadding="10">'; $Body .= '<center>'; $Body .= '<tr><td bgcolor="#666666"><h1><font face="Georgia, Times New Roman, Times, serif" size="3">New ' . trim($_POST['enqtype']) . ' from Art Epona Website!</font></h1></td></tr>'; $Body .= '<tr><td bgcolor="#cccccc"><p><font face="Tw Cen MT" color="#000000"><b>' . trim($_POST['name']) . '</b> will like to make a <b> ' . trim($_POST['enqtype']) . '</b>. <br /> Here are the contents of the Enquiry:<br /></font></p>'; $Body .= '<table width="430" border="1" cellpadding="10" rules="all">'; $Body .= '<tr><td width="60" bgcolor="#666666"><font face="Tw Cen MT" color="#000000"><b>Name:</b></font></td>'; $Body .= '<td width="288" bgcolor="#ffffff"><font face="Tw Cen MT" color="#000000">' . trim($_POST['name']) .'</font></td></tr>'; $Body .= '<tr><td width="60" bgcolor="#666666"><font face="Tw Cen MT" color="#000000"><b>Email:</b></font></td>'; $Body .= '<td bgcolor="#ffffff"><font face="Tw Cen MT" color="#000000">' . trim($_POST['email']) .'</font></td></tr>'; $Body .= '<tr><td width="60" bgcolor="#666666"><font face="Tw Cen MT" color="#000000"><b>Message:</b></font></td>'; $Body .= '<td bgcolor="#ffffff"><font face="Tw Cen MT" color="#000000">' . trim($_POST['message']) .'</font></td></tr>'; $Body .= '<tr><td colspan="2" align="center"><font face="Tw Cen MT" color="#000000"><a href="mailto:' . trim($_POST['email']) . '">Click here to reply to the sender</a></font></td></tr>'; $Body .= "</table></td></tr></center></table></center></body></html>"; mail($to, $subject, $Body, $headers); header('Location: contactthanks.html'); } else { header('Location: contacterror.html'); } ?>
  3. $username = "$_SESSION['username']"; should be $username = $_SESSION['username']; echo "<b><span style='color:green'>You have completed quest and gained 3 points!</span></b>"; } //<----Whats that closing ? ?>
  4. Yeah that's more of a Javascript problem, you could have PHP echo some JS to set a JS variable and the have a timer to count down from it, to save having a full AJAX request
  5. When you say "page contents" do you mean just the page or including all of its elements (JS, CSS, images) the reason I ask is if you just want the html then you can do something like <?php $start = microtime(true); $homepage = file_get_contents('http://www.apple.com/'); echo microtime(true)-$start; ?> which for me is 0.67515182495117 seconds BUT if i load http://www.apple.com/ from my browser it needs to download all the images as well, this takes about 5-7 seconds. of course the speed also depends on the clients PC and your host's PC
  6. here's an idea (added some debug) I am using shuffle to keep it simple, (I probably have logic error or typos) *untested* <?php //users numbers $myNums = array(10,15,5); $balls = range(1, 36); shuffle($balls); $win = array($balls[0],$balls[1],$balls[2]); //CHEATING - for debugging #$myNums = array($balls[0],$balls[1],$balls[2]); //3 balls in order #$myNums = array($balls[0],$balls[2],$balls[1]); //3 balls out order #$myNums = array($balls[1],$balls[0],$balls[2]); //2 balls out order #$myNums = array($balls[0],37,$balls[2]); //2 balls in order #$myNums = array(37,37,37); //no win $rate = 0; if($myNums[0] == $win[0]) $rate += 5; if($myNums[1] == $win[1]) $rate += 5; if($myNums[2] == $win[2]) $rate += 5; if(in_array($myNums[0],$win)) $rate += 1; if(in_array($myNums[1],$win)) $rate += 1; if(in_array($myNums[2],$win)) $rate += 1; if ($rate == 18 )echo "JackPot 100%"; if ($rate >= 15 )echo "JackPot 10%"; if ($rate >= 10 )echo "JackPot 5%"; if ($rate >= 3 ) echo "JackPot 1%"; ?> EDIT: edit noticed and fixed a dumb error
  7. You need to close the PHP block with ?> IE <div id="content"> <?php if ($_SESSION['loggedin']) { echo 'Welcome'; echo $_SESSION['loggedin']; } else { echo '<h3>What is crazyQuest?</h3> <p>CrazyQuest is a brand new online website that allows you to test your knowledge! These quests won\'t all be kitty, some of these quests may contain violence. But nothing bad! We believe that all our members should have fun! So, we make fun short and long quests for members to earn points.</p> <h3>Beta</h3> <p>If you signup for our beta, youll gain an extra 100 points that you can use in our shops! So if you want some cool prizes, we suggest you register today! Also, Beta accounts will have access to a special area that no other people can get into after the open beta. Beta members will also receive a crown by their name on the highscores.</p><br /><br /> <h3>Signup</h3> <p>You can signup here: <a href="register.php">Register</a></p> </div>'; } //close if //close PHP ?> <div id="footer"><h1>Copyright 2009 - CrazyQuest</h1></div>
  8. I would probably do this $balls = range(1, 36); $rand_keys = array_rand($balls, 3); echo $balls[$rand_keys[0]] . "\n"; echo $balls[$rand_keys[1]] . "\n"; echo $balls[$rand_keys[2]] . "\n"; EDIT: of course this would need to be stored, in a file or database.. but i guessed the random side was the part you was stuck on!
  9. else { echo '<h3>What is crazyQuest?</h3> <p>CrazyQuest is a brand new online website that allows you to test your knowledge! These quests won't all be kitty, some of these quests may contain violence. But nothing bad! We believe that all our members should have fun! So, we make fun short and long quests for members to earn points.</p> <h3>Beta</h3> <p>If you signup for our beta, youll gain an extra 100 points that you can use in our shops! So if you want some cool prizes, we suggest you register today! Also, Beta accounts will have access to a special area that no other people can get into after the open beta. Beta members will also receive a crown by their name on the highscores.</p><br /><br /> <h3>Signup</h3> <p>You can signup here: <a href="register.php">Register</a></p> </div>; ?> You haven't closed the else block (not } ) also you need to escape the single quotes won't should be won\'t oooookay.. looks like AlexWD beat me again!
  10. Technically any data in a session is serialized
  11. That doesn't help much as your passing $hits to a function that sets it to a session.. which is as useful as saying theirs a problem with this line $_SESSION['hitsArray'] = $hits; I would really need more info or an example. also remove session_register
  12. Once the SQL is giving you the desired results then this would be solved, as for outputting the results that's PHP, to make them look visually appalling that HTML/CSS theirs no point using PHP on a query that doesn't work, thus this is/was a SQL problem.
  13. How are you setting the object to the session ? ie session_start(); header("Cache-control: private"); require_once("MyObject.php"); $obj = new myObject(); $_SESSION['hitsArray'] = $obj->hits; // Store into session echo $_SESSION['hitsArray'][0];
  14. And the question is ? if you want to 2 computers from the same address then just disallow duplicate connections of the same IP.
  15. well i can't see how your outputting the data as you don't seam to using the function output_file clean up the code and your probably spot the problem.
  16. http://www.thebookhive.co.uk should be you have a header issue or your server is set-up incorrectly, dumb IE is displaying it at HTML which is wrong
  17. Your code is a mess, so instead of filtering thought and trying to guess the problem, can you give a little more info.. you say the file isn't downloading.. okay what is happening ? blank page error ? have you tried debugging ? where does your code fail ?
  18. Well if they come from the same house then I'll assume they have either the same IP or have a Dynamic IP from the same ISP, either way my previous suggestion will work.. if 1 house has 2 ISP connections then you won't be able to map them to the same house via only the IP, I think you really need to say what your trying to do.. as i said at the start i don't understand what your really asking
  19. Well that's the whole point!
  20. Go to any up look up site and it should give you the details you need for example using http://www.dnsstuff.com IP: 66.97.171.5 http://www.dnsstuff.com/tools/whois/?tool_id=66&token=&toolhandler_redirect=0&ip=66.97.171.5 returns So "Marlin eSourcing Solutions" owns the IP's from 66.97.160.1 to 66.97.191.254
  21. I don't understand your question, I assume by global IP you mean remote IP and by local to each other I assume you mean from the same ISP.. your best bet is you lookup one of the IP's and check what ISP it is registered to then then check the Range of IP's that ISP has and then look at the second IP and check its in the same range (or registered to same ISP)
  22. if (preg_match('/X-Attachment-Id:(.*)/', $data, $filetype2)) should be if (preg_match('/X-Attachment-Id:(.*)/s', $data, $filetype2)) s = dot matches new lines EDIT: however i must point out that the data "/9j/4AAQ..." will be captured in the first loop, but i'm not sure what "the rest of that data" truly refers to
  23. try this <?php $html = '<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/mzOWr3Fbtk0&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mzOWr3Fbtk0&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>'; if (preg_match('%<param .*?value="(http://www\.youtube\.com[^"]+)"%s', $html, $regs)) { $link = $regs[1]; echo $link; } ?>
  24. You could have a 1 minute cron for the resize and a queue folder, as for upload your need to use something client side like java/flash.
  25. This is a HTML/CSS issue but the first step would be to remove the <br>
×
×
  • 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.