Jump to content

laffin

Members
  • Posts

    1,200
  • Joined

  • Last visited

Everything posted by laffin

  1. The link provided with the META tag dusn need sleep, it provides it for u.
  2. try this <?php require ('session.php'); include ('db_connect.php'); $email = $_SESSION['email']; if(isset($_POST['submit'])) { $displayname = $_POST['displayname']; $displaytype = $_POST['displaytype']; $description = $_POST['description']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $postal = $_POST['postal']; $country = $_POST['country']; $website = $_POST['website']; mysql_query("UPDATE users SET displayname = '$displayname', displaytype = '$displaytype', description = '$description', address = '$address', address2 = '$address2', city = '$city', state = '$state', postal = '$postal', country = '$country', website = '$website' WHERE email='$email'"); } $sql = "SELECT * FROM users WHERE email='$email'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_array($result); $id = $row["id"]; $displayname = $row['displayname']; $displaytype = $row['displaytype']; $description = $row['description']; $address = $row['address']; $address2 = $row['address2']; $city = $row['city']; $state = $row['state']; $postal = $row['postal']; $country = $row['country']; $website = $row['website']; } else { die("No user found"); } } else { die(mysql_error()); } ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <td><a href="user.php?action=editprofile">Edit Profile</a> | <a href="submit.php">Add Entry</a> | <a href="user.php?action=edit">Edit Display</a> | <a href="user.php?action=images">Edit Images</a> | <a href="logout.php">Log Out</a></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td> </td> <tr> <td> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr> <td>Display Name*</td><td><input name="displayname" value="<?php echo $displayname; ?>" size="40" type="text"></td></tr> <tr> <td>Display Type*</td><td><select name="displaytype"><option value="Residential">Residential</option><option value="Neighborhood">Neighborhood</option><option value="Commercial">Commercial</option><option value="City/Government">City/Government</option><option value="Sponsored">Sponsored</option></select></td></tr> <tr><td>Description*</td><td><textarea name="description" cols="30" rows="5"><?php echo $description; ?></textarea></td></tr> <tr><td>Address*</td><td><input name="address" value="<?php echo $address; ?>" size="40" type="text"></td></tr> <tr><td>Address 2</td><td><input name="address2" value="<?php echo $address2; ?>" size="40" type="text"></td></tr> <tr><td>City*</td><td><input name="city" size="30" type="text" value="Mesquite"></td></tr> <tr><td>State/Province*</td><td><input name="state" size="30" type="text" value="Texas"></td></tr> <tr><td>Postal Code*</td><td><select name="postal"><option value="75149">75149</option><option value="75150">75150</option><option value="75180">75180</option><option value="75181">75181</option><option value="75185">75185</option><option value="75187">75187</option></select></td></tr> <tr><td>Country*</td><td><input name="country" size="30" type="text" value="United States"></td></tr> <tr><td>Website</td><td><input name="website" size="50" value="<?php echo $website; ?>" type="text"></td></tr> <tr><td> </td></tr> <tr> <td colspan="2" style="border-top: 1px solid black;" align="left"> <br /> * Fields are required.</td> <td colspan="2" style="border-top: 1px solid black;" align="right"> <br /> <input type='submit' name='submit' value='Update'></td></tr> </tbody> </table></form> </td> </tr> </table>
  3. Dun see why not preg_replace("@[^\s\x21-\x7e]@i",'',$body);
  4. maybe putting them all into one pattern wud help u better? preg_match_all('@(<td\s+(?:class)?\s*=\s*"(.*)"\s*>(.*?)</td\s*>)@i',$file,$result); which resulted in a print_r like so: Array ( [0] => Array ( [0] => <td class="values">778</td> [1] => <td class="col1 left">Earned</td> [2] => <td class="col2">49 of 49</td> ) [1] => Array ( [0] => <td class="values">778</td> [1] => <td class="col1 left">Earned</td> [2] => <td class="col2">49 of 49</td> ) [2] => Array ( [0] => values [1] => col1 left [2] => col2 ) [3] => Array ( [0] => 778 [1] => Earned [2] => 49 of 49 ) ) which now ya can move array 2 & 3 into an array pair $values=array_combine($resullt[2],$result[3]); which will give you access to your vars as $values['values'] $values['col1 left'] $values['col2']
  5. U dun undertsand how preg_match_all works, it's doing exactly as u told it.... preg_match_all is returning an array, with arrays of the groups captures. since u only have 2 groups, u will have an array of an array with 3 arrays 1st array the match string itself 2nd array the first capture group 3rd array the 2nd capture group from the looks of things you want to process the 3rd array, your 2nd capture group. return $links[2] wud return an array of each (an array) but to display an item from those links $links[2][0] wud be the first item caught or use a foreach($links[2] as $link) echo "$link<br>";
  6. than why do u need parentids for both? u only need one table. just set parentid to 0 when there is no parent. catid | catname | parentid 10 main 0 12 child 10 15 child3 12 16 child5 10 17 main2 0 thus u can get all root categories with SELECT * from tbl_catageories WHERE parentid=0; which wud return both main and main2 to see what child categories under main wud be SELECT * from tbl_catageories WHERE parentid=10; the parentid shud also help u traverse this category tree in reverse.
  7. but that wud also overlay. say 0607 0708 both wud contain all info from 07. Extracting isnt the issue here, it's the calculation of year to year. so u wud need to convert 0607 to start and end timestamps. function getacyear($acyear) { $mil=(substr($acyear,0,1)=='0'?"20":"19") $date['start']=$mil . substr($acyear,0,2). "-09-01"; $date['end']=$mil . substr($acyear,2,2) . "-06-01"; return $date; } the start/end date are designated as "YYYY-MM-DD" so change accordingly now when searching in mysql, you can get and use these codes with $sedate=getacyear($acyear); $query = "SELECT * FROM tbl_name WHERE date >= $sedate[start] AND date <= $sedate[end];" or however yer query goes good lick
  8. intval($val) floor($val) either shud do the trick.
  9. The first part retrieves a user record or dies, which is fine 2nd part, it gets the POST info, which isn't ok. 3rd it checks 'submit' for? and does an update OR it displays the user info on 2nd part, why replace variables if submit wasn't pushed? on 1st pass, ya will get empty variables, cuz there is no POST info (so fields will be blank) on 3rd, use isset($_POST['submit']) now it's checking the existance of a POST move the 2nd part into this section of the if statement remove the } else { and it's matcing } okay now ya got that done move the if $_POST section above the 1st part this way it updates the record, before retrieving the record than it always will display the record. that shud do it
  10. If the intermediate pages are on yer site, u can use something like html meta refresh tag providing u with the timeout u need as well as the redirect. however if the pages in question are not on yer site. you may have to use frames and some javascript.
  11. You might have to use 2 preg statements. one to filter the words from the body of the subject. see preg_replace_callback than use the callback function to test the individual words against a list of bad words, using preg_match. if preg_match catches a bad word, it can return the [censored] tag or what have u, otherwise return the original word sent by preg_replace_callback. thats if u want the flexibility of using regular expressions
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.