PHP - Remove Bullet Point
Hi all,
I am using cURL to return some information. I turn that information into a string. Unfortunately the string when printed has a bullet point. I've been playing with urldecode and rawurldecode to try and get rid of it but then I am left with =%3CLI%3EInvalid+expiry+date%3Cbr% When all I want is Invalid expiry date The messages may vary though, and there could be more than one bullet point. Any suggestions would be great. Thanks, Similar TutorialsHi everyone, I have this code to help me split a long paragraph into sentences and make every new sentence into a new line. Now i want to insert a bullet point, or a arrow in font of every line. I try many different approaches, but it didn't work. Can anyone point me to the right direction. Thanks for your help. Vanvoquan. Code: [Select] <table border="1" bordercolor="red"> <tr> <td> <p><?php echo stripslashes(str_replace('. ', '.<br />', $product_info['products_description'])); ?></p> </td> </tr> </table> i have this while loop making my category links at the top of my page, but i still have the bullet after the last item. ive looked at other examples and CANNOT get mine to follow suit...help please? Code: [Select] $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $query1 = "SELECT * FROM ob_category"; $data1 = mysqli_query($dbc, $query1); while($row=mysqli_fetch_array($data1)){ echo '<a href="viewlistings.php">' . $row['name'] . '</a> • '; } I have been following an article on creating bullet proof sessions but I'm having problems with session variables i'm creating getting destroyed
I call the session_start() like this
SessionManager::sessionStart('MySession', 0, '/', 'localhost');But when i try to add new session vars, i think the preventHijacking() function is is getting called for some reason and it wipes out the session and creates a new one. Any ideas how I can get this to work? Here is the link http://blog.teamtree...tproof-sessions And here is the complete code class SessionManager{ static function sessionStart($name, $limit = 0, $path = '/', $domain = null, $secure = null) { // Set the cookie name session_name($name . '_Session'); // Set SSL level $https = isset($secure) ? $secure : isset($_SERVER['HTTPS']); // Set session cookie options session_set_cookie_params($limit, $path, $domain, $https, true); session_start(); // Make sure the session hasn't expired, and destroy it if it has if(self::validateSession()) { // Check to see if the session is new or a hijacking attempt if(!self::preventHijacking()) { // Reset session data and regenerate id $_SESSION = array(); $_SESSION['IPaddress'] = $_SERVER['REMOTE_ADDR']; $_SESSION['userAgent'] = $_SERVER['HTTP_USER_AGENT']; self::regenerateSession(); // Give a 5% chance of the session id changing on any request } elseif(rand(1, 100) <= 5) { self::regenerateSession(); } } else { $_SESSION = array(); session_destroy(); session_start(); } } static protected function preventHijacking() { if(!isset($_SESSION['IPaddress']) || !isset($_SESSION['userAgent'])) return false; if ($_SESSION['IPaddress'] != $_SERVER['REMOTE_ADDR']) return false; if( $_SESSION['userAgent'] != $_SERVER['HTTP_USER_AGENT']) return false; return true; } static function regenerateSession() { // If this session is obsolete it means there already is a new id if(isset($_SESSION['OBSOLETE'])) return; // Set current session to expire in 10 seconds $_SESSION['OBSOLETE'] = true; $_SESSION['EXPIRES'] = time() + 10; // Create new session without destroying the old one session_regenerate_id(false); // Grab current session ID and close both sessions to allow other scripts to use them $newSession = session_id(); session_write_close(); // Set session ID to the new one, and start it back up again session_id($newSession); session_start(); // Now we unset the obsolete and expiration values for the session we want to keep unset($_SESSION['OBSOLETE']); unset($_SESSION['EXPIRES']); } static protected function validateSession() { if( isset($_SESSION['OBSOLETE']) && !isset($_SESSION['EXPIRES']) ) return false; if(isset($_SESSION['EXPIRES']) && $_SESSION['EXPIRES'] < time()) return false; return true; } } Edited by AdRock, 24 October 2014 - 10:23 AM. Hope this topic is ok here as i would be using php to do the encryption.. So i have just worked out how md5 hashes work- i thought md5 made passwords ultra secure - and for a password up to say 6 characters long, including numeric characters, then it is very easy to crack by doing a brute force, so i ask what is the point, i am wanting to encrpt passwords in a db and i can't see why my own 'home brew' method should be any more crackable than an md5 hash. What encrption would you recommend, so there would need to be a php class avaialble. First problem fixed. My second problem is if the result is 0X.XX,0 or 0X.XX,1 I would like to remove the first 0 The X.XX are numbers, but the 0 is not always there. Can anyone help please Thanks This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=350748.0 Hi guys, I, not sure if this post belongs here as I have no idea what the cause of my problem is. However I'm hoping i can post the problems i have and one of you guys might be able to point me in the right direction as to where the problem is. Anyway up until a few days ago i had a system set up using php and mysql for customers to login to there accounts, buy and sell items etc. Every time a client would buy or sell an item a conformation email would automatically be generated and sent out with all the correct info already saved in the email. This system would also save the buy or sell information and a system administrator could login and view this info. The problem I have right now is that, none of this information is being saved any more, and the emails are not being generated. A client can do anything they want but no details are being saved. This problem just came out of nowhere, one day its was working fine, as it has been for well over a year now and then BANG! Its not working any more. Another strange thing is that I cant even seem to login into the administrator area on any other browser than firefox? I have really no idea why that is. I would also like to add that I have made no changes to the php code or the sql data prior to this problem. and lastly I think i should mention that this same system is on another completely different server, and the system has the exact same problem. If anybody has any clues to this one, or point me in the right direction I would be most grateful, as it has me completely stumped. Thank you very much in advance. Hi Guys/Gals, I am new to PHP and when I say new, I mean I know a variable is $variable name... that is about it. I am a .Net developer, always was, now I have to learn some php. I have a .Net payment gateway service that I would like to reference from a php site. I was hoping anyone could point me in the right direction on how to go about adding a .Net Service and pointing to it in PHP. Please note this is a WPF service, thus it is a .svc page not a .asmx and it is hosted and running on iis on a server. Please some guidance? Any help would be appreciated. H guys, I have created a quiz, however what i would like to do is have something that keeps an eye on the quiz. For example if someone is taking the quiz however get 4 incorrect answers in a row then it will abort the quiz. is it something like a for loop for example.... im not sure? The code i already got is a basic quiz however im just looking on expaning it more. Thanks for any help, i appreciate it! Code: [Select] <?php session_start(); $_SESSION['dclty'] = $_POST['dclty']; ?> <?php if ($_SESSION['dclty'] == "beg") ?> <script> window.open("extrahelp.php", height=300,width=300); </script> <?php if ($_SESSION['dclty'] == "int") ?> <script> window.open("pointers.php", height=300,width=300); </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Forensics E-learning Package</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="wrapper"> <div id="header"> <div id="toplinks"> </div> </div> <div id="menu"> <ul> <li><a class="selected" href="home.html">Home</a></li> <li><a href="initialquiz.php">Initial Quiz</a></li> <li><a href="about.php">About</a></li> </ul> </div> <div id="content"> <div id="main"> <h1>Initial Quiz</h1><BR /> <form name="Forensics Test" method="post" action="detection.php"> <h1>Protection</h1> <hr /> <b>1. What does an IDS do? <BR /><BR /></b> <UL> <? if($attempted == true && !isset($q1)) { echo 'bgcolor="#FFFFCC"'; } ?> <input type="radio" name="q1" id="q1a" value="1" />An IDS evaluates a suspected intrusion once it has taken place and signals an alarm<BR><? if($q1 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q1" id="q1b" value="2">An IDS blocks intrusions before it happens and signal an alarm<BR><? if($q1 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q1" id="q1c" value="3">An IDS blocks all intrusions before it happens and monitors the network, however does not signal an alarm.<BR><? if($q1 == "1"){echo "checked=\"checked\"";} ?></UL><hr /> <b>2. What does a Firewall do?<BR /><BR></b> <UL> <? if($attempted == true && !isset($q2)) { echo 'bgcolor="#FFFFCC"'; } ?> <input type="radio" name="q2" id="q2a" value="1">Firewalls limit access once the intrusion is within a network and then signals an alarm.<BR><? if($q2 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q2" id="q2b" value="2">Firewalls limit access between networks to prevent intrusion and do not signal an attack.<BR><? if($q2 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q2" id="q2c" value="3">Firewalls limit access to a network and prevent all intrusions. An alarm to the user is raised.<br><? if($q2 == "1"){echo "checked=\"checked\"";} ?></UL><hr /> <p><b>3. What does Tripwire do?</b> </p> <UL> <? if($attempted == true && !isset($q3)) { echo 'bgcolor="#FFFFCC"'; } ?> <input type="radio" name="q3" id="q3a" value="1">Tripwire does not protect from intrusions however signals an alarm to the user that network intrusions are occurring.<BR><? if($q3 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q3" id="q3b" value="2">Tripwire does not perform system integrity checks in terms of file change, however does prevent access to a network unless otherwise stated.<BR><? if($q3 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q3" id="q3c" value="3">Tripwire helps identify changes in files. Tripwire records a set of information about all the important files in your server in case of a change.</p><? if($q3 == "1"){echo "checked=\"checked\"";} ?> <BR> </UL><hr /> <p><b>4. What type of files does a traditional anti-virus protect you from?</b> </p> <UL> <? if($attempted == true && !isset($q4)) { echo 'bgcolor="#FFFFCC"'; } ?> <input type="radio" name="q4" id="q4a" value="1">Viruses and tracking cookies<BR><? if($q4 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q4" id="q4b" value="2">Rootkits and Viruses<BR><? if($q4 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q4" id="q4c" value="3">Worms and Rootkits<BR><? if($q4 == "1"){echo "checked=\"checked\"";} ?> </UL><hr /> <p><b>5. What does an Anti-root kit protect you from?</b> </p> <UL> <? if($attempted == true && !isset($q5)) { echo 'bgcolor="#FFFFCC"'; } ?> <input type="radio" name="q5" id="q5a" value="1">Anti-rootkit protects from only viruses, key loggers and backdoors.<BR><? if($q5 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q5" id="q5b" value="2">Anti-rootkit protects from viruses, backdoors, spyware and key loggers as a collection.<BR><? if($q5 == "1"){echo "checked=\"checked\"";} ?> <input type="radio" name="q5" id="q5c" value="3">Anti-rootkit protects from only viruses and backdoors.<BR><? if($q5 == "1"){echo "checked=\"checked\"";} ?> </UL> <HR><BR /><BR /> <input type="submit" value="Go to Next Section" /> </form> </div> <div id="right"> <h2>Right Menu</h2> <div class="rightitem"> <ul> <li><a class="selected" href="home.html">Home</a></li> <li><a href="initialquiz.php">Initial Quiz</a></li> <li><a href="about.php">About</a></li> </ul> </div> </div> </div> <div class="clearbottom"></div> <div id="footer"> <p id="legal"> </p> </div> </div> </div> </body> </html> I'm just starting to research xml and I need to know if there's a specific name I should be looking for. I'm trying to read data from an xml file which is easy when all the tags are different but I've got a test file of students where alot of the data is the same. For instance: <STUDENTS> <STUDENT> <FIRSTNAME>Micheal</FIRSTNAME> <LASTNAME>Dorne</LASTNAME> <GRADE>10</GRADE> <MATHSCORE>89</MATHSCORE> <TEACHER>Flinn</TEACHER> </STUDENT> <STUDENT> <FIRSTNAME>Terry</FIRSTNAME> <LASTNAME>Williams</LASTNAME> <GRADE>11</GRADE> <MATHSCORE>78</MATHSCORE> <TEACHER>Edwards</TEACHER> </STUDENT> <STUDENT> <FIRSTNAME>Kimberly</FIRSTNAME> <LASTNAME>Jenson</LASTNAME> <GRADE>10</GRADE> <MATHSCORE>92</MATHSCORE> <TEACHER>Flinn</TEACHER> </STUDENT> </STUDENTS> I've reached a point where I need to acquire data from an xml file structured similar to this and need to know where to start. I could be looking for all the data on one specific student or acquiring a list of all student names that have the same teacher for example. I'd appreciate it if someone could point me the right direction with this. Thanks. im working on a point system for my forum where points are awarded based on actions taken. $scores = array( 'login' => 1, 'editor' => 10 ); so if a user logs in then they will be awarded 1 point, if they edit their post then they get 10 points etc. So in my login process page i process the login then award the points that it is worth with $score['login']. Everything works fine. My problem is that this is a forum package like phpbb and mybb where people download the package and can install their own forum. So i want them to be able to add to the points list. For example the admin chooses to award 10 points for every post that is made. how would i go about implementing this? the points categories would be in the database but what happens in the post processing page when i add the post to the database? how would i know that the admin wants some points awarded? the database would look like so: id title points 1 post 10 but the title can change based on the admins choosing of words. I hope i explained this ok. At which point do I use DATE_FORMAT()? On insert, on select, or ideally can I use it when I echo it out? I haven't used this function before, so I'm not too familliar with it. Can I do something like this?.. echo DATE_FORMAT($item['created_at'], '%d/%m/%Y'); I've been at this for days, and the more I read the more confusing it gets. What I want to achieve is: I have a XHTML form with 5 user input fields - These a name subject cust_email telephone details I need to create a PHP script that will on user click - submit a email that has this format (secured if possible: From= cust_email Subject= "Customer requested information on" +subject eMail body= name + "requests information on" + subject /n + details /n + "Contact information" /n +telephone +email. So the body would look some how like this: Jane Smith requests information on Botox Hello I'm interested in botox injections please contact me with pricing and availability. Thank you. Contact information. (888)555-1212 Jsmith@hotmail.com Can you or anyone of the users in this wonderful forum HELP. I'm a print designer and I can assist you guys with anything you may need in print. But web is all to new and I'm struggling. Thank you, thank you very much. Hi everyone (sorry for my bad english),
I am playing around with php but the script doesnt execute to the last point and with no error...
What i am trying to do is checking the input of the user and comparing it what is in db and then applying conditions. So i have 2 files. update.php and home.php. home.php is my html form page and i included 'update.php' in it In my update.php, i have these codes
<?php error_reporting(E_ALL); include_once('database.php'); if(isset($_POST['submit'])) { $q = $_GET['q']; $next = $q + 1; if($q == 26) { echo '<h2>You have Completed the Exam.Congrats!!</h2>'; } elseif($q <= 25){ $sql = "SELECT * FROM Students WHERE Email=?"; $stmt = $conn->prepare($sql); $stmt->bind_param('s', $_SESSION['login']); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); $Mark = $row['Mark']; $Correct = $Mark + 1; $Fail = $Mark + 0; $sqlb = "SELECT * FROM Answers WHERE qid = ?"; $stmtb = $conn->prepare($sqlb); $stmtb->bind_param('s', $q); $stmtb->execute(); $resultb = $stmtb->get_result(); $rowb = $resultb->fetch_assoc(); $Answer = $rowb['Answer']; $Pick = $_POST['ans']; if($Pick == $Answer) { $sqld = "UPDATE Students SET Mark=? WHERE Email = ?"; $stmtd = $conn->prepare($sqld); $stmtd->bind_param('ss', $Correct,$_SESSION['login']); $stmtd->execute(); $resultd = $stmtd->get_result(); echo "correct" ; } } else { echo 'Ate'; echo "<script type='text/javascript'>document.location.href='home.php?q='.$next.';</script>"; } }//post submit ?> The else statement doesnt run. so it keeps reloading the same page. Also i want to ask why i keep getting the value of 2 for my $Correct variable stored on the database into column Mark for a single correct question instead of 1. What could be wrong? Lastly, i dont want the script to run if the browser is edited by the user by changing the value of $q from the browser, because i am using get method, is there a way to do that. Please be nice with your comments. Thanks in advance.!!! imagettftext() is used to write text to an image using TrueType fonts. Size being one of the parameters: Quote The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2). An inch representing 72 points. However how is the point size calculated? Is it based on the servers/clients screen resolution? I want to compute 150 + 20.95 * 1.01 + .5 so I get '171.65'. echo (150 + 20.95 * 1.01 + .5); gives me '171.6595'. I tried echo number_format(150 + 20.95 * 1.01 + .5, 2);, but I got '171.66'. How can I go about getting '171.65'? Because I have include files in a subdirectory called "incl", I cannot rely on using relative paths because that include file is in a header on and the pages are in multiple subdirectories (or in the root). I need some way to get the location of the root (the one where my index file is located). I want to use something like this: $path= $_SERVER['DOCUMENT_ROOT']; include $path."/subdirectory/file.php"; However, when I use $_SERVER['DOCUMENT_ROOT'] I get : /home/content/j/p/f/name55/html/ which is not where the index file sits. Any ideas on how to get the directory where my index file sits? (i.e. the index that gets read when you got to www.domain.com) Hi All, I have code to generate a route in google maps on my site. The code works great in Firefox but not in IE8. It works in IE8 if you just have just a start and finish only but whe you add a waypoint in the route does not show. Any ideas? Code: [Select] <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"> </script> <script type="text/javascript"> var directionDisplay; var geocoder; var directionsService = new google.maps.DirectionsService(); var latlng = new google.maps.LatLng(54.559322587438636, -4.1748046875); function load() { geocoder = new google.maps.Geocoder(); directionsDisplay = new google.maps.DirectionsRenderer(); var myOptions = { zoom: 6, mapTypeId: google.maps.MapTypeId.ROADMAP, center: latlng, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, position: google.maps.ControlPosition.TOP_RIGHT }, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.ZOOM_PAN, position: google.maps.ControlPosition.TOP_LEFT} }; var map = new google.maps.Map(document.getElementById('map'), myOptions); directionsDisplay.setMap(map); var directionRendererOptions ={ suppressMarkers: true, polylineOptions:{ strokeColor: "#FF0000", strokeOpacity: 1, strokeWeight: 3 } }; directionsDisplay.setOptions(directionRendererOptions); var start = '<?php echo $start; ?>'; var end = '<?php echo $end; ?>'; <?php if($via != null){ echo "var points = ["; foreach($via as $point){ if($point != ""){ echo "{location:"; echo " '".$point."'"; echo "},"; } } echo "];\n"; } ?> var request = { origin:start, waypoints: points, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); geocoder.geocode( { 'address': start}, function(results, status) { var routeStart = new google.maps.Marker({ map: map, position: results[0].geometry.location, icon: './images/motorcycling.png', shadow: './images/motorcycling.shadow.png' }); }); geocoder.geocode( { 'address': end}, function(results, status) { var routeEnd = new google.maps.Marker({ map: map, position: results[0].geometry.location, icon: './images/motorcyclingend.png', shadow: './images/motorcycling.shadow.png' }); }); <?php $adverts = mysql_query("SELECT * FROM adverts WHERE ad_area = '$county' AND ad_visible='1' "); while($ad_row = mysql_fetch_array($adverts)){ $position = $ad_row[ad_postcode]; $type = $ad_row[ad_type]; echo "var position".$ad_row[ad_id]." = '".$position."'\n"; $ad_id = $ad_row[ad_id]; $pics = mysql_query("SELECT * FROM photos WHERE ad_id = '$ad_id' AND main_pic = '1'"); $pic_row = mysql_fetch_array($pics); $pic_name = $pic_row[photo_name]; $pic_name = str_replace(' ', '%20', $pic_name); ?> geocoder.geocode( { 'address': position<?php echo $ad_row[ad_id]; ?>}, function(results, status) { var marker<?php echo $ad_row[ad_id]; ?> = new google.maps.Marker({ map: map, position: results[0].geometry.location, <?php if ($type == 'accommodation'){ echo "icon: 'images/hotel.png'\n"; }elseif($type == 'fooddrink'){ echo "icon: 'images/bar.png'\n"; }elseif($type == 'essentials'){ echo "icon: 'images/motorcycle.png'\n"; } ?> }); var content = "<p><\a style='color:black;' href='./advert.php?advert=<?php echo $ad_row[ad_id]; ?>'><?php echo $ad_row[ad_company]; ?><\/a></p><img src='./thumbs/<?php echo $pic_name; ?>' />"; var infowindow<?php echo $ad_row[ad_id]; ?> = new google.maps.InfoWindow({ content: content }); google.maps.event.addListener(marker<?php echo $ad_row[ad_id]; ?>, "click", function() { infowindow<?php echo $ad_row[ad_id]; ?>.open(map,marker<?php echo $ad_row[ad_id]; ?>); }); }); Given the following example code; if a function were passed the value of $id is there a way to point to the previous or next element in the array to retrieve their values. thanks Code: [Select] $arr = array(); for( $i = 0; $i < 10; $i++ ) { $id = mt_rand() + $i; $arr[$id] = "some value"; } function getValue( $id ) { $element = $arr[$id]; //point to previous element or next element beginning from $element position } |