PHP - Probably Really Dumb But
How do i go about the tags in this, with the elseifs really lost in the past ive done it different and included exits and such but i want it to display at the top of the page and not go onto a whole new page to say the error, sorry if im making little sense just kinda baffled
Code: [Select] <?php if($playerdata['is_admin'] == 1){ $result = mysql_fetch_array($query); if($_POST){ $price = mysql_real_escape_string($_POST['price']); $creditprice = mysql_real_escape_string($_POST['creditprice']); $ItemType = mysql_real_escape_string(isset($_POST['ItemType'])); $description = mysql_real_escape_string($_POST['description']); $image = mysql_real_escape_string($_POST['image']); $name = mysql_real_escape_string($_POST['name']); if($name == ""){ echo "You must enter an item name.<br><br>"; elseif ($description == ""){ echo "You must enter a description for this item.<br><br>"; elseif ($description2 == ""){ echo "You must enter a Character Req for this item.<br><br>"; elseif ($description3 == ""){ echo "You must enter a What item does for this item.<br><br>"; elseif ($ItemType == ""){ echo "You must select a item type.<br><br>"; elseif ($price == ""){ echo "You must select a price for this item.<br><br>"; elseif ($creditprice == ""){ echo "You must select a game credit price.<br><br>"; }else{ $sql = "INSERT INTO items(name,image,description,ItemType) VALUES ('$name', $image', '$description', '$ItemType')"; mysql_query($sql); echo "You have created $name<br /><br />"; ?> Similar Tutorialswould anyone please help me work out why this is not working and even if I use the || operators it still wont work <?php $referer = $_SERVER['HTTP_REFERER']; if ($referer != 'http://digitalpixels.co.uk/portfolio' ) header('Location: http://digitalpixels.co.uk/404/') ; if ($referer != 'http://digitalpixels.co.uk/windscreen-repair-company' ) header('Location: http://digitalpixels.co.uk/404/') ?> thank you I have a script and for some reason I can't get to echo "No results" when nothing matches. I know it is something simple but I can't see it. Can anyone help? Code: [Select] <?php mysql_connect ("localhost", "","") or die (mysql_error()); mysql_select_db (""); $search = mysql_real_escape_string(preg_replace('/[^\w\'\"\@\-\.\,\(\) ]/i', '', $_POST['search'])); if(strlen($search) < 3){ echo "<br /><input type='image' value='Back' src='images/min.png' alt='Back' onClick='history.go(-1);return true;'></FORM>"; } else{ $sql = mysql_query("SELECT * FROM apartments WHERE contact LIKE '%$search%' OR phone LIKE '%$search%' OR office LIKE '%$search%' OR town LIKE '%$search%' OR cross_streets LIKE '%$search%' OR description LIKE '%$search%' OR email LIKE '%$search%' OR rent LIKE '%$search%' order by `date_created`"); if ( mysql_num_rows($sql) > 0 ) { echo "<strong style='color: #6EBEFB'>Click Headers to Sort</strong>"; echo "<br/><strong style='color: #6EBEFB'>Your Results for: </strong>"; echo htmlentities($_POST['search']); echo "<table border='0' align='center' bgcolor='#6EBEFB' cellpadding='2' bordercolor='#000000' table class='sortable' table id='results'> <tr> <th style='color: #FFF'> Title </th> <th style='color: #FFF'> Rent </th> <th style='color: #FFF'> Bed </th> <th style='color: #FFF'> Bath </th> <th style='color: #FFF'> Contact </th> <th style='color: #FFF'> Office </th> <th style='color: #FFF'> Phone </th> <th style='color: #FFF'> Image </th> </tr>"; while ($row = mysql_fetch_array($sql)) { $image = (!empty($row['imageurl1'])) ? "<img src=\"../user/{$row['imageurl1']}\" width='50'>" : 'No Images'; echo "<tr> <td bgcolor='#FFFFFF' style='color: #000' align='center'> <a href='searchapts/index.php?id=".$row['id']."'>" . $row['title'] . "</a></td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['rent'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['rooms'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['bath'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['contact'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['office'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['phone'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>{$image}</td> </tr>"; } } echo "</table>";} { echo "No Results";} ?> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=357731.0 I have been reading (here and on the internet) about login security, and I have now formulated a dumb question to ask. Not having a secure connection is there any way to NOT send plain text over the internet. In other words, when you have a login form plain text is entered. It is then passed to some type of encryption (hash, md5, sha1) BUT is the password always vulnerable between these two? And just for the record I am asking this because McAfee Secure is giving me a rash of (insert your favorite word here) about my login form which encrypts using sha1. im not getting anything to display. any ideas? Code: [Select] <? include "config.php"; $groups=mysql_query("SELECT ID,company,address FROM company"); while(list($cid,$ccompany,$caddress)=mysql_fetch_row($groups)){ echo "<left><br />headlogo <table width='96%' cellpadding='1' cellspacing='1' border='1'> <tr> <td width='37%' colspan='4'><b>gname</b></td> </tr> <tr> <td width='25%'>Ladder</td> <td width='25%'>Game</td> <td width='25%'>Join</td> <td width='25%'>Rules</td> </tr>"; $ladders=mysql_query("SELECT id,jobNO,companyID FROM jobno WHERE grid='$gid' ORDER BY name"); while(list($jid,$jjobNO,$jcompanyID)=mysql_fetch_row($ladders)){ echo " <tr> <td width='25%'>$link</td> <td width='25%''>$glink</td> <td width='25%'>d</td> <td width='25%'>d</td> </tr>"; } echo "</table></left>"; } echo "<br /><br />"; ?> |