Jump to content

kyme

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by kyme

  1. I'm trying to learn.

  2. I'm trying to display a data from DB using mysqli. I'm not sure if I'm doing it right, my concern was secure. Am I doing it right? <?php include_once('user.php'); // Inialize session session_start(); $con=mysqli_connect("localhost","root","root","dbname"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT aboutme FROM testing where id=1"); if ($result) { if ($row = mysqli_fetch_array($result, MYSQL_ASSOC)) { $aboutme = $row['aboutme']; } } mysqli_close($con); ?>
  3. Ok im sory This is my html form. <table clas="rink_form"> <form method="post" action="form_survey.php"> <tr> <td> Rink Name: <input name="RinkName" type="text" class="form_text"> Rink Address: <input name="RinkAdress" type="text" class="form_text"> </td> </tr> <td>Enter code below:</td> <td><img src="secimg.php"></td> </tr> <tr> <td> </td> <td><input type="text" name="Spam Code" size="8" /></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit Form"> </td> </tr> </form> </table> And my script <?php function checkEmpty($names, $data) { $n = count($names); $emptys = array(); for ($i = 0; $i < $n; $i++) { if (empty($data[$names[$i]])) $emptys[] = $names[$i]; } return $emptys; } function createUList($arr) { $n = count($arr); echo '<ul>'; for ($i = 0; $i < $n; $i++) echo " <li>".str_replace('_',' ',$arr[$i])."</li>\n"; echo '</ul>'; } // needed so we can retrieve security code session_start(); //This command imports the values from contact.php. Please do not touch. @import_request_variables("gpc"); //The email address the message will be sent to $youremail = "mymail@yahoo.com"; //The subject of the email you will receive; $subject = "Ice Rink Supply - Survey Assessment Form"; //The page your visitor will be redirected to. $redirect = "http://www.google.com"; //Time until the page redirects your visitor (seconds) $secs = "5"; //This takes all of the information from the form and sorts it out. Please leave as is. $name= $FONT_SIZE; $FONT_SIZE=14; $thetext=$thetext."<html><body>\n"; foreach ($_POST as $name => $value) { $name = str_replace('_',' ',$name); $thetext=$thetext."$name : <b>$value</b>\n<br/>"; } $thetext=$thetext."</body></html>"; ?> <html> <head> </head> <body> <?php //Checks to see if the name field is empty. You can delete or add fields as needed. // fill $infoToCheck with info that NEEDS to be filled. Spam_Code is always needed here $infoToCheck = array("RinkAdress"); $emptyFlds = checkEmpty($infoToCheck,$_POST); $validSecurityCode = md5($_POST['Spam_Code']) == $_SESSION['key']; // to make displaying invalid spam code msg easier if (!$validSecurityCode) $emptyFlds[] = "Spam Code (invalid)"; $noEmptyFlds = count($emptyFlds) == 0; if ($noEmptyFlds && $validSecurityCode) { unset($_SESSION['key']); // prevent multiple send $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; /* <-- the ff. lines are optional $headers .= "From: ".$myname." <".$myemail.">\r\n"; $headers .= "To: <".$email.">\r\n"; $headers .= "Reply-To: ".$myname." <$myemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Just My Server"; */ $name = stripslashes($name); $message = stripslashes($message); //This is where the email is sent using your values from above. mail($youremail,$subject,$thetext,$headers); ?> <meta http-equiv="refresh" content="<?=$secs;?>;URL=<?=$redirect;?>"> <font size="+1"> <p align="center" class="prod_h1" style="color:#FFFFFF" >Thank you, we have recieved your Assessment Form.</p> <p class="rink_form" align="center" style="color:#FFFFFF"> You are now being redirected to our <a href="<?=$redirect;?>" style="color:#00CCFF">homepage</a>. </font> <? } else { ?> <font size="+1"> We require the ff. in order to reply to your message: <br/> </font> <?php if (!$noEmptyFlds) createUList($emptyFlds); ?> <center> <font color="#FFFFFF" size="+1"> Please click <a href="javascript:history.back(1);" style="color:#00CCFF">here</a> or your browsers back button to try again. </font> <br/> <br/> </center> <? } ?> </body> </html> Is there something that i mess up?
  4. It suppose to send a value from a text box just like an email form too. Basically it will not test if the textbox was fill in.
  5. Once i fill up a form it not will read & test if the form was been fill in up suppose to be once it corrects it will send through mail php script. Why it does not read the name="RinkName" this Rink Name: <input name="RinkName" type="text" class="form_text"> <i> Which is my script </I> It suppose to send a value from a text box just like an email form too. Basically it will not test if the textbox was fill in.
  6. (use tags please) you mean in my table or my mail script? I put it already and i trace it. the code looks fine to me.
  7. This is my html form. And heres my php script mail I wonder why isnt working? My other form that i made with a same codes, it all works. ???
  8. Actually it wont test once i fill w/ the spam code..
  9. I think i have problem in this part, i have something miss it? Still no solution..
  10. Now it works, it displays now an spam code but the problem now is the How it test if it is correct... Heres the code , In this part it wont test if the spam box was correct filling on it.
  11. Hello sir, I tried to read it and i dont understand a little bit. What does GD do? And how to work out? My friend just tested this up before i have implemented on it. And it works fine and 100% working. Now i have tried the codes but in my page doesnt work and never it displayed Could anyone help me that more understandable and i can easly catch up. Thanks..
  12. Hello, Im newbie in PHP, and till now stil learning php.. I'm sorry but im really a pretty slow in comes of programming. But im trying my best not to discourage and keep it up till i get my goal. I really2x want to learn php & be part of it and starting to love on it, cause i know i can do it with PHP. Now im working a project a which has a spam code before it would submit and email it. But my problem is, It would not display the spam code or captcha.. Heres my code. Html form And heres my PHP script In this part were it all checks the each textbox to verify It would not display the the spam code even i uploaded it at the server. I dont know which part should i add something in order it will display. Did i mess or miss something? Please Help me I just found this at the book and try to implement it and understand the logic code. :'(
  13. Guys now im done in saving into the database and now my problem is, i want to display it the data save it from the db. Is there something missing in my code at news.php?
  14. hey man wow thanks. it really it work..!! this forum could really give me a job!
  15. guys i need ur help, i have jst practicing my php about w/ mySql.. Now my codes have no errors but i dnt understand my output.. config.php add.php news.php Now i already created my database using phpmyadmin, but whats the problem? it appears on this after i submit Is there anything that i mess? Pls. help me i really want to know..
  16. try this sir.. //html <div id="sample"> images, text, btns etc.. </div> // css code #sample { width:50px; }
×
×
  • 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.