PHP - Help About Log-in Filters That Ping Pong On This Php.
1st the log in code:
Code <form method ="post" action="cartnisya.php"> <table border="0"align="right"> <td>Username:</td> <td><input type="Text" name="Username"></td> <td>  </td> <td>  </td> <td>Password:</td> <td><input type="Password" name="Password"></td> <td>  </td> <td colspan="2" align="center"><input type="Submit" name=submit" value="Submit"></td> </table> <img src="Vinnex1.jpg"> </form> it will then go the php code: CODE: <html> <?php $db = mysql_connect("localhost", "root",""); mysql_select_db("vinnex",$db); $Username = $_POST['Username']; echo $Username; $result = mysql_query("Select TransNo From transaction", $db); $myrow = mysql_fetch_array($result); if ($myrow=='') { $TransNo='1000'; $sql = mysql_query("Select * From customer where Username='$Username'", $db); $myrow1 = mysql_fetch_array($sql); $Username = $myrow1['Username']; $Firstname = $myrow1['Firstname']; $Lastname = $myrow1['Lastname']; $name = $Firstname. " ".$Lastname; $Date = date('m/d/y'); $sql1 = "INSERT INTO temptransaction (TransNo, Username, Firstname, Date) VALUES ('$TransNo', '$Username', '$Firstname', '$Date')"; $result = mysql_query($sql1); //or die(mysql_error()); } else { $sql = mysql_query("Select max(TransNo) maxTransNo From transaction", $db); $myrow1 = mysql_fetch_array($sql); $orderno = $myrow1['maxTransNo']+1; $sql = mysql_query("Select * From customer where Username='$Username'", $db); $myrow1 = mysql_fetch_array($sql); $Username = $myrow1['Username']; $Firstname = $myrow1['Firstname']; $Lastname = $myrow1['Lastname']; $name = $Firstname. " ".$Lastname; $Date = date('m/d/y'); $sql1 = " INSERT INTO temptransaction (TransNo, Username, Firstname, Date) VALUES ('$TransNo', '$Username', '$Firstname', '$Date')"; $result = mysql_query($sql1) or die(mysql_error()); } ?> <meta http-equiv="refresh" content="0;url=orderproduct.html"/> </html> once this is open it will go the selected it wont display the matched echo for the text field. once i call the database when using username and password it wont filter and it wont call for a firstname and username to be saved in the database please help Similar TutorialsHow Would I ping an IP Address with Php. I am planning on using ping so that it pings a server ip, and if it matches the ip that the server is hosted on, then it will activate the profile. EG: Ping: MagicPkz.no-ip.org Comes out with my IP(70.177.**.***) Now I go to a page, it checks to see if MagicPkz.no-ip.org matches up to my IP, and if it does, it activates the profile, if it doesn't it gives an error. is this the best way to check if a server is live? <?php $host = "www.google.com"; $fp = fsockopen($host, 80, $errno, $errstr, 10); if($fp) { echo "yes it is"; fclose($fp); } else { echo "no it is not"; } ?> But if you type in a false server eg www.googddfsdfsd.com it returns an error how can i get it to return false and why doesn't it. I know that php has a function that can execute ping command but i'm not sure how it works. I am trying to get the result of the ping command to determine: IP address has a reply (PC/device is turned on) IP address has no reply (ip address is vacant and not assigned to any pc/device IP address has a response (PC/device is turned off) is this "do-able" in php?? this is my script: Code: [Select] function ping($ip){ // #5882FA blue color indicates Fiber Module // #FACC2E orange color indicates cascade/uplink cable // #81F781 Green color indicates connected/turned on // #FE2E2E Red color indicates disconnected/turned off // #585858 dark gray color indicates connected patch panel port is vacant at user side if($ip=="Cascade" OR $ip=="Uplink"){ return $status="style=\"background-color:#FACC2E;cursor:pointer;\""; /* orange */ }elseif ($ip=="Fibre Module"){ return $status="style=\"background-color:#5882FA;cursor:pointer;\""; /* blue */ }elseif ($ip==null or $ip==""){ return $status="style=\"cursor:pointer;background-image:url(images/x.gif);\""; /* dark gray */ }else{ $str = exec("ping -n 1 -w 1 $ip", $input, $result); if ($result == 0){ return $status="style=\"background-color:#81F781;cursor:pointer;\""; /* green */ //return "on"; }else{ return $status="style=\"background-color:#FE2E2E;cursor:pointer;\""; /* red */ //return "off"; } } } i can get it display on or off and i've tested it working. but i just can't figure out if i could use this command to determine if the IP address is vacant or unassigned. I'm using this for a IP list inventory system built in PHP. I have careted a page where the the 3com switch is drawn in tabulated format with each port assigned (via PHP) to the corresponding IP address of the device/PC and indicates the port color as described in the above function. Surprisingly it works well for this switch inventory. I just want to create another page for IP address inventory using the same function. To put is simple i want to have the same function as the sofware "Advance IP-Scanner" which does the same thing as well only thing is my resources are limited to PHP (WAMP). any help guys? ok hi im new to the forums and didn't really know where to put this, so il put it here if its in the wrong place then im sorry, anyways currently im working on a site that will ping a server and come back with the standard Online/Offline and the MS, i've already worked on that cod and its working, one thing im not sure about though is, if its possible to only ping the server once every 2minets or so, as currently every person who comes on the site or presses F5 will ping it, i was thinking maybe somehow storing the MS ect in a database, and having the PHP read from the database and somehow every 3 minutes having it update?, but im not really sure how i would go about doing this, or even if its possible my, mySQL isn't great to say the best, il leave the PHP code below and see what you think, sorry about the code being a bit messy Code: [Select] <tr> <td class="SEBody1"> <?php // Function to check response time error_reporting(0); function pingDomain($domain) { $starttime = microtime(true); $file = fsockopen ($domain, 443, $errno, $errstr, 10); $stoptime = microtime(true); $status = 0; if (!$file) $status = -1; // Site is down else { fclose($file); $status = ($stoptime - $starttime) * 1000; $status = floor($status); } return $status; } echo '<table>'; $domainbase ="ipadress"; $status = pingDomain($domainbase); if ($status != -1) echo "<img src='img/shard_status_online.png' width='18' height='18' alt='Online' /> Online "; else echo "<img src='img/shard_status_offline.png' width='18' height='18' alt='Offline' />Offline"; echo '</table>'; ?> </td> <td class="SEBody1">Login</td> <td class="SEBody1">PvP</td> <td class="SEBody1"> <?php if ($status !=-1) echo "$status ms"; else echo "0 ms"; ?> </td> <td class="SEBody1">English</td> </tr> Hello All happy new year I am trying to make a php page that detects if something is plugged in to the ethernet port. This would be complex if not impossible. I however managed to do something similar the device that will be plugged in has a static address 192.168.1.1. so I created a ping that says if the device is up or down. function ping($host, $port, $timeout) { $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); $status; if ($fP) { echo "Device is ready to accept data";} else { echo "Device Down - Retrying connection"; } } What I would like to do is have a script that is constantly checking is the device is plugged or when it is not (so sort of a loop or auto detect). The idea is to have an image with the device up or down. Regards and a happy new year JG Hello, please can anyone advise a right solution on how to avoid my site acting strangely when one of my AD companies stops to function. I mean there are downtimes for AD servers as well, and i'm wondering what is the best solution? Can i load ads on my pages separately, so i mean lastly? They are all over my page so i guess i can't do it. Or is it better to ping ad server and wrap these ADS around PHP if functions, which ping these servers? If you have a solution , which is most effective, please tell me. how can i output the remote user's ping to my server on my website through php? Hello, I need a small php script to ping a domain with custom referrer url eg: I need a script to ping a website www.abc.com with a custom referrer url ie. xyz.com so that the website abc.com would think that the traffic is from xyz.com Anyone have an idea? --SS I found a pretty cool function that allows me to ping Pingomatic for new blogs that I have. Great. Now I can automate the process instead of manually going to their website. My problem is actually simple. Sometime Pingomatic is quite busy and is unable to receive the request. I want to be able to check the status of my ping request but I don't know how to get this specific field/variable? from the result. Here is the ping script: Code: [Select] $title = "My blog title"; $url = "http://mynewbloglink"; function pingomatic($title,$url,$debug=true) { $content='<?xml version="1.0"?>'. '<methodCall>'. ' <methodName>weblogUpdates.ping</methodName>'. ' <params>'. ' <param>'. ' <value>'.$title.'</value>'. ' </param>'. ' <param>'. ' <value>'.$url.'</value>'. ' </param>'. ' </params>'. '</methodCall>'; $headers="POST / HTTP/1.0\r\n". "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)\r\n". "Host: rpc.pingomatic.com\r\n". "Content-Type: text/xml\r\n". "Content-length: ".strlen($content); if ($debug) nl2br($headers); $request=$headers."\r\n\r\n".$content; $response = ""; $fs=fsockopen('rpc.pingomatic.com',80, $errno, $errstr); if ($fs) { fwrite ($fs, $request); while (!feof($fs)) $response .= fgets($fs); if ($debug) echo "<xmp>".$response."</xmp>"; fclose ($fs); preg_match_all("/<(name|value|boolean|string)>(.*)<\/(name|value|boolean|string)>/U",$response,$ar, PREG_PATTERN_ORDER); for($i=0;$i<count($ar[2]);$i++) $ar[2][$i]= strip_tags($ar[2][$i]); return array('status'=> ( $ar[2][1]==1 ? 'ko' : 'ok' ), 'msg'=>$ar[2][3] ); } else { if ($debug) echo "<xmp>".$errstr." (".$errno.")</xmp>"; return array('status'=>'ko', 'msg'=>$errstr." (".$errno.")"); } } pingomatic($title,$url,$debug=true); This script works and when Pingomatic 'is available' returns something to the effect of Thanks for pinging, you're blog is being forwarded...etc. etc. When Pingomatic is too busy I receive the following result: Code: [Select] HTTP/1.1 200 OK Server: nginx Date: Mon, 30 Apr 2012 22:23:17 GMT Content-Type: text/xml;charset=utf-8 Connection: close Content-Length: 390 <?xml version="1.0"?> <methodResponse> <params> <param> <value> <struct> <member><name>flerror</name><value><boolean>1</boolean></value></member> <member><name>message</name><value><string>Pingomatic is a bit overloaded at the moment</string></value></member> </struct> </value> </param> </params> </methodResponse> What I'm trying to get in a variable is the '<member><name>message' result. In this case it's "Pingomatic is a bit overloaded at the moment". This way I can try to ping the server again later at another time knowing that the ping was not successful. What I've tried: I've attempted to see if the 'message' (Pingomatic is a bit overloaded at the moment) is in some of the variables within the original function: $pingresponse = "<xmp>".$errstr." (".$errno.")</xmp>"; $pingresponse2 = "<xmp>".$response."</xmp>"; $pingresponse3 = array('status'=> ( $ar[2][1]==1 ? 'ko' : 'ok' ), 'msg'=>$ar[2][3] ); echo "Ping Server Response : Debug: ".$debug." Errstr :".$errstr." Errno: ".$errno."Response: ".$response; But it isn't. My plan was to use strpos to search for the term "Pingomatic is a bit overloaded at the moment" in which I'll be able to know whether or not the ping was successful or not. Any ideas? Right i have my code below, i also have a drop down box My drop down menu code <table class="thinline" width="175"> <tr><td class="topic">Show All Cars From:</td> </tr><tr> <td> <select name="lim" class="text"> <option value="X">Everywhere</option> <option value="England">England</option> <option value="China">China</option> <option value="Japan">Japan</option> <option value="Brazil">Brazil</option> <option value="South-Africa">South-Africa</option> <option value="America">America</option><br><input type="submit" value="Show!" class="button" style="margin-top: 4px;"> </td></tr></table> i want this box's values to update my SQL query so it shows only cars from that location seleteted. Code: [Select] <?php require("connections/db.php"); require("connections/require.php"); require("connections/jailed.php"); $submit = strip_tags($_POST['submit']); $ros = strip_tags($_POST['ros']); $play = mysql_query("SELECT * FROM `players` WHERE `playername` = '$player' LIMIT 1")or die(mysql_error()); $arry = mysql_fetch_array($play); $cash = $arry['money']; $qry = mysql_query("SELECT * FROM `garage` WHERE `owner` = '$player' ORDER BY `id` DESC")or die(mysql_error()); $num = mysql_numrows($qry); ?> <html> <head> <link rel="stylesheet" type="text/css" href="connections/style.css" /> <script type="text/javascript" src="selectall.js"></script> </head> <body> <form action="" method="post"> <table class="thinline" width="175"> <tr><td class="topic">Show All Cars From:</td> </tr><tr> <td> <select name="lim" class="text"> <option value="X">Everywhere</option> <option value="England">England</option> <option value="China">China</option> <option value="Japan">Japan</option> <option value="Brazil">Brazil</option> <option value="South-Africa">South-Africa</option> <option value="America">America</option><br><input type="submit" value="Show!" class="button" style="margin-top: 4px;"> </td></tr></table> <br> <table width="95%" align="center" class="tbl"> <tr><td align="center" class="hdr" colspan="8">.::Garage::.</td></tr> <tr> <td align="center" class="sub" width="5%"> <input type="checkbox" name="checkall" onClick="checkUncheckAll(this);"> </td> <td align="center" class="sub">Type</td> <td align="center" class="sub">Damage</td> <td align="center" class="sub">Value</td> <td align="center" class="sub">Origin</td> <td align="center" class="sub">Location</td> <td align="center" class="sub">Repair</td> <td align="center" class="sub">Sell</td> </tr> <? if ($num == 0){ ?> <tr><td align="center" class="tbl" colspan="8">You don't have any cars.</td></tr> <? }elseif ($num > 0){ while ($arr = mysql_fetch_array($qry)){ $id = $arr['id']; $car = $arr['car']; $dam = $arr['damage']; $origin = $arr['origin']; $location = $arr['location']; $status = $arr['status']; $value = $arr['value']; if ($status == 0){ $rep = "<a href=\"?rep=".$id."\">Repair</a>"; }else{ $rep = "Unavailable"; } if ($status == 0){ $sell = "<a href=\"?sell=".$id."\">Sell</a>"; }else{ $sell = "Unavailable"; } $car = "<a href=\"".$img."\" target=\"main\">".$car."</a>"; ?> <tr> <td align="center" class="tbl"> <input type="checkbox" name="radio[]" value="<? print $id; ?>"> </td> <td align="center" class="tbl"><? print $car; ?></td> <td align="center" class="tbl"><? print $dam; ?>%</td> <td align="center" class="tbl"><? print ("$".number_format($value).""); ?></td> <td align="center" class="tbl"><? print $origin; ?></td> <td align="center" class="tbl"><? print $location; ?></td> <td align="center" class="tbl"><? print $rep; ?></td> <td align="center" class="tbl"><? print $sell; ?></td> </tr> <? }} ?> <tr><td align="center" class="tbl" colspan="8"> <select name="ros"> <option value="sell" Selected>Sell</option> <option value="rep">Repair</option> </select> <? sub(submit,Submit); ?> </td></tr> </table> </form> </body> </html> For eg. I have a page with a query that retrives records from the database and I want to have options of filtering out the shown records by date, time, likes, views..etc; how would I go about doing that?
The way I am thinking is having a html form with those filter inputs and using a relative query based on the filter selection to retrive the results.
What you think?
Hi there, I have been creating a website which shows products of the companys (www.theadventurestartshere.org) and I have been trying to make some filters for the products using URL Parameters and recordsheet filters... Can someone advise me on the easiest way to do this? As I have created a method to do it with, (check website) but it has to be entered manually and I was hoping there is an easier way? Please Note I like to use drop down boxes for the filters but if there is a way to do the checkbox style you see on say Amazon then that would be brilliant... I use Dreamweaver CS5, and the newest versions of PHP and MySql Many Thanks, Paul I have a property website and I want users to be able to filter the properties, So when they access the page, and click 'detached properties' only detached properties will appear, if the user selects 'semi-detached' then only semi detached properties will appear. I already have a mySQL database set up. Image attached here to have a better understanding. Basically I have a property page where I want users to be able to click 'detached' and then only detached properties will appear, if the user click 'semi-detached' then only semi-detched properties will appear. but these properties that I want to appear are just images, then a link to the actually property page with all the details. You can view the page here to get a better understanding: http://www.mumtazproperties.hostei.com/forsale.html At the moment all of the properties appear on the page. (and when you select the filters it actually does what I want it too, but through HTML) But I want the information to come from a database and then use PHP code to execute it all. Help is hugely appreciated, thanks. Hi all,
I have been reading in almost everywhere that we should not use our own custom login and password validations ( like regex etc.) but instead use the filter_var and filter_input built in functions provided by PHP 5 and above. However even after searching for more than an hour for with different search strings, I have not found even a single example that shows how we may validate for a username/login and password in a login form. Can someone be kind enough to provide a strong secure validations for username and login.
Additionally I would also like to clarify if the username and login fields in a Login form be manipulated in any manner to pose a security threat? I mean can a hacker craft a username/login or password in such a manner as to pose an injection or any other threat?
Thanks all.
Folks, I am just trying to learn PHP. For form input validation which is better - Regexp or PHP Filters? Or do they have completely different uses? Where does preg fit in? Thank you! J.S. Hello everyone, I have website that uses the php(mail) function to notify users when something happens on their account. The site was created for a school district so all the users are district employees where their incoming email is subject to pretty strict spam filtering. I am using headers to indicate to the recipient that the email is coming from support@mysite.com, but I guess the mail servers see past this and recognize that it's coming from a php(mail) function. Because of this, all of the emails being sent are being blocked by the filter. I've tried adding all emails coming from an address that ends with "@mysite.com" but this doesn't work. This is what the addresses look like that the spam filter is actually seeing: elmas156@p3nlhftpg049.shr.prod.phx3.secureserver.net And I can't just add a single address to the white list because each time an email is sent, the letters and numbers after "@" and before "secureserver.net" are different. Here's another address that shows up: elmas156@p3nlhg331.shr.prod.phx3.secureserver.net here is the code that I'm using to send the emails: Code: [Select] <?php $sendto = "$email"; $emailsubject = "Testing Message Report For $cdate."; $emailmessage = "This is a test email."; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: MySite.com Report <support@mysite.com>' . "\r\n"; // Mail it mail($sendto, $emailsubject, $emailmessage, $headers); ?> Does anyone have any suggestions on what to do to make every email sent to be recognized by the spam filter as coming from the same email instead of a bunch of random ones? I hope this is making sense to someone because it was very difficult for me to explain in writing. Thanks in advance for any help or suggestions. I am having a lot of trouble with this code, and I have no clue how to fix it. Right now, I have a GUI for a fictitious car dealership that has 5 populated drop down menus called Make, Model, Year, Color, and Mileage. What I want the code to do is read the selections made by the user with the drop down menus once the user hits the submit button and then filter the tables that I have in a mysql database to meets the choice requirements of the user. The code will bring up the GUI, but once I hit the submit button, I get the following errors Please if anyone can help me that would be fantastic. I really have no clue hello and good day
first of all:; i hope youre all right and everything goes well at your site;: Worpress-Plugin API - giving back the meta-data according the usage of different filters
I'm currently working on a parser to make a small preview on the newest plugins in wordpress. at the moment i think i work from a URL given out of the range of these: https://de.wordpress.org/plugins/browse/popular/ - let us say the first 30 to 40 URL-pages.
What i subsequently want to filter out after the fetch is - those plugins that have the newest timestamp Version: 1.9.5.12 installations: 10,000+ WordPress Version: 5.0 or higher Tested up to: 5.4 PHP Version: 5.6 or higher Tags 3 Tags: database member sign-up form volunteer Last updated: 19 hours ago plugin-ratings
Supported arguments per action +--------------------+---------------+--------------------+----------+----------------+ | | | | | | +--------------------+---------------+--------------------+----------+----------------+ | Argument Name | query_plugins | plugin_information | hot_tags | hot_categories | | $slug | No | Yes | No | No | | $per_page | Yes | No | No | No | | $page | Yes | No | No | No | | $number | No | No | Yes | Yes | | $search | Yes | No | No | No | | $tag | Yes | No | No | No | | $author | Yes | No | No | No | | $user | Yes | No | No | No | | $browse | Yes | No | No | No | | $locale | Yes | Yes | No | No | | $installed_plugins | Yes | No | No | No | | $is_ssl | Yes | Yes | No | No | | $fields | Yes | Yes | No | No | +--------------------+---------------+--------------------+----------+----------------+
regards dil_Bert
cf: https://developer.wordpress.org/reference/functions/plugins_api/ $fields = array( 'active_installs' => true, // rounded int 'added' => true, // date 'author' => true, // a href html 'author_block_count' => true, // int 'author_block_rating' => true, // int 'author_profile' => true, // url 'banners' => true, // array( [low], [high] ) 'compatibility' => false, // empty array? 'contributors' => true, // array( array( [profile], [avatar], [display_name] ) 'description' => false, // string 'donate_link' => true, // url 'download_link' => true, // url 'downloaded' => false, // int // 'group' => false, // n/a 'homepage' => true, // url 'icons' => false, // array( [1x] url, [2x] url ) 'last_updated' => true, // datetime 'name' => true, // string 'num_ratings' => true, // int 'rating' => true, // int 'ratings' => true, // array( [5..0] ) 'requires' => true, // version string 'requires_php' => true, // version string // 'reviews' => false, // n/a, part of 'sections' 'screenshots' => true, // array( array( [src], ) ) 'sections' => true, // array( [description], [installation], [changelog], [reviews], ...) 'short_description' => false, // string 'slug' => true, // string 'support_threads' => true, // int 'support_threads_resolved' => true, // int 'tags' => true, // array( ) 'tested' => true, // version string 'version' => true, // version string 'versions' => true, // array( [version] url ) );
what do you say-!? |