Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. Is there anyway to trim white space from a string but at the same time replace that white space with something?
  2. alright, I will have to try that. Is there a way to look for entities within the HTML tag (EX: <p class="header">) like i would want to take out the class="header"
  3. I have a backend that you can create posts with, well it will write html for you in the text editor and when the information is dumped into the DB it keeps the html content. So there are <h4>, <p>, <span>, <br />, and many other tags that are inserted. Well I developed a tool with this backend that will allow for a person to select a post (that is approved and previously written) and will allow for a person to email the post to someone. I am looking to have PHP take the post out of the DB and strip out the class = "someclass" and style = " "
  4. Ok... how would i skim through a mysql post searching for a particular word or words? I am having a brain fart lol. Like I have a sql field that would contain HTML and I need for my php script to skim through the field and search for the word style or class and take out the word along with anything in quotes.
  5. I have done some minor javascript but nothing really major. I have used jQuery for a lot of stuff I have done (I know, I know its cheating, please don't hate me for it), but I need help with writing a function that will display a group of images at random with text that corresponds to the image and the images cannot repeat. LOL any help at all is grealy appreciated! Thanks!
  6. ok so here is all of the code I am using $query = mysql_query("SELECT * FROM devotionals WHERE writer = 'dennis'"); while($results = mysql_fetch_array($query)) { $devotional_query = '<li><a href="#">' . $results['devotional_title'] . '</a></li>'; } $login = '<a class="title">Login</a> <div> <form action="index.php?action=login" method="post"> <label>Username:</label> <input type="text" name="username" id="username" /> <label>Password: </label> <input type="password" name="password" id="password" /> <input type="image" src="images/login.jpg" id="submit" /> </form> </div>'; $logout = '<a class="title">My Profile</a> <div> <ul> <li><a href="index.php">Home</a></li> <li><a href="profile.php?tool=changepw">Change Password</a></li> <li><a href="profile.php?tool=addfriend">Signup A Friend</a></li> <li><a href="index.php?action=logout">Logout</a></li> </ul> </div> <a class="title">Devotionals</a> <div> <ul> ' . $devotional_query . ' </ul> </div> <a class="title">Topics</a> <div> <ul> <li><a href="#">Testing</a></li> </ul> </div>'; I thought I could just call the variable $devotional_query?
  7. I have a while loop that is only grabbing one entry out of the database when there are multiple that it should be grabbing... $query = mysql_query("SELECT * FROM devotionals WHERE writer = 'dennis'"); while($results = mysql_fetch_array($query)) { $devotional_query = '<li><a href="#">' . $results['devotional_title'] . '</a></li>'; } there are at least two from the writer dennis. and it is only displaying one
  8. problem solved I added this little bit of code: popUpWindow('../email/emailafriend.php?url=<?php echo "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?> And then i passed the variable to my emailafriend page and it all works
  9. I have developed an email script that grabs the previous url and drops it into the php email. The problem is, is that the company that has implemented my code is using javascript to open up a new window to fill out the form i created. When doing this the HTTP_REFERRER $_SERVER variable is lost. Anyway of still requesting the referred url?
  10. ok problem solved! LOL! I changed my PHP Version to 5.2.X on my hosting services and I placed the ob_ information in the respective places. Thanks for the help!
  11. Here is my code: <?php require "includes/sql.php"; $action = $_GET['action']; if($_POST) { if($_POST['username'] || $_POST['password']) { $_SESSION['username'] = stripslashes($_POST['username']); $_SESSION['password'] = stripslashes($_POST['password']); } } switch($action) { case "login": $result = mysql_query("SELECT * FROM users where username = '".mysql_real_escape_string($_SESSION['username'])."' AND password = '".mysql_real_escape_string($_SESSION['password'])."'") or die(mysql_error()); $num_rows = mysql_num_rows($result); header("location:index.php"); exit; break; case "logout": session_destroy(); header("location:index.php"); exit; break; } $login = '<a class="title">Login</a> <div> <form action="index.php?action=login" method="post"> <label>Username:</label> <input type="text" name="username" id="username" /> <label>Password: </label> <input type="password" name="password" id="password" /> <input type="image" src="images/login.jpg" id="submit" /> </form> </div>'; $logout = '<a class="title">My Profile</a> <div> <ul> <li><a href="changepw.php">Change Password</a></li> <li><a href="change-email.php">Change Email Address</a></li> <li><a href="devotionals.php">Devotionals I wrote</a></li> <li><a href="index.php?action=logout">Logout</a></li> </ul> </div> <a class="title">Tools</a> <div> <ul> <li><a href="#">Testing</a></li> </ul> </div> <a class="title">Devotionals</a> <div> <ul> <li><a href="#">Testing</a></li> </ul> </div> <a class="title">Topics</a> <div> <ul> <li><a href="#">Testing</a></li> </ul> </div>'; ?> <div class="accordion"> <?php if(!$_SESSION) { echo $login; } else { echo $logout; } ?> </div> <!-- CLOSES ACCORDION DIV --> Anyone got any ideas? This file is included in the header.php file, in which the header.php is included in the index.php file.
  12. in firefox my thank you for signing up shows up, in IE i get a blank black page and the form information is lost here is my code: <?php $action = $_GET['action']; switch($action){ case "signup": if(isset($_POST['submit'])) { $filename = "data.txt"; $open = fopen($filename, "a+"); $fname = stripslashes(ucwords($_POST['fm-firstname'])); $lname = stripslashes(ucwords($_POST['fm-lastname'])); $email = stripslashes($_POST['fm-email']); $address = stripslashes($_POST['fm-addr']); $city = stripslashes($_POST['fm-city']); $state = stripslashes($_POST['fm-state']); $zip = stripslashes($_POST['fm-zipcode']); $telephone = stripslashes($_POST['fm-telephone']); $fax = stripslashes($_POST['fm-fax']); $mobile = stripslashes($_POST['fm-mobile']); $comments = stripslashes($_POST['fm-comments']); if(stripslashes($_POST['newsopt']) == 'yes') { $opt = "yes"; } else { $opt = "no"; } fwrite($open, "First Name:\t$fname\n"); fwrite($open, "Last Name:\t$lname\n"); fwrite($open, "Email:\t$email\n"); fwrite($open, "Address:\t$address\n"); fwrite($open, "City:\t$city\n"); fwrite($open, "State:\t$state\n"); fwrite($open, "Zip Code:\t$zip\n"); fwrite($open, "Telephone:\t$telephone\n"); fwrite($open, "Fax:\t$fax\n"); fwrite($open, "Mobile:\t$mobile\n"); fwrite($open, "Comments:\t$comments\n"); fwrite($open, "Future Updates?:\t$opt\n\n"); fwrite($open, "------------------------------------\n\n"); fclose($open); echo '<table align="center" id="Table_01" width="611" height="777" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" colspan="3" background="images/paperback2_01.jpg" width="611" height="100"> </td> </tr> <tr> <td background="images/paperback2_02.jpg" width="35" height="578"></td> <td background="images/paperback2_03.jpg" width="538" height="578" valign="top"><div class="congrats">Thanks for signing up ' . $fname . '!<br /><br /> <a href="index.html">Vist home page again?</a></div> </td> <td background="images/paperback2_04.jpg" width="38" height="578"></td> </tr> <tr> <td colspan="3" background="images/paperback2_05.jpg" width="611" height="99"></td> </tr> </table>'; } break; exit; default: echo ' <table align="center" id="Table_01" width="611" style="height: 777px" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" colspan="3" background="images/paperback2_01.jpg" width="611" height="100"> <p><b><font size="+2">Email Request</font></b><br /> <font size="-1">*Fields in <strong>bold</strong> are required. </font></p> </td> </tr> <tr> <td background="images/paperback2_02.jpg" width="35" height="578"> </td> <td align="center" background="images/paperback2_03.jpg" width="538" height="578"> <!-- Form begins--> <div align="center" id="container"> <!-- p id="fm-intro" required for "hide optional fields" function --> <form id="fm-form" method="post" action="signup.php?action=signup"> <fieldset style="margin-bottom:0px;"> <span style="font-family:Arial, Helvetica, sans-serif; font-size:16px;"><b>Personal information</b></span> <div class="fm-req" style="margin-top:5px; margin-bottom:3px; font-size:12px"> <label for="fm-firstname">First name:</label> <input name="fm-firstname" type="text" id="fm-firstname" class="required" size="25" /> </div> <div class="fm-req" style="margin-bottom:3px;font-size:12px"> <label for="fm-lastname">Last name:</label> <input name="fm-lastname" type="text" id="fm-lastname" class="required" size="25" /> </div> <div class="fm-req" style="margin-bottom:8px; font-size:12px"> <label for="fm-email">Email:</label> <input name="fm-email" type="text" id="fm-email" tabindex="" class="required" size="25" /> </div> </fieldset> <fieldset style="margin-bottom:0px;"> <span style="font-family:Arial, Helvetica, sans-serif; font-size:16px;"><b>Contact Information</b></span> <div class="fm-opt" style="margin-top:5px; font-size:12px"> <label for="fm-addr">Address:</label> <input name="fm-addr" type="text" id="fm-addr" size="25" /> </div> <div class="fm-opt" style="font-size:12px"> <label for="fm-city">City or Town:</label> <input name="fm-city" type="text" id="fm-city" size="25" /> </div> <div class="fm-opt" style="font-size:12px"> <label for="fm-state">State:</label> <span class="fm-opt" style="font-size:12px"> <select id="fm-state" name="fm-state"> <option value="" selected="selected">Choose a State</option> <option value="UNK">Outside US / Canada</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AB">Alberta</option> <option value="AS">American Samoa</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="AA">Armed Forces Americas</option> <option value="AE">Armed Forces Europe</option> <option value="AP">Armed Forces Pacific</option> <option value="BC">British Columbia</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District Of Columbia</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="GU">Guam</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MB">Manitoba</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NB">New Brunswick</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NF">Newfoundland</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="MP">Northern Mariana Is</option> <option value="NT">Northwest Territories</option> <option value="NS">Nova Scotia</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="ON">Ontario</option> <option value="OR">Oregon</option> <option value="PW">Palau</option> <option value="PA">Pennsylvania</option> <option value="PE">Prince Edward Island</option> <option value="PQ">Province du Quebec</option> <option value="PR">Puerto Rico</option> <option value="RI">Rhode Island</option> <option value="SK">Saskatchewan</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VI">Virgin Islands</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> <option value="YT">Yukon Territory</option> </select> </span></div> <div style="margin:0px 0px 3px 0px; font-size:12px;"> <label for="fm-zipcode">Zip code:</label> <input type="text" size="25" name="fm-zipcode" /> </div> <div class="fm-opt" style="font-size:12px;"> <label for="fm-telephone">Telephone:</label> <input name="fm-telephone" type="text" id="fm-telephone" title="Enter Phone Number in xxx-xxx-xxxx format" size="25" /> </div> <div class="fm-opt" style="font-size:12px"> <label for="fm-fax">Fax:</label> <input name="fm-fax" type="text" id="fm-fax" title="Enter Fax Number in xxx-xxx-xxxx format" size="25" /> </div> <div class="fm-opt" style="font-size:12px"> <label for="fm-mobile">Mobile:</label> <input name="fm-mobile" type="text" id="fm-mobile" size="25" /> </div> <div class="fm-opt" style="margin-bottom:0px; font-size:12px"> <label for="fm-comments">Comments:</label> <textarea name="fm-comments" cols="24" rows="3" id="fm-comments"></textarea> </div> <div align="center" class="fm-multi" style="margin-top:3px;"> <div align="center" class="fm-opt"> <p style="margin-bottom:3px;"><b>Would you like to be notified of future updates?</b></p> <label for="fm-newsopt-yes" style="font-size:12px"> <input name="newsopt" id="fm-newsopt-yes" value="yes" checked="checked" type="radio" /> Yes</label> <label for="fm-newsopt-no" style="font-size:12px"> <input id="fm-newsopt-no" name="newsopt" value="no" type="radio" /> No</label> </div> </div> </fieldset> <div id="fm-submit" class="fm-req"> <input name="submit" type="image" src="images/submit.png" value="submit" align="top" alt="send" /> </div> </form> </div> </td> <td background="images/paperback2_04.jpg" width="38" height="578"> </td> </tr> <tr> <td colspan="3" background="images/paperback2_05.jpg" width="611" height="99"> </td> </tr> </table> <!-- End ImageReady Slices -->'; break; exit; } ?>
  13. LOL yeah tell me about it, or i could host it myself!
  14. hmmm, i reckon i will contact my hosting company. I tried it and it still didn't work
  15. and when you try to click on the logout button nothing happens
  16. nope didn't work! And when i login the Else statement is displayed but the username does not pass through for some reason
  17. ok sorry about not getting back with yall until now, Here is my updated code: <?php require "includes/sql.php"; $action = $_GET['action']; session_start(); ob_start(); $_SESSION['username'] = stripslashes($_POST['username']); $_SESSION['password'] = stripslashes($_POST['password']); $username = $_SESSION['username']; $password = $_SESSION['password']; switch($action) { case "login": $result = mysql_query("SELECT * FROM users where username = '$username' AND password = '$password'") or die("ERROR: " . mysql_error()); $num_rows = mysql_num_rows($result); if($num_rows > 0) { header("location: index.php?username=" . $username . ""); } else { header("location: index.php"); } break; case "logout": session_start(); session_destroy(); ob_end_flush(); header("location: index.php"); exit; break; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin Section</title> <link href="adminstyles.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="header"> <?php if($_SESSION['username'] == "") { ?> <div class="headertext">Admin Section! Please login below</div> </div> <div class="login"> <form action="index.php?action=login" method="post"> <div class="logincredentials">Username: <input type="text" name="username" id="username" /></div> <div class="logincredentials">Password: <input type="password" name="password" id="password" /></div> <input type="submit" value="Login" /> </form> </div> <?php } else { ?> <div class="headertext">Admin Section! Welcome <?php echo $_SESSION['username']; ?> <a href="index.php?action=logout">Logout?</a></div> </div> <?php } ?> </body> </html>
  18. thats odd cause it is passing the username to the url but will not print it out
  19. ok so the login problem is solved, but the username is not echoing out in the else statement
  20. I am not sure why my script is acting weird. It passes the username to the URL but the else statement does not act right. I gotta start going to bed earlier lol. <?php require "includes/sql.php"; $action = $_GET['action']; session_start(); ob_start(); $_SESSION['username'] = stripslashes($_POST['username']); $_SESSION['password'] = stripslashes($_POST['password']); $username = $_SESSION['username']; $password = $_SESSION['password']; switch($action) { case "login": $result = mysql_query("SELECT * FROM users where username = '$username' AND password = '$password'"); $num_rows = mysql_num_rows($result); if($num_rows > 0) { header("location: index.php?username=" . $username . ""); } else { header("location: index.php"); } break; case "logout": session_destroy(); header("location: index.php"); exit; break; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin Section</title> <link href="adminstyles.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="header"> <?php if(!$username) { ?> <div class="headertext">Admin Section! Please login below</div> </div> <div class="login"> <form action="index.php?action=login" method="post"> <div class="logincredentials">Username: <input type="text" name="username" id="username" /></div> <div class="logincredentials">Password: <input type="password" name="password" id="password" /></div> <input type="submit" value="Login" /> </form> </div> <?php } else { ?> <div class="headertext">Admin Section! Welcome <?php $username; ?></div> </div> <?php } ?> </body> </html>
  21. well the reason i was wondering if this could be done is because there are a lot of times that our server doesn't always load the latest and greatest updated code. So if you are coding and uploading a lot and not paying attention you forget to do a hard refresh at times. Just wondering
  22. Is there a way in PHP to tell a particular page (or whole website) to not cache in a users cookies?
×
×
  • 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.