EdwinPaul
Members-
Posts
137 -
Joined
-
Last visited
Everything posted by EdwinPaul
-
This code: $username_exist = mysql_num_rows($checkuser); if($username_exist > 0){ echo "I'm sorry but the username you specified has already been taken. Please pick another one."; unset($username); include '../register.html'; exit(); } should be: if(mysql_num_rows($checkuser) > 0){ echo "I'm sorry but the username you specified has already been taken. Please pick another one."; header('Location: register.html'); exit(); }
-
Maybe batstanggt should also google 'sqlinjection' because this isn't safe. A username of 1' or '1=1 might give funny results...
-
First of all, the sequence of all the actions in a program (or php-file) is important. For instance: you can't use a session-variable if you didn't fill it. And you can't use a variable in a SELECT if the contents isn't filled. Besides that, there are a few rules ordered by php and html. For instance: if you put something to the screen ( echo 'something') and after that you code your header of the html, you get an error-message: 'headers allready sent'. After you execute a query, the result comes in.. $result in your example. With this result you can fill an array of table-values with mysql_fetch_array($result). If you code: $row=mysql_fetch_array($result) then the array with the name $row is filled with keys (the names of your database-fields) an values (from the corresponding fields). You can acces them with $row['fieldname'] and do with it whatever you want, including putting it in a session-variable.
-
$a=150; $b=$a*1.034;
-
^^^ Inside a string it is not. $date = "$year-$month"; and $date = $year.'-'.$month; produce exactly the same result. Yes, I noticed. I removed it. :-\
-
Why don't you echo some intermediate results? <?php $date = "$year-$month"; echo $date."<br/>"; echo date('Y-m',strtotime($date . '-1 -1 month'))."<br/>"; echo date('Y-m',strtotime($date . '-1 +1 month'))."<br/>"; ?>
-
user login, error on line 10, ')' unexpected
EdwinPaul replied to silverglade's topic in PHP Coding Help
First of all: you cannot use if($post_username && $post_password) as if it were 2 booleans. They are NOT ! Second: <?php if (strlen($post_username) >25) || strlen($post_password) < 15)) ?> <?php if ( (strlen($post_username) >25) || (strlen($post_password) < 15) ) ?> -
Okay, too bad for your time spent. I copied your script to my server, changed the to-address, and now I think I can see what's wrong. Attachments are added to you message, and separated by boundaries. Those boundaries should be unique for each attachment. Therefor you added a variable in your script, called $num, and you -correctly- integrated this in you boundary. But you don't use and/or increment this, so al your boundaries have the same name. Furthermore: if you want to compose your own headers, each line you want to make should end with "\r\n" which means: 'go to the beginning of the next line'. http://php.net/manual/en/function.mail.php All-in-all I would strongly recommend to switch to using one of the mentioned EASY mailing-packages.
-
Where did you get this script?
-
According to the documentation, the syntax should be: What is the contents of your variables $file1 and $file2 ?
-
Can you show the code where that happens?
-
Lennart, to speed things up for yourself, consider using a package for sending mail: Libmail, PHPMailer, Swiftmail. And look at http://www.pfz.nl/forum/topic/455-s?do=findComment&comment=3247
-
Telling checkbox array to not insert if no selections made
EdwinPaul replied to Eiolon's topic in PHP Coding Help
if ($insert_program) { if ($insert_audience) { are no booleans. If $_POST['audience'] is your checkbox, I think it would be wise to check it with isset($_POST['audience']) and with is_array($_POST['audience']) -
Parse error: syntax error, unexpected T_FUNCTION
EdwinPaul replied to techrahul87's topic in PHP Coding Help
Another thing: some browsers do not send the contents of the submit-button whent the user hits enter, so it might be dangerous to test for the contents of that button. Also: $_REQUEST is an array which consists of everything in the $_GET, $_POST and $_COOKIE -arrays. You'd better check: if ($_SERVER['REQUEST_METHOD'] == "POST"){ in stead of if(isset($_REQUEST['submit'])) Also: try to find something on the internet about sql-injection. Your script is vulnerable! If I enter a user like 1' OR '1=1 with the same pasword, I can enter your site. -
Display data in two columns rather than one
EdwinPaul replied to Corinthian's topic in PHP Coding Help
If you remove the <div> </div> <p> and </p> from within your while-loop, things should go better. But really re-calculate the space ! -
Display data in two columns rather than one
EdwinPaul replied to Corinthian's topic in PHP Coding Help
On your site I can see that it is not working. I can also see in the source that you did not copy the part I was giving you. Another consideration: Is the space where you want the picture + text wide enough for 2? I don't think so. -
Display data in two columns rather than one
EdwinPaul replied to Corinthian's topic in PHP Coding Help
I checked it again, but I don't see what can be wrong. What is (not) happening? -
$message = "This is a multi-part message in MIME format.\n\n" . should be: $message .= "This is a multi-part message in MIME format.\n\n" . // mark the extra dot before the = !!
-
From http://www.php.net/manual/en/features.file-upload.post-method.php :
-
It means you have to change if ((($_FILES["file"]["type"] == "text/csv")) to: if ((($_FILES["file"]["type"] == "application/vnd.ms-excel"))
-
Cant Find a Single Login Script Tutorial That Works!!!
EdwinPaul replied to batstanggt's topic in PHP Coding Help
Change the next line: <form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post"> To: <form action="" method="post"> -
Display data in two columns rather than one
EdwinPaul replied to Corinthian's topic in PHP Coding Help
Try this: $showroom_query = mysql_query('SELECT * FROM `showroom` ORDER BY `showroom` ASC;'); if(mysql_num_rows($showroom_query) > 0) { $columns=2; $counter=1; while($showroom = mysql_fetch_array($showroom_query)) { echo '<a href="advanced_search.php?showroom='.$showroom['showroom_id'].'"><img width="243" height="42" src="images/showrooms/showroom_'.$showroom['showroom_id']'._1.gif" alt="">'.$showroom['showroom'].'</a>'; $counter++; if($counter>$columns) { echo '<br/>'; $counter=1; } } }else{ echo 'No results.'; } include_once "includes/footer.php"; -
<tr> <?php if($row['accounts'] != ''){ echo "<td>".$row['accounts']."</td>"; } // but you will have a problem with the table-heading... ?> </tr> [code]
-
PHP Script works in Chrome, but not IE or Firefox?
EdwinPaul replied to fRAiLtY-'s topic in PHP Coding Help
The correct way to check if a form is submitted is NOT: // Check if form is submitted if(isset($_POST['login'])) { Some browsers do not sent the submit-button if you hit enter. You can check this by displaying the array $_POST before the line mentioned above. Better is: if ($_SERVER['REQUEST_METHOD'] == 'POST' ){ -
Cant Find a Single Login Script Tutorial That Works!!!
EdwinPaul replied to batstanggt's topic in PHP Coding Help
If you put those two lines on top of your script, you may see more (error-)messages: ini_set('display_errors',1); error_reporting(E_ALL | E_STRICT);