-
Posts
1,437 -
Joined
-
Last visited
Never
Posts posted by papaface
-
-
<?php $mystring = 'the'; $findme = 't'; if (strpos($mystring, $findme) == 0) { //do something } ?>
-
Why do you need to md5 the username. Only MD5'ing the password is necessary.
-
Yes, on the login page when retrieving the MD5'ed password you simple convert the password they entered into md5 and compare it against the one you have in the db. If they match then they got the correct password.
As for registering, you just insert the MD5'ed password into the db.
-
thanks, but now im getting
unexpected T_STRING
On line 21
<?php $host['name'] = '86.92.129.3'; $host['username'] = 'root'; $host['password'] = ''; $host['databasename'] = 'odinms'; $db = mysql_connect($host['name'], $host['username'], $host['password']) OR die ('Cant connect to MySQL!'); mysql_select_db($host['databasename'], $db); $name = $_POST['name']; $age = $_POST['age']; $accountname = $_POST['accountname']; $experience = $_POST['experience']; $why = $_POST['why']; $sel = "SELECT * FROM accounts WHERE name='$name'"; if ($accountname == ''); { echo "Please enter a accountname!"; } $d = INSERT INTO `gmapps` (`name`, `age`, `accountname`, `experience`, `why`) VALUES ($name, $age, $accountname, $experience, $why); // Line 21 mysql_query($d) OR die (mysql_error()); echo "Your GM Application has been send!"; ?>
-AlmarM-
You didnt use my modified version. Copy it again.
P.S This extremely easy stuff, you should look into the basics of PHP.
-
Should be:
<?php $host['name'] = '86.92.129.3'; $host['username'] = 'root'; $host['password'] = ''; $host['databasename'] = 'odinms'; $db = mysql_connect($host['name'], $host['username'], $host['password']) OR die ('Cant connect to MySQL!'); mysql_select_db($host['databasename'], $db); $name = $_POST['name']; $age = $_POST['age']; $accountname = $_POST['accountname']; $experience = $_POST['experience']; $why = $_POST['why']; $sel = "SELECT * FROM accounts WHERE name='$name'"; if ($accountname == ''); { echo "Please enter a accountname!"; } $d = "INSERT INTO `gmapps` (`name`, `age`, `accountname`, `experience`, `why`) VALUES ($name, $age, $accountname, $experience, $why)"; mysql_query($d) OR die (mysql_error()); echo "Your GM Application has been send!"; ?>
-
foreach($_GET as $key => $value) { echo "The name is: " . $key . " and the value is: ". $value; }
-
Nothing. It must be your code, so show us some.
-
Do you want:
<table width="860px" align="center" cellpadding="0" cellspacing="0" border="0" class="randimg"> <?php $sql = mysql_query("SELECT * FROM pics ORDER BY id DESC"); $i = 0; while($pics = mysql_fetch_array($sql)) { echo "<tr>"; $id = $pics['id']; $cat = $pics['cat']; $pic = $pics['pic']; echo "<td></td> </tr>"; } ?> </table>
You're not explaining yourself very well.
-
So what do you want? We're not mind readers.
-
<?php require_once("dbFunctions.php"); dbConnect(); if(isset($_POST['Submit'])) { if (isset($_POST['txtname'])) $name = $_POST['txtname'] else $name = ""; if (isset($_POST['checkbox'])) $opt1 = $_POST['checkbox']; else $opt1 = ""; if (isset($_POST['checkbox2'])) $opt2 = $_POST['checkbox2']; else $opt2 = ""; if (isset($_POST['checkbox3'])) $opt3 = $_POST['checkbox3']; else $opt3 = ""; $query="INSERT INTO alloyd (name, option1, option2, option3) VALUES ('$name', '$opt1', '$opt2', '$opt3');"; $result = dbQuery($query); echo "Results Added!"; } ?>
Very bad way to do it, but it utilizes your current code.
Technically, you might aswell just do:
<?php require_once("dbFunctions.php"); dbConnect(); if(isset($_POST['Submit'])) { $query="INSERT INTO alloyd (name, option1, option2, option3) VALUES ('".$_POST['txtname']."', '".$_POST['checkbox']."', '".$_POST['checkbox2']."', '".$_POST['checkbox3']."');"; $result = dbQuery($query); echo "Results Added!"; } ?>
-
Show us your current code.
-
You can do this kind of thing using cURL.
<?php $curl = curl_init(); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $_POST); curl_setopt($curl, CURLOPT_URL, "http://www.google.com"); curl_exec($curl); curl_close($curl); ?>
Will post the form vars to google.com
-
<?php $after = "thanks.html"; $oops = "oops.html"; if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST") { exit("<p>You did not press the submit button; this page should not be accessed directly.</p>"); } else { $exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i"; $profanity = "/(beastial|bestial|blowjob|clit|cock|cum|cunilingus|cunillingus|cunnilingus|cunt|ejaculate|fag|felatio|fellatio|****|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|orgasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i"; $spamwords = "/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|backgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i"; $bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer)/i"; if (preg_match($bots, $_SERVER['HTTP_USER_AGENT'])) { exit("<p>Known spam bots are not allowed.</p>"); } foreach ($_POST as $key => $value) { $value = trim($value); if (empty($value)) { if ($key != "email") { exit("<p>Empty fields are not allowed. Please go back and fill in the form properly.</p>"); } } elseif (preg_match($exploits, $value)) { exit("<p>Exploits/malicious scripting attributes aren't allowed.</p>"); } elseif (preg_match($profanity, $value) || preg_match($spamwords, $value)) { exit("<p>That kind of language is not allowed through our form.</p>"); } $_POST[$key] = stripslashes(strip_tags($value)); } if (!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,6})$",strtolower($_POST['email']))) { exit("<p>That e-mail address is not valid, please use another.</p>"); } $recipient = "07932234312@text.aql.com, jasonhutchinson32@btinternet.com"; $subject = "Web Site Enquiry"; $message .= "Name: {$_POST['name']} \n"; $message .= "Email: {$_POST['email']} \n"; $message .= "Contact: {$_POST['contact']} \n"; $message .= "Address: {$_POST['address']} \n"; $message .= "Postcode: {$_POST['postcode']} \n"; $message .= "Vehicle: {$_POST['vehicle']} \n"; $message .= "Damage: {$_POST['damage']} \n"; $headers .= "Reply-To: <{$_POST['email']}>"; if (mail($recipient,$subject,$message,$headers)) { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">"; } else { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$oops\">"; } } ?>
Try that.
-
either:
echo nl2br($data);
or
echo "<pre>". $data) . "</pre>";
-
<input type="text" value="<?php echo date("j/n/Y"); ?>" disabled="disabled" />
-
cant you do:
if(!isset($_POST["page"])){ // Checks if the $page variable is empty (not set) $page = 1; // If it is empty, we're on page 1 } else { $page = $_POST["page"]; }
-
I think it should be:
<?php function unset_required_fields(&$array){ foreach( $array as $key=>$value) { echo '#KEY being looked at: ['.$key.']<br/>'; echo '$array be4:<pre>'.htmlspecialchars(print_r($array, true)).'</pre><br/>'; if( is_array($value) ) { echo 'RECURSE, look at array under ['. $key .']...'.'<br/>'; unset_required_fields($value); } else if( $key == 'required') { echo 'CHANGED array, value for this "required" key should now be 0!!!'.'<br/>'; $array[$key] = 0; //'#required' } else { echo 'Nothing cool happens since not an array or required field'.'<br/>'; } echo '$array AFTER:<pre>'.htmlspecialchars(print_r($array, true)).'</pre><br/>'; } } $thearray = array( 'title' => "Here are some radio button questions", 'required' => 1, 'weight' => 2, 'child 1' => array( 'title' => "Radio button 1 question: blah blah?", 'required' => 1, 'weight' => -1 ), 'someotherparameters0' => 0, 'child 2' => array( 'title' => "Radio button 2 question: blah blah?", 'required' => 1, 'weight' => -1 ), 'someotherparameters1' => 0, 'someotherparameters2' => "bleh" ); unset_required_fields($thearray); ?>
-
sessions:
session_start(); $_SESSION['username'] = $_POST['username'];
Must have session_start(); at the top of every page you want to use/create/edit session vars.
-
Maybe:
function function_userlevel($userlevel){ global $config; return $result = $config->query("SELECT * FROM userlevel where userlevel = '$userlevel'"); }
Then loop through the array.
-
Try:
If you're using $_POST vars use:
mysql_query ("Insert into `userinfo` (`username`,`email`,`password`,`location`) VALUES ( $_POST['userid'] , $_POST['email'], $_POST['password'], $_POST['location'])" );
If you're using $_GET vars use:
mysql_query ("Insert into `userinfo` (`username`,`email`,`password`,`location`) VALUES ( $_GET['userid'] , $_GET['email'], $_GET['password'], $_GET['location'])" );
-
Why do you want to do this?
-
you could try encoding the url using http://uk3.php.net/base64_encode and http://uk3.php.net/base64_decode
-
try:
$temp = mysql_query("INSERT INTO `tablename` (`field`) VALUES ('$aword') where `name`='$aname'")or die (mysql_error());
-
No because that function is designed to return a string or an array, not a boolean.
search script needed
in PHP Coding Help
Posted
Erm, no. Look yourself. Use google.