PHP - Related Words Captured From A Text
I'm looking for (1) a code to analyze the current page and show main words of the text, and (2) capturing similar words from the internet.
Similar TutorialsSome of you may have seen one of my many posts about email issues. Some users don't get them, and I have determined it is probably because we are marked as spam.
We are a service that grades sales team members on their phone skills. Listening to pre-recorded calls, grading and uploading them to our site, and then another part of our business looks them over and sometimes leaves a message that then get's forwarded to this persons work email.
I have determined there is ways to get marked as spam as default by not having an opt out link. This is not an option, these sales members employer has opted in, and the emails are going to work related accounts hosted at that employer. Also, if one of these staff members is not so bright, or disgruntled they may mark us as spam anyways. The bottom line is that we have very little control over whether we are or are not marked as spam.
So we want to start looking into sending text messages and this is where I start to question how good of an idea this is.
First off, if it was me, and the messages where being sent to a device that my employer did not provide, I would in no way want work related text messages coming to me. Unless there is a vested interest in getting them. IE, I'm the boss at this place and am always on the clock. What if you are on the bottom? It's just a job for you.
What if it is a pre-paid device, text messages cost money. What then? What if they don't even have, or want a cell phone?
The short of it is this. If I'm at a job that is just another job, and this employer tells me that I have to get these messages. I'm going to look for another job. I see the organizations having continuous issues and complaints from their employees. Thus us as a business having issues keeping clients.
What am I getting into here? What are your opinions on this matter? What are your recommendations as to alerting users of something on our site that we can rest assured are being received 100% of the time?
Thanks!
Nick
Hello everyone, I have a website where users are able to send and receive messages. I am trying to devise a way that I can prevent abusive messages from being sent. The best way that I can think of to do this is to use a few key words that would likely be used in an abusive message (basically, any curse word). Does anyone have any ideas on how I can check the text before it is sent for certain key words? Thanks in advance for any help or ideas. Hi all, please bare with me i am a newbie to this forum, i will try my best to provide all clear accurate information where possible, please find a below breakdown, i've had a little help from a user already but as am still getting problems and confused i will take his advise am post it in the right place ! 1) I have the below code and wish to ban specifc words, numbers and emails of my choice. 2) If the users enter a baned word etc either nothing will happen or it will forward them to another page. Please find attached index.php which is full working script of where i wish to add my banned words code too, also please find attached indextest.php containing the working script and code of bannng specfic words that i can't get to work. When i run indextest.php on my linux server the whole page displays perfectly but when you enter a baned or unbaned word and click submit nothing happens at all, so am very confused to where am going wrong. Any kind, helpfull guides to what i'm doing wrong would be highly appriciate as i do want to learn from my mistakes. All the best Steve Hi guys, I need some help in my coding, I have submitted the form, and basically I should see the success msg, which is echo '<p>Your new account has been successfully created. You\'re now ready to <a href="login.php">log in</a>.</p>'. However it wasnt appearing, and when I look into my database, I couldnt find any record which I have registered, is there something amiss in my coding? Please help, Thanks <?php require_once('123.php'); // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die(mysql_error()); if (isset($_POST['submit'])) { // Grab the profile data from the POST $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; $location = $_POST['location']; $dob = $_POST['dob']; $category = $_POST['category']; $query = "INSERT INTO practice_user (name, email, password, location, dob, category, join_date) " . "VALUES ('$name, $email', $password, $location, $dob, $category, NOW())"; mysqli_query($dbc, $query) or die(mysql_error()); // Confirm success with the user echo '<p>Your new account has been successfully created. You\'re now ready to <a href="login.php">log in</a>.</p>'; mysqli_close($dbc); } ?> Hey all, THe problem I am having is even when I check the checbox, it still sends a value of 0 to the php array and hence nothing is ever updated: Code: [Select] <input type="checkbox" name="approved[1]" value="1" checked="checked" /> <input type="checkbox" name="approved[3]" value="0" /> <input type="checkbox" name="approved[4]" value="0" /> So the second item is not checked by default. But even when I check it, my post array contains this: Code: [Select] array(2) { [1]=> string(1) "1" [3]=> string(1) "0" } Notice the "0". It should be "1" now since I checked the second option. This is the function: Code: [Select] function update(){ $vanity_url = new VanityUrl(); $checkbox = $this->input->post('approved'); //this is same thing as $_POST if(isset($checkbox)){ foreach($checkbox as $key => $value){ $vanity_url->where('id',$key)->get(); $vanity_url->approved = (int)$value; $vanity_url->save(); $vanity_url->check_last_query(); } } } That check_last_query() function outputs this: Code: [Select] UPDATE `vanity_urls` SET `approved` = 1 WHERE `id` = 1 UPDATE `vanity_urls` SET `approved` = 0 WHERE `id` = 3 So despite checking the second option it still sets it to 0. Thanks for response. Hi, This is my first post, so hopefully, you'll go easy on me. I'm a serious PHP newbie.. I have an form that calls a .php file. The php file is supposed to generate an email made up of the captured form fields and redirect the user to a 'thank you' page. The redirect works, but the email is not being generated. Here is my code: Code: [Select] <?PHP putenv("TZ=US/Central"); $time = date("M j, Y, g:i a"); $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $contact = $_POST["contact"]; $destination = $_POST["destination"]; $resort_brand = $_POST["resort_brand"]; $specific_resort = $_POST["specific_resort"]; $specialty_vacation = $_POST["specialty_vacation"]; $cruise_line = $_POST["cruise_line"]; $cruise_destination = $_POST["cruise_destination"]; $cruise_duration = $_POST["cruise_duration"]; $departDate = $_POST["departDate"]; $number_adults = $_POST["number_adults"]; $number_of_nights = $_POST["number_of_nights"]; $number_children = $_POST["number_children"]; $age1 = $_POST["age1"]; $age2 = $_POST["age2"]; $age3 = $_POST["age3"]; $age4 = $_POST["age4"]; $age5 = $_POST["age5"]; $passport = $_POST["passport"]; $handicapped = $_POST["handicapped"]; $comments = $_POST["comments"]; $recipient = "smarshall@stltoday.com, jmcginnis@post-dispatch.com, info@classictravelstl.com"; $subject = "Classic Travel quote request"; $body = "<p><b>Name:</b> $name<p><b>Email:</b> $email<p><b>Phone:</b> $phone<p><b>Contact:</b> $contact<p><b>Destination:</b> $destination<p><b>Resort Brand:</b> $resort_brand<p><b>Specific Resort:</b> $specific_resort<p><b>Specialty Vacation:</b> $specialty_vacation<p><b>Cruise Line:</b> $cruise_line<p><b>Cruise Destination:</b> $cruise_destination<p><b>Cruise Duration:</b> $cruise_duration<p><b>Departure Date:</b> $departDate<p><b>Number of Adults:</b> $number_adults<p><b>Number of Nights:</b> $number_of_nights<p><b>Number of Children:</b> $number_children<p><b>Age1:</b> $age1<p><b>Age2:</b> $age2<p><b>Age3:</b> $age3<p><b>Age4:</b> $age4<p><b>Age5:</b> $age5<p><b>Passport:</b> $passport<p><b>Handicapped:</b> $handicapped<p><b>Comments:</b> $comments"; $headers = "From: \"$name\" <$email>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "X-Mailer: Drupal\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $send = mail($recipient,$subject,$body,$headers); header( "Location: http://dmsgroup.co/classic-travel/thank_you.html" ) ; ?> The form that calls this file is he http://dmsgroup.co/classic-travel/request_info.html It was working at one point, but it's not anymore. Also, when it was working, the "specialty_vacation" field (which is a checkbox) would not pull in any data. Do I need to do something different to access checkboxes? Thanks in advance for your help! SteveMTNO I need to pass captured data, basically, a list of email addresses that are being read from a CSV file and (1st) saved to an local database, then sent over to an external source via URL string. I have everything working except - script opens the file, read and validates all emails in the specified column, and saves to local db. ISSUE: after validating then INSERTING the data into local mySQL db, I need to then pass each piece of data to an external source via URL string. Example: www.domain.com?email={$new_email} I was initially think to just add the URL in a header function but, I'm not sure if the HEADER() function the right method to pass all of the data - during the loop - via the URL string. For example, if the CSV file contain 500 emails: Q: how can I continue that loop until the last email read, passing each up to the external source via the URL string? I'm not sure if using the HEADER() function at the end of the script - but within the loop - will interate and send each capture email via that URL string. Can anyone advise a possible solution to this? thanks Hi, I'm trying to setup a quick PHP script that will grab the email from the url (see below) and after inserting into MySQL db - which is working fine - the script will complete two additional tasks: 1. send that same captured email out to a external db as in shown via http://domain1.com/insert.php?email=$lead (example), but then send to a DIFFERENT source - the originator of the lead - a portback acknowledgement using Header (sending the status and email to http://domain2.com/check.php?e=$lead&s=$status for their records). See the code below: ------------------------- Code: [Select] $lead = $_REQUEST['e_mail']; // will grab email from posted url string and assign to local variable $result = mysql_query($command); // this is just to execute the MySQL insert which works just fine but included here to explain validation below // Create API Call string to insert lead into iContact folder $requestURL = "http://domain1.com/insert.php?email=$lead"; // Execute API Call to CAKE $xml = simplexml_load_file($requestURL) or die("feed not loading"); if ($result) { $status = 1; // mark lead as sucess // send postback on lead status header("Location: http://domain2.com/check.php?e=$lead&s=$status"); } -------- Problem: I'm getting all sorts of errors with the simplexml_load_file() function and can't figure out why it won't work. Any input appreciated as this the only way I know how to pass the lead onward and then inform/update the other party of receipt of information. thanks! All other pages on my browser (Google Chrome) work, but whenever I open up register.php, I get this: Code: [Select] Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error. My register.php code: <?php include_once('includes/config.php'); include_once('functions.php'); $return_content = AccountRelated(null, null, 3); ?> <html> <head> <link rel="stylesheet" type="text/css" href="style/style.css" /> <title><?php echo $title; ?></title> </head> <body> <div class="logo"><a href="index.php"><img src="style/images/logo.png"></a></div> <center> <div class="background"> <div class="container"> <?php echo $return_content; ?> </div> </div> </center> </body> </html> functions.php <?php function AccountRelated($username, $password, $query_type) { if($query_type == 1) { $set_query = mysql_query("SELECT COUNT(d.username), u.date, u.username FROM uploads d, users u WHERE d.username = '$username' AND u.username = '$username' LIMIT 1") or die(mysql_error()); if(mysql_num_rows($set_query) == 0) { $content_return = 'Sorry, no information was found'; } else { $grab = mysql_fetch_assoc($set_query); //login information if($grab['COUNT(d.username)'] > 0) { $welcome_return = "You have uploaded ". $grab['COUNT(d.username)'] ." files. You've registered on ". $grab['u.date'] ."!"; } else { $welcome_return = "You have uploaded 0 files. You've registered on ".$grab['date'] . "!"; } } } elseif($query_type == 2) { $set_query = mysql_query("SELECT title,views,downloads,description,username,date FROM uploads LIMIT 20"); if(mysql_num_rows($set_query) == 0) { $content_return = "Sorry, there are currently no files uploaded to view."; } else { while($row = mysql_fetch_assoc($set_query) == 0) { echo $row['title']."<br/>"; } } } elseif($query_type == 3) { $username = mysql_real_escape_string($_POST['username']); $password = md5($_POST['password']); if(!$username || !$password) { $return_content = "All fields are required! <table><form action='register.php' method='POST'> <tr><td>Username</td><td><input type='text' name='username' maxlength='20'></td></tr> <tr><td>Password</td><td><input type='text' name='password' maxlength='30'</td></tr> <tr><td><input type='submit' value='Register'></td></tr> </form></table>"; AccountRelated($_POST['username'], $_POST['password'], 3); } else { $set_query = mysql_query("SELECT username FROM users WHERE username = '$username' LIMIT 1"); if(mysql_num_rows($set_query) == 0) { $return_content = "You have successfully registered the account ". $username ." with the password ". $password ."!"; } else { $return_content = "An account with this username already exists."; } } return $return_content; } else { //nothing to process } } ?> i hav this url n whenever i click on this url i get som mssg send on my mobile i hav a form whose code is Code: [Select] <form action="formprocess.php method="post"> telephone<input type="text name="telephone> <input type="submit" name="submit"> </form> i want to send telephone as parameter to this url so whenever user enters his telephone he gets d mssg after clicking on submit.....but i hav no idea how to do tht...help me somone plssssssss http://www.abc.in/smsapi/sendsms.php?sendto=9987234123&msg=your i have shopping cart i need to make the related product section in which i can show the related product when user view the product details. do i need to create any table for it ? please guide me about it. thanks Hello again! I've been trying out new things (well, new for me) in php again. This time I decided to try a real challenge and make a forum system. A friend suggested I use a class for all database functionalities. i was reluctant at first, but decided if I was going to try using classes for the first time, it might as well be with this. With some guiding help, I set up the files and gave it a visual once over to check for errors. Nothing seemed out of place, but when I loaded the page to try it out, I got this error: Quote Fatal error: Call to a member function query() on a non-object in /home/ck9/public_html/planning/forumbuild/list.php on line 20 I didn't see anything out of line, so I consulted my friend about it. He made a few small adjustment suggestions, but nothing fixed the issue. I then bugged my host about it, and he couldn't find anything wrong either. Both people are highly experienced in php, so when they say it SHOULD be working I am left rather confused. Here is list.php: Code: [Select] <?php include("db.class.php"); include("db.config.php"); $db = new databaseConnection($config['user'],$config['pass'],$config['database']); $g = $_GET['g']; $s = $_GET['s']; $t = $_GET['t']; function tablestart($a = '1') { global $db; echo "<table border='" . $a . "' cellpadding='10' cellspacing='0' align='center' width='80%' style='color: #C0C0C0'>\n"; } function contents($table, $a, $b = '1', $c = '1') { global $db; $db->query("SELECT * FROM $table"); while($row = $db->fetch_array()) { if($row['level'] <= $_SESSION['ulevel']) { echo "<tr><td width='5%'><!--indicator--></td><td width='80%'><a href='index.php?pg=h&g='" . $row['g']; if(($a > '1') && ($row['g'] == $b)) { echo "&s=" . $row['s']; if(($a > '2') && ($row['s'] == $c)) { echo "&t=" . $row['t']; } } } echo "' style='color: #C0C0C0 ; text-decoration: none'><font size='4'>" . $row['name'] . "</font><br /><fpnt size='3'>" . $row['desc'] . "</td><td width='15%'><!--last update--></td></tr>\n"; } } if(empty($_SESSION['ulevel'])) { $_SESSION['ulevel'] = '0'; echo "<font color='#CC0000'><center>You need to register to post in these forums.</center></font><br />\n"; } if(empty($g)) { tablestart(); contents('group', '1'); echo "</table>\n"; } elseif(empty($s)) { tablestart(); contents('section', '2', $g); echo "</table>\n"; } elseif(empty($t)) { tablestart('0'); echo "<tr><td width='80%'></td><td><!--new topic--></td></tr>\n</table>\n"; tablestart(); contents('topic', '3', $g, $s); echo "</table>\n"; } elseif(!empty($t)) { tablestart('0'); echo "<tr><td width='80%'></td><td><!--new topic and reply--></td></tr>\n</table>\n"; $data = file_get_contents('topics/g' . $g . 's' . $s . 't' . $t . '.txt'); $post = explode("<!--p-->", $data); $length = count($post); tablestart('1'); for($z = '0'; $z < $length; $z ++) { $i = '0'; $cont = explode("<!--e-->", $post[$pos]); echo "<tr><td><b>" . $cont[$i] . "</b><br /><!--future additions--></td><td>\n<table width='100%' style='font-size: xx-small'>\n<tr><td height='3' width='75%'>"; $i ++; echo "Posted on" . $cont[$i] . "</td><td height='3' width='25%'><!--future additions--></td></tr><tr><td width='100%'>"; $i ++; echo $cont[$i] . "</td></tr></table></td></tr>\n"; } echo "</table>\n"; } ?> My aim here was to have a single page to display the groups, sections, topics, and posts in order to keep database calls where I could find them easily. and here is the class file: Code: [Select] <?php class databaseConnection { protected $link; protected $lastResult; function databaseConnection($user,$pass,$database) { $this->link = mysql_connect("localhost",$user,$pass); if( !$this->link ) { die('Vital information missing.'); } else { mysql_select_db($database,$this->link) or die('could not find database: ' . mysql_error()); } } function query($query) { $this->lastresult = mysql_query($query) or die('MySQL error: ' . mysql_error()); return $this->lastresult; } function fetch_array($result = false) { if(!$result) { return mysql_fetch_array($this->lastresult); } else { return mysql_fetch_array($result); } } } ?> I have tried everything from adjusting the php tags to putting the class directly in the page. The config file just provides the user, pass, and which database to connect to. I've checked it's formatting a few times just in case. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=310658.0 I have two related websites which utilize the same database: Main website for public use. Admin website for administration purposes.Currently, I have both located in /var/www/combined-app which is a single git repository and contains the following: /var/www/combined-app/ public/ public-admin/ src/ main/ admin/ vendor/ composer.json bootstrap.php Alternatively, I could have done the following: /var/www/combined-app/ main/ public/ src/ vendor/ composer.json bootstrap.php admin/ public/ src/ vendor/ composer.json bootstrap.php Or maybe something else all together? Is one approach typically better than the other? If so, please provide reasons why. If my second example, would you recommend separate git repositories for main and admin? Thanks Im running a website about health and foods. I would like that at the end of each article, it shows other related articles that I have on my website.
Im relatively new with php and mysql so I figure I have to put every page onto a database table.
I looked already everywhere but all I found is how to do with wordpress. But i'm not using anything like that.
I made the website myself with css and html and php.
Can somebody help me with a website where they explain how to do?
Also I would like that automatically it shows my latest articles in a sidebar. Without anytime adding myself manually.
Can anybody help me?
Hi guys, I know this is a bit of a messy question, but i have a problem with some code that my friend wrote, and now i don't know how to fix it. Basically there is a line of code on my site, and what my friend told me was that this specific line of code has to do with the server and is similar to a ticking clock. What he told me is that it is a "counted related value" which needs to been changed every now and then when it hits the servers limit. This actually means nothing to me, but i'm hoping some one out there knows what my friend means. Anyway this is the line of code i need to change, or in fact the number i need to change. The problem is that as i dont really know what i'm doing i have no idea as to what to change the number to. Please help guys, I really need to fix this asap. Anyways this is the code: // unique references define ('NID', floor(hexdec(substr(uniqid(''),0,11))/100)-52330000000); // table id define ('SID', strtoupper(uniqid(''))); // short unique id define ('UID', strtoupper(md5(uniqid('')))); // 32char id Its the number 52330000000 that i had to change the last time i had this problem. Many thanks in advance. Hey guys for some reason my script is being strange. <? if(!empty($_POST['why'])) { $why = mysql_real_escape_string($_POST['why']); $answer = $_POST['answer']; $id = $_POST['cid']; if($answer == "Accept") { $query1 = mysql_query("UPDATE characters SET accepted = '1' WHERE id = '".$id."'"); $aquery = mysql_query("UPDATE applications SET tester = '".$_COOKIE['Username']."', accepted = '1', answered = '1' WHERE cid = '".$id."'") or die('Could not connect: ' . mysql_error()); echo"Successfully accepted"; } } If you notice the echo it outputs the successfully executed, tho the mysql query doesn't go through for some strange issue even through it says it does since I got the or die(mysql_error) thing and it still doesn't output a error. So I got a hard time finding the problem. not for certain this is a PHP issue, but on every page of my site, at the bottom, this error displays. Doesn't affect any of the code execution as far as I can tell, but it's annoying. Anyone else seen this? Code: [Select] Error in my_thread_global_end(): 1 threads didn't exit Hi, I'm trying to set up a page which first queries for mySQL record results matching a country that the user selects. This works fine, but in the event of there being no records for that country, I want it to look at another field, "Region" and pick the records matching that Region instead. For example, a user searches for "Australia" but there are no matching records. So, I want it to pick all the records for the region of Australasia, and display records for Australia, New Zealand, Papua New Guinea and so on. I had created the following: $query = "SELECT * FROM specialists WHERE Country LIKE '$country' ORDER BY SpecialistName"; // specify the table and field names for the SQL query //$query .= " limit $s,$limit"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); if ( $numrows == 0 ) { echo '<p>We don\'t have any results for specialists in countries near to yours at the moment. Please try <a href="specialists.php" style="text-decoration:underline;">searching a different country</a></p>'; } // get results $result = mysql_query($query) or die("Couldn't execute query"); // display the results returned while ($row= mysql_fetch_array($result)) { $region = $row["Region"]; $count++ ; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } echo '<table width="600" class="cardisplay"><tr>'; $count = 1 + $s ; echo $region; // Build SQL Query $query2 = "SELECT * FROM specialists WHERE Region LIKE '$region' ORDER BY SpecialistName"; // specify the table and field names for the SQL query //$query .= " limit $s,$limit"; $numresults=mysql_query($query2); $numrows=mysql_num_rows($numresults); // get results $result = mysql_query($query2) or die("Couldn't execute query"); // display the results returned while ($row= mysql_fetch_array($result)) { $title1 = $row["ID"]; $specialistname = $row["SpecialistName"]; $address1 = $row["Address1"]; $address2 = $row["Address2"]; $address3 = $row["Address3"]; $address4 = $row["Address4"]; $address5 = $row["Address5"]; $postcode = $row["Postcode"]; $country = $row["Country"]; $region = $row["Region"]; $website = $row["Website"]; $email = $row["Email"]; $telephone = $row["Telephone"]; $businesstype = $row["BusinessType"]; //followed by echoing out the various data etc. etc. But the problem is that $region is always blank / empty in the cases where $query is empty, so I can't pull the value out and therefore $query2 is also empty... Any ideas? I am trying to store website address in a variable but when I do so the dots in the address are missing. I guess it takes it as string concatenation, for example: $address='www.lottocomplete.com'; will actually give me: wwwlottocompletecom How can I make sure these dots will be preserved? I am also trying to store email address in a variable but I get error, something about @ symbol being in wrong spot, wonder how this can be resolved as well. One more questions relates to the new line issue that I have when I concatenate string, for example if I do the following: $string = "1\n"; $string .= "2\n"; $string .= "3\n"; I would think that each number would be printed on new line but instead it shows up as: 123 What am I doing wrong? |