teddyb
Members-
Posts
19 -
Joined
-
Last visited
Never
Everything posted by teddyb
-
Getting an error when submitting a form with the mail() function
teddyb replied to Wolverine68's topic in PHP Coding Help
yes! -
Getting an error when submitting a form with the mail() function
teddyb replied to Wolverine68's topic in PHP Coding Help
no the word POST in capitals? -
Getting an error when submitting a form with the mail() function
teddyb replied to Wolverine68's topic in PHP Coding Help
what about method="POST" youre using iis right? -
Getting an error when submitting a form with the mail() function
teddyb replied to Wolverine68's topic in PHP Coding Help
Your script sends a message when the form is first requested too? -
http://php.net/manual/en/function.trim.php
-
You either want to md5 the password after checking it (better) or have <?php if ($password != "d41d8cd98f00b204e9800998ecf8427e") { //run query }
-
i think your problem lies with the fact that the md5 of the empty string is d41d8cd98f00b204e9800998ecf8427e so $password contains that string after <?php $password = md5(clean_up($_POST['password'])); also isset will return true for the empty string
-
You could do it using the form like <html> <head> <title></title> </head> <body> <form action="http://www.abc.in/smsapi/sendsms.php" method="get"> telephone:<input type="text" name="sendto"> message:<input type="text" name="msg"> <input type="submit" name="" value="Send Message"> </form> </body> Or if you want it to go to your own script which then makes the request you would have something like this If curl isnt installed: <?php if (isset($_POST['sendto'])) { $sendto = $_POST['sendto']; } if (isset $_POST['message']) { $message = $_POST['message']; } //Do some validation on input $api_address = "http://www.abc.in/smsapi/sendsms.php" get_headers($api_address.'?'.'sendto='.$sendto.'&msg='.urlencode($message)); if it is <?php if (isset($_POST['sendto'])) { $postdata['sendto'] = $_POST['sendto']; } if (isset $_POST['message']) { $postdata['message'] = $_POST['message']; } //Do some validation on input $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.abc.in/smsapi/sendsms.php"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); curl_exec($ch); curl_close($ch); I havent tested this code but it *should* /hopefully/ work
-
woops sorry, i renamed a variable and forgot to rename it somewhere else <?phpforeach ($number_of_results as $class => $number_of_class) { echo $value . " Class " . $class; echo "<br />"; } Should be <php foreach ($number_of_results as $class => $number_of_class) { echo $number_of_class . " Class " . $class; echo "<br />"; } i initially had the foreach as $key => $value but decided they were terrible variable names
-
You could do this <?php $output = array(); if ((!isset($_POST['state'])) && (($_POST['country'] != $r['country']) || ($_POST['city'] != $r['city']))) { $details = $_POST['city'].', '.$_POST['country']; update_user_actions(1, $details); $output[] = "City and Country Changed"; } else if ((isset($_POST['state'], $_POST['city'])) && (($_POST['state'] != $r['state']) || ($_POST['city'] != $r['city']))) { $details = $_POST['city'].', '.$_POST['state']; update_user_actions(1, $details); $output[] = "City and State Changed"; } if ((isset($_POST['credentials'])) && ($_POST['credentials'] != $r['credentials'])) { $details = ''; update_user_actions(2, $details); $output[] = "Credentials Changed"; } if ((isset($_POST['specialties'])) && ($_POST['specialties'] != $r['specialties'])) { $details = ''; update_user_actions(3, $details); $counter++; $output[] = "Specialties Changed"; } if ((isset($_POST['personalweb'])) && ($_POST['personalweb'] != $r['personalweb'])) { $details = $_POST['personalweb']; update_user_actions(4, $details); $counter++; $output[] = "Personal Web Changed"; } if (empty($output)) { echo "No modifications made"; } elseif(count($output) == 1) { echo $output[0]; } else { echo "Profile Changed"; } But its not the best way of doing it, but it does mean you dont have to restructure your entire script
-
KDM, that will most likely not work as it will come accross the first <? in <?xml version="1.0" encoding="UTF-8"?> and go into interpret mode
-
<?php function documentType(){ echo <<<HEREDOC <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ` ` "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> HEREDOC; } ?> you included the bracket for closing the function in your string
-
what does update_user_actions(); do? does it echo what the users just updated or does it just make db modifications?
-
exit() stops execution of the script so whatever echos / html you have after it wont be done, you need to either echo the closing tags before it or in it like exit('</body></html>'); or have a condition in such a way that you dont need to exit but the condition around outputting the form fails on the 2nd request
-
<?php $counter = 0; if ((!isset($_POST['state'])) && (($_POST['country'] != $r['country']) || ($_POST['city'] != $r['city']))) { $details = $_POST['city'].', '.$_POST['country']; update_user_actions(1, $details); $counter++; } else if ((isset($_POST['state'], $_POST['city'])) && (($_POST['state'] != $r['state']) || ($_POST['city'] != $r['city']))) { $details = $_POST['city'].', '.$_POST['state']; update_user_actions(1, $details); $counter++; } if ((isset($_POST['credentials'])) && ($_POST['credentials'] != $r['credentials'])) { $details = ''; update_user_actions(2, $details); $counter++; } if ((isset($_POST['specialties'])) && ($_POST['specialties'] != $r['specialties'])) { $details = ''; update_user_actions(3, $details); $counter++; } if ((isset($_POST['personalweb'])) && ($_POST['personalweb'] != $r['personalweb'])) { $details = $_POST['personalweb']; update_user_actions(4, $details); $counter++; } if ($counter >= 2) //ie more than one { //do something }
-
can you try <?php error_reporting(E_ALL); mkdir("myitems/images", 0777); chmod("myitems/images", 0777); copy('downloads.zip', 'myitems/images/downloads.zip'); and post any warnings / notices
-
Input Text and choose font family, size and color, HEEEELLLPPPP!!!
teddyb replied to noobtopro's topic in PHP Coding Help
You need to close the " around the styles <?php session_start(); $_SESSION['textformat'] = $_POST['textformat']; $_SESSION['font'] = $_POST['font']; $_SESSION['size'] = $_POST['size']; $_SESSION['color'] = $_POST['color']; ?> <html> <head> <title>No title</title> </head> <body> <p <?php echo ' style="font-family: ' . $_POST['font'] . '; '; echo 'font-size: ' . $_POST['size'] . '; '; echo 'color: ' . $_POST['color'] . '; "'; ?> > <?php echo $_POST['textformat']; ?> </p> </body> </html> -
Something like this? <?php $colname_Recordset1 = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_swb, $swb); $query = sprintf("SELECT Class FROM ships WHERE PlayerName = %s", GetSQLValueString($colname_Recordset1, "text")); $result = mysql_query($query, $swb) or die(mysql_error()); $number_of_results = array(); while($row = mysql_fetch_array($result)){ if (isset($number_of_results[$row['class']])) { $number_of_results[$row['class']]++; } else { $number_of_results[$row['class']] = 1; } } foreach ($number_of_results as $class => $number_of_class) { echo $value . " Class " . $class; echo "<br />"; } mysql_free_result($result);?>;