wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Is there any whitespace after the closing PHP tag? for example a new line a space etc, in config.php
-
You do something like this: [code]<?php $text = "Hey my email adddy is [email protected] isnt it nice"; if(preg_match("/([A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4})/i", $text)) { echo "Email adddy detected, We do not accept email addresses within strings!"; } else { echo "No email addy dectected"; } ?>[/code]
-
Hip-hip-harray! [i]*Waits for CrayonViolet to disagree ::)*[/i] Blimmy I have done 3000+ posts :o
-
Your header var is in the wrong place, place it after the $message variable, like so: [code]$message = $_POST['message']; $header = "From: {$name}<{$email_field}>";[/code]
-
Ha, found it However it doesnt use a database, but implementing a database into should be abe no problem. [url=http://www.llstudios.net/directory/16-1]Here is the tutorial[/url]
-
Does it only slow down when you are searching the database? If thats the case you might want to try and optimize your query, or normalize your database.
-
Thats might be the problem then. Its to do with the the header.php file as that is outputting text/html to browser, which will cause the header function to not work. You'll have to either use output buffering or just echo out your javascript inplace of the header function.
-
send form regardless if file selected or not
wildteen88 replied to aladiyat23's topic in PHP Coding Help
You'll want to first check whether a file has been upload first, by checking whether $_FILE superglobal array is set. As if no file is uploaded I'm pretty sure no the $_FILE superglobal will not be set. -
I go with option C myself. I see no need for prepackeged versions of AMP. Also I find some packages bundle crap loads other stuff which I probably wont use. I prefer to install what I am going to use.
-
You are still using the old header code: [code]$header = "From: {$name}<{$email_field}>";[/code]
-
What you'll have to do is add the users sessionid to the database. Then have a piece of code executes every 15mins which gets sessionid of the user from the database, then you retrieve the users session file and check whether the session is still valid, if it is you dont change the users state, however if isnt then you change the users login state. There was a post before to a site which showed you how to track users online. I will see if I can dig it up.
-
So you dont want to put the users name and email in the From bit? Just your website? If thats the case you can do this: [code]$header = "From: mysite.com<[email protected]>";[/code]
-
If you are going to use your javascript you'll have to echo it in order for the browser to parse the HTML. However the reason why your header redirect isn't working is bacause on line 15 in config.php yuou have output. What on line 15 or around line 15 in config.php
-
I think the Admins are trying to find a way of adding a comment (not sure if they still are though) for why a person has graced/smited you. Also hopefully the solved button may take a return too.
-
Use header: [code]header("Location: thanx.html");[/code] Make sure there is no output before the use of this function. To show who sent the email you'll want to send additional headers (4th parameter for mail function). A bit like this: [code]$header = "From: {$name}<{$email_field}>"; mail($to, $subject, $body, $header);[/code] This where your validation is most important! As your contact form is now prone to spam! Now you are using custom headers!
-
Id use a header redirect. [code]header("Refresh: 6; URL=http://www.yoursitename.com/index.php");[/code] before this line: [code]echo "<table align='center' width='500' bgcolor='C0C0C0'><tr><td><center><font face='Verdana'><h3>Your IP address has been banned from accessing this site.</h3><font face='Verdana' size='2'> If you feel this is in error you can contact the site administrator <a mailto='$site_email'>via email</a><br></td></tr></table>";[/code] Just make sure you dont have any output before the use of header, otheriwse you'll have to either use ob_start(); and ob_end_flush(); for output buffering, or use javascript for the redirect.
-
Rather than forcing it to stop. Look at your start bar, at the bottom right. Look for the apache taskbar icon (green triangle within a white circle, and a pink feather point to the top left). Right click on it an select Open Apache Monitor. Click the Stop button. Apache is attempt to stop itself. If that fails, again right click on the Apache taskbar icon and select Open Services. Find the Apache service. Its proably named Apache for Apache1.x and Apache2 for Apache2.x Right click on it and select Properties. Click the Stop button. See if that will stop the apache service from running. If it doesnt then either you have some form of malware controlling Apache, or Apache is misconfigured and causing it to not respond. While you are still in the Servcies window for the Apache service chose Startup type to Manual or Disabled. This will prevent Apache from running once Windows has loaded up.
-
You'll be best of searching for form validation tutorials. For your setup I would recommend you to do javascript form validation and possibaly PHP form validation too just incase the user has javascript turned off. SO fi you search for form validation tutorials with google you'll get a ton of results.
-
For your first question. Yes you can do that, however some developers tend to do [code]echo "<p>" . $quotes[$randomquote] . "</p>";[/code] for readability when creating a script, Theres no need for it, as variables can be parsed within double quotes. However they can't with single quotes. secound question, that line isnt doing nothing. So theres no need for it to be there. third question. If you want to make it display more than one quote, either duplicate the line. Or put it in a for loop, and loop it a few times to get two or more results like so: [code]// get two results: for ($i = 0; $i < 2; $i++) { $randomquote = rand(0, count($quotes)-1); echo "<p>{$quotes[$randomquote]}</p>"; }[/code] If you want to say display say 100 results, change the number 2 to 100, and the for loop will run the code 100 times producing 100 random results.
-
Change this: [code]$result = mysql_query($sql);[/code] to this: [code]$result = mysql_query($sql) or die("Unable to perform query:<i>{$sql}</i><br />" . mysql_error());[/code] It apears your query is failing. If it is failing it should give an error.
-
This is because you havn't given your submit button a name. Change: [code]<input value="Submit Comments" type="submit"> [/code] to [code]<input value="Submit Comments" name="submit" type="submit">[/code] Also I would recommend you to validate user input (your post variables). As your email script will be prone to spam! Malicous users will be able to send multiple emails in one go! Also you font validate for valid email addresses.
-
This is becuase PHP came to an unexpected result. It found the word create and got confused. This is becuase CREATE is not a defined keyword/function in PHP. But only for SQL. You should do this instead: [code]include ("dbinfo.inc.php"); $sql = "CREATE TABLE `rate` ( 'id' bigint(20) NOT NULL auto_increment, // rest of SQL code here "; // perform our query $result = mysql_query($sql);[/code]
-
Try this: [code]function isbanned($ip) { $sql = "SELECT banned_ip FROM banned_ip WHERE ip = '$ip'"; $result = mysql_query($sql); if (mysql_num_rows($result) == 1) { return true; } else { return false; } } if (isbanned($_SERVER['REMOTE_ADDR']) === true) {[/code]
-
PHP may not have a setting called short_open_tag enabled which allows you to use <? as an opeing tag and <?= a shortcut for <?php echo . Try fenways suggestion by using the full opening tag <?php
-
Prehaps this [url=http://www.phpfreaks.com/forums/index.php/topic,101005.0.html]thread[/url] might be able to help you out. Look at post number 3 by toplay.