-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
That server error isn't caused by your script. It's Apache, maybe the permissions on your file aren't correct? CHMOD them to 755.
-
Where is $issue_number coming from?
<?php if($issue_number == 'n'){ include "file1.php"; }else { include "file2.php"; } ?>
-
Now print it to the browser
<?php echo birthday($birthday); ?>
-
I'm getting an output. Is there anything else running on the script?
-
<?php $r = $_GET['restrict']; print_r($r); ?>
It's simply acting as an array.
-
You could have something like:
animals.php?animal=XX
<?php $animal = mysql_real_escape_string($_GET['animal']); $sql = "SELECT * FROM `table` WHERE `animal`='".$animal."'"; $res = mysql_query($sql) or die(mysql_error()); // check if animal exists $row = mysql_fetch_assoc($res); ?>
-
mysql_connect uses the parameters in this order: host, username, password
you have it: host, username, database?
-
It will attempt to create the file, try using the full path to that folder.
-
Keep the $max line, but replace everything else.
-
The lines in between where you echo your form introduction and the variable max definition.
-
Each time you loop through the database you're continuously setting variable i back to 0, and then adding one back to it.
Define variable i before the while loop begins, and remove the definition of it from the contents of the while loop.
-
Limits on queries must be within a positive range.
You need to first check if your $pagenum exists.
So doing something like
$data = mysql_query("SELECT * FROM `accounts`") or die(mysql_error()); $rows = mysql_num_rows($data); $page_rows = 4; $max_pages = ceil($rows/$page_rows); $page = (int) $_GET['pagenum']; $pagenum = ($page && $page > 0 && $page <= $last) ? $page : 1;
that should do it.
-
It suppresses errors.
-
On your mysql query (data_p) instead of die("") use die(mysql_error()) and post the error.
-
My mistake, sorry about that mix up.
-
Something like so?
<?php $sql = "SELECT activ_code,activated FROM `emails` WHERE `email`='".mysql_real_escape_string($_GET['email'])."'"; $res = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($res); $act = $row['activated']; $acode = $row['activ_code']; $code = $_GET['activationkey']; switch($act){ case 1: if($acode == $code){ // success! $sql2 = "UPDATE `emails` SET `activated` = 1 WHERE `email`='".mysql_real_escape_string($_GET['email'])."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $output = "Your email has successfully been activated!"; }else { $output = "Invalid activation code!"; } break; case 2: $output = "Your email has already been activated, please continue to the site!"; break; default: $output = "Something went wrong..."; } echo $output; ?>
-
I'm not sure what you mean, more than one variable in the function? You clearly are specifying two parameters which would be your variables inside the function.
If you're talking about having one of the parameters have multiple values you can use an array.
function accept_email($to,$from){ if(is_array($to)){ // foreach the array and cycle send }else { // normal } }
Clarify your question please.
-
You could set a background image to it
<input type="text" style="background-image:url('xxx.gif');border:0px;">
-
Line 76 read:
} else }
Changed it to:
} else {
-
Here you go:
<?php session_start(); include("config.php"); include("inc.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="Description" content="" /> <meta name="Keywords" content="" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Robots" content="index,follow" /> <link rel="stylesheet" href="style.css" type="text/css" /> <title>Registration</title> </head> <script type="text/javascript" src="<?=$siteurl;?>js.js"></script> <?php include('header.php'); include('leftbar.php'); include('rightbar.php'); ?> <div id="main"> <a name="TemplateInfo"></a> <h1>Register New User</h1> <?php if (isset($_POST['submit'])) { // Form Submitted require_once('recaptchalib.php'); $privatekey = "6LcgKgkAAAAAAA0i5ZtgaAyOVkwQn9FsX8qOaSef"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn't entered correctly. Go back and try it again."); } else { // ReCaptcha Code Entered Correct // Validate Username if ($_POST['username'] != "") { $username = filter_var($_POST['username'], FILTER_SANITIZE_STRING); if ($username == "") { $errors .= 'Please enter a valid username.<br/><br/>'; } } else { $errors .= 'Please enter your a username.<br/>'; } // Validate Password if ($_POST['password'] != "") { $password = md5($_POST['password']); } else { $errors .= 'Please enter your a password.<br/>'; } // Validate Name if ($_POST['name'] != "") { $name = filter_var($_POST['name'], FILTER_SANITIZE_STRING); if ($name == "") { $errors .= 'Please enter a valid name.<br/><br/>'; } } else { $errors .= 'Please enter your a name.<br/>'; } if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors .= "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } else { $errors .= 'Please enter your email address.<br/>'; } // Check For Errors if (!$errors) { $query=mysql_query("select * from user where username like '$username'") or die(mysql_error()); if(mysql_num_rows($query)==0){ @mysql_query("insert into user (username, password, name, email, date) values('$username','$password','$name','$email', NOW())"); echo "Thank you, Your account has been created."; } else { echo '<div style="color: red">That username has already been taken, Please go back and try another.</div>'; } } else { echo '<div style="color: red">' . $errors . '<br/></div>'; } } } else { // Form Not Submitted ?> <form name="regitser" action="register.php" method="post" onsubmit="return formCheck(this);"> Username: *<br /><input type="text" name="username" size="35" /><br /> Password: *<br /><input type="text" name="password" size="35" /><Br /><br /> Name: <br /><input type="text" name="name" size="35" /><br /> Email: *<br /><input type="text" name="email" size="35" /><br /> <input type="hidden" name="regform" value="1" /><br /> <?php require_once('recaptchalib.php'); $publickey = "6LcgKgkAAAAAAEtp0C1bbBWYRNZvZgoMEXRz_eyO"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <br /> <input type="submit" name="Submit" value="Register" /> </form> <?php } ?> </div> <?php include('footer.php'); include ('endhtml.php'); ?>
-
Show us all the code, before and after that. There are no errors with that specific section of code.
-
You can use:
<input type="image" src="urlpic.gif" name="submit">
-
Nope you won't have to.
Quick example with and without protection:
Password: <b>mypassword</b> Without Protection: 47907e460328bbb6f1efaa9d07950027 With Strip Tags: 34819d7beeabb9260a5c854bc85b3e44
-
<?php $_foo = array('Parent 1' => array('Child 1-1', 'Child 1-2', 'Child 1-3', 'Child 1-4'), 'Parent 2' => array('Child 2-1', 'Child 2-2', 'Child 2-3')); foreach($_foo AS $key => $val){ echo "<h2>".$key."</h2>"; foreach($val AS $meow){ echo "<link>".$meow."</link><br>\n"; } } ?>
I get:
Parent 1
Child 1-1
Child 1-2
Child 1-3
Child 1-4
Parent 2
Child 2-1
Child 2-2
Child 2-3
Navigating to pages
in PHP Coding Help
Posted
500 Internal Error refers to the clients access to the requested URL.