Jump to content

Daney11

Members
  • Posts

    301
  • Joined

  • Last visited

    Never

Everything posted by Daney11

  1. Daney11

    POST

    In normal text boxes i have <tr> <td width="208" height="22" bgcolor="<?php echo $color ?>"> Result Link</td> <td width="300" height="22" bgcolor="<?php echo $color ?>"><input class="forminput" name="result_link" type="text" value="<?php if (isset($_POST['result_link'])) echo $_POST['result_link']; ?>" /></td> </tr> and that works perfect, if there is an error the submitted text still stays in the box
  2. Daney11

    POST

    Without submitting the form this peice of code <td width="300" height="22" bgcolor="<?php echo $color ?>"><select class="forminput" name="result_game"><?php $gamequery=mysql_query("SELECT * from `games` WHERE `game_active`='Yes' ORDER BY `game_name` ASC"); while($game=mysql_fetch_array($gamequery)){ if (isset($_POST['result_game'])){ if ($_POST['result_game'] == $game['game_image']) $select = "selected='selected'"; else $select = ""; } else { $select = ""; } echo "<option value='{$game['game_image']}' $select\>".stripslashes($game['game_name'])."</option>\n"; } ?> </select> </td> works perfect. But when the form has been submitted and there is an error, nothing is being display and all the options have been deleted. I really cannot figure this one out.
  3. Daney11

    POST

    Its something to do with the $_POST but i cannot see why at all.
  4. Hey guys. Im using <select class="forminput" name="result_hours"><?php for ($i=0; $i<=24; $i++) { echo "<option value=\"$i\""; if ($i==$sel_hours) echo " selected"; echo ">$i</option>"; } ?></select> It returns the correct values 1 2 3 4 5 etc But on the single digits i want it to return 01 02 03 04 05 etc how do i go about doing this? cheers.
  5. Daney11

    POST

    pocobueno1388 when posting the result is the same. it dissappears
  6. Daney11

    POST

    Hmm, im not actually sure on how to work that out if im honest lol. Im just correcting all the bugs on my site.
  7. Daney11

    POST

    Hey guys <tr> <td width="208" height="22" bgcolor="<?php echo $color1 ?>"> Result Team Tag</td> <td width="300" height="22" bgcolor="<?php echo $color1 ?>"><input class="forminput" name="result_teamtag" type="text" value="<?php if (isset($_POST['result_teamtag'])) echo $_POST['result_teamtag']; ?>" /></td> <tr> <td width="208" height="22" bgcolor="<?php echo $color ?>"> Result Game</td> <td width="300" height="22" bgcolor="<?php echo $color ?>"><select class="forminput" name="result_game"><?php $gamequery=mysql_query("SELECT * from `games` WHERE `game_active`='Yes' ORDER BY `game_name` ASC"); while($game=mysql_fetch_array($gamequery)){ echo "<option value=\"".$game['game_image']."\">".stripslashes($game['game_name'])."</option>\n"; } ?> </select> Im using this to submit data.... It all works fine expect when i submit the data and if there is an error the POST values all come up correct but the game value. The values from the drop down disappear. The values are there when the form has not been submitted but afterwards it dissppears.
  8. works a treat. thanks very much
  9. Hey guys, Im using if (eregi ('^[[:alpha:]\.\'\-]{2,80}$', stripslashes(trim($_POST['result_link'])))) { $result_link = escape_data($_POST['result_link']); } else { $result_link = FALSE; $errors[] = 'Please Enter A Link'; } which is working fine. BUT im not sure how to add 2 links into it. for example. if (eregi ('^[[:alpha:]\.\'\-]{2,80}$', stripslashes(trim($_POST['result_link'])), stripslashes(trim($_POST['result_link1'])), )) { $result_link = escape_data($_POST['result_link']); } else { $result_link = FALSE; $errors[] = 'Please Enter A Link'; } doesnt work. ANyone any ideas? Thanks
  10. I dont understand why i didnt put "or die" myself. Little mistakes all the time hey Thanks a lot for your time budimir. The error was $query .= "`news_active` = '".$_POST['active'].",'"; Needed the , removing at the end Thanks
  11. Im using echo $query. And it is working, all the values are fine. UPDATE `news` SET`news_id` = '9',`news_teamid` = '1',`news_title` = 'Hi',`news_image` = '',`news_body` = 'This is a long news post. Hahahaha [b]bold[/b] lol. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',`news_author` = 'Vixen',`news_date` = '2008/02/02 10:02:39',`news_active` = 'Yes',WHERE `news_id` = '9'
  12. Hey guys, Im using this bit of code... if (isset($_POST['submitted'])) { $errors = array(); if (eregi ('^[[:alpha:]\.\'\-]{2,35}$', stripslashes(trim($_POST['news_title'])))) { $news_title = escape_data($_POST['news_title']); } else { $news_title = FALSE; $errors[] = 'Please Enter A News Title'; } if (strlen($_POST['news_body']) > 3 && (strlen($_POST['news_body']) < 10000)) { // Strip News Body For Bad Data $news_body = escape_data($_POST['news_body']); } else { $news_body = FALSE; $errors[] = 'News Needs To Be More Than 3 Characters and Less Than 10000'; } if (eregi ('^[[:alpha:]\.\'\-]{6,8}$', stripslashes(trim($_POST['news_active'])))) { $news_active = escape_data($_POST['news_active']); } else { $news_active = FALSE; $errors[] = 'Please Enter Yes or No For News Active'; } if (empty($errors)) { $query = "UPDATE `news` SET"; $query .= "`news_id` = '".$_GET['news_id']."',"; $query .= "`news_teamid` = '$team_url',"; $query .= "`news_title` = '".$_POST['news_title']."',"; $query .= "`news_image` = '".$_POST['news_image']."',"; $query .= "`news_body` = '".$_POST['news_body']."',"; $query .= "`news_author` = '".$_SESSION[member_username]."',"; $query .= "`news_date` = '$date',"; $query .= "`news_active` = '".$_POST['active']."',"; $query .= "WHERE `news_id` = '".$_GET['news_id']."'"; $result = mysql_query($query); if ($result) { } else { $errors[] = 'It Went Wrong'; echo $query; } } } else { $errors = NULL; } if ($result) { echo " <table width=\"508\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" class=\"abouttable\"> <tr> <td class=\"text\" height=\"19\"> <table width=\"500\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"> <tr> <td width=\"500\" height=\"21\"><b> Your news post was successful.</b> </td> </tr> </table> </td> </tr> </table> <table width=\"508\" height=\"1\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"> <tr> <td><img src=\"images/spacer.gif\" height=\"1\"></td> </tr> </table>"; } if (!empty($errors)) { foreach ($errors as $msg) { echo " <table width=\"508\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" class=\"abouttable\"> <tr> <td class=\"text\" height=\"19\"> $msg<br />\n </td> </tr> </table> <table width=\"508\" height=\"1\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"> <tr> <td><img src=\"images/spacer.gif\" height=\"1\"></td> </tr> </table> "; } echo " <table width=\"508\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" class=\"abouttable\"> <tr> <td class=\"text\" height=\"19\"> Make Sure All Information Is Correct</td> </tr> </table> <table width=\"508\" height=\"1\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"> <tr> <td><img src=\"images/spacer.gif\" height=\"1\"></td> </tr> </table>"; } Now im using the same bit of code to add news... and it adds the news perfect... however when i change it to UPDATE the news, it always gives me the error message "It Went Wrong".. I cannot figure out why. Thanks
  13. lol, so simple. thanks <3
  14. Hey guys I have this ^([a-z0-9]{2,32})$ It works fine to allow a-z and 0-9 however i would like to allow spaces. "meeeee" works but "meee eee" wont work Any ideas? Cheers guys
  15. Hey guys, a problem with Captcha. <?php session_start(); class CaptchaSecurityImages { var $font = 'arial.ttf'; function generateCode($characters) { /* list all possible characters, similar looking characters and vowels have been removed */ $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } return $code; } function CaptchaSecurityImages($width='120',$height='40',$characters='6') { $code = $this->generateCode($characters); /* font size will be 75% of the image height */ $font_size = $height * 0.75; $image = imagecreate($width, $height) or die('Cannot initialize new GD image stream'); /* set the colours */ $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 20, 40, 100); $noise_color = imagecolorallocate($image, 100, 120, 180); /* generate random dots in background */ for( $i=0; $i<($width*$height)/3; $i++ ) { imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color); } /* generate random lines in background */ for( $i=0; $i<($width*$height)/150; $i++ ) { imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color); } /* create textbox and add text */ $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function'); $x = ($width - $textbox[4])/2; $y = ($height - $textbox[5])/2; imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function'); /* output captcha image to browser */ header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); $_SESSION['security_code'] = $code; } } $width = isset($_GET['width']) && $_GET['height'] < 600 ? $_GET['width'] : '120'; $height = isset($_GET['height']) && $_GET['height'] < 200 ? $_GET['height'] : '40'; $characters = isset($_GET['characters']) && $_GET['characters'] > 2 ? $_GET['characters'] : '6'; $captcha = new CaptchaSecurityImages($width,$height,$characters); ?> <img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /> But no captcha is being shown. and i go on http://localhost/CaptchaSecurityImages.php i get this error Fatal error: Call to undefined function imagecreate() in D:\server\www\CaptchaSecurityImages.php on line 25 line 25 being $image = imagecreate($width, $height) or die('Cannot initialize new GD image stream'); taken from http://www.white-hat-web-design.co.uk/articles/php-captcha.php Any ideas guys?
  16. Even if i add .gif at the end it doesnt work. and it gives me http://localhost/ai not /flags and .gif
  17. Nope, that doesnt work mate. However i refreshes when selected. Actually it does work. but doesnt do the extention .gif even though its there
  18. Hey guys, Im using <?php echo '<select name="member_nation">'; echo '<option value="NoNation" selected="selected">Please Select...</option>'; foreach ($location as $key => $value) { echo "<option value=\"$key\">$value</option>\n"; } echo '</select>'; ?> and it works perfect. Now im not at all sure how to make it so when they select a $value, the image comes up at the side <?php echo '<select name="member_nation">'; echo '<option value="NoNation" selected="selected">Please Select...</option>'; foreach ($location as $key => $value) { echo "<option value=\"$key\">$value</option>\n"; } echo '</select>'; ?> <img src="flags/<?php echo $member_nation ?>"> So that everytime a value is selected the image changes with it.... Anyone know how to do this? Thanks
  19. Hey guys, Im using this bit of code to pull out all locations and values, and it works perfect. <?php echo '<select name="member_nation">'; echo '<option value="nonationA" selected="selected">Please Select...</option>'; ?> <?php foreach ($location as $key => $value) { echo "<option value=\"$key\">$value</option>\n"; } echo '</select>'; ?> However this peice of checking code keeps telling me to enter a vaild nation, even though i am. Any ideas? if (eregi ('^[[:alpha:]\.\'\-]{2,15}$', stripslashes(trim($key)))) { $member_nation = escape_data($key); } else { $member_nation = FALSE; $errors[] = 'Please Enter A Valid Nation'; } Thanks
  20. an hour and a half staying up this late and all i needed to do was <?php echo $location[$member_nation]; ?> omg lol. thanks for all ur help. <3
  21. $member_nation has the data in the database
×
×
  • 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.