PHP - Quickform2 - Client Side Validation
I want to do simple client side validation but I don't know Javascript. Can someone point me to an easy example on how to implement or post something here?
Similar TutorialsI wish to create validation rules once which are used both on the client and on the server.
For instance, I will start off with the following PHP object:
stdClass Object ( [rules] => stdClass Object ( [email] => stdClass Object ( [required] => 1 [email] => 1 [remote] => stdClass Object ( [url] => check-email.php [type] => post [data] => stdClass Object ( [username] => function() {return $( '#username' ).val();} ) ) ) ) [messages] => stdClass Object ( [email] => stdClass Object ( [required] => an email is required ) ) )When the edit page is downloaded to the client, I will include this object in some format suitable to the client. The client will then use the jQuery Validation plugin (http://jqueryvalidation.org/) along with the validation object, and client side validate the page. When the form passes client side validation and is uploaded, PHP will use the same validation object to serverside validate the form (I have this part working as desired). My question is how should I pass this data to the client? Originally, I would just use PHP to write some JavaScript. exit('var myObj='.json_encode($myObj));Note that when I json_encode the object, the value of $myObj->rules->email->remote->data->username is a string with quotes around it, however, I can easily use PHP to strip these tags before sending it to the client. As Jacques1 pointed out in http://forums.phpfre...ascript-client/, I should never ever use PHP to generate JavaScript, and should use AJAX to download the JSON directly. I tried doing the later, but found that a callback function could not be included in the JSON. Please advise on the best way to accomplish this. Thank you I have a web portal which is scripted using client side scripting language i.e HTML. I want to create a login page in .php and want the other pages to be in .hmtl. Can i do so? I want to do this because i want the login password to be stored in a database. Also I want the password to get encrypted (by either MD5 javascript or OpenSSL ) when user enters it inside the login form. I cannot create the entire portal in php because my portal makes use of C code. And php doesn't have an interface with C language. Can a user get directed to a .html page after a secure login from login.php page ? My main aim is to secure the access to my web portal using a password. I tried to authenticate the login using javascript where the password was stored in an array. But i feel any one having moderate knowledge can easily break that password. Any help would be greatly appreciated!! is it true that all the server side code runs before the client side code when accessing a webpage? if that is true, what about PHP code that is embedded inside HTML tags? wouldn't that result in an error a lot of times? Hello guys. I was thinking on posting this under the mysql thread. but i think this can be solved by php.. anyway, i want to dump mysql data on the client side whenever a user logs out. how can i do this? thanks in advance. I'm in the habit of verifying input client side. For example, there is a field to enter a number, and I ensure that it is within a particular range using Javascript. My backend PHP code does not do such checking... Is this bad? Should I be doing checking using my backend code and send a response back to the client to display a message? Admittedly, I avoid it, since it's a little extra work -- well more extra than just javascripts, IF-THEN-ALERT type statement. I was wondering about developing simple client side graphical apps.
I was thinking of using php with an ODBC connection to the data store.
The data store might be a text file in CSV format or something similar. (maybe even a spreadsheet)!
I was wondering what would be a very simple minimally useful web server to run on the client?
The client would probably be MS Windows XP/7.
What are your thoughts?
We have a website that allows the user to upload his/her picture so we use the ftp_put() command. I use Code: [Select] <?php $path = getcwd(); echo $path; ?> This is the output: Code: [Select] /home/vol10/000a.biz/a000b_7363341/htdocs/gankgame to determine the absolute path where my website is stored. My website "CAN" connect to the ftp server but it can't upload files. Uploading always fail. I can't determine the right path. "My code is attached" Is it possible adding a button with PHP, which could be used for adding an optional text input field by client side user? My purpose is actually very simple: The client side users could be free creating and adding more and customized variables, which are intended to be used as strings and related or associated variables. So, am I able to do these kind of tasks simply using PHP alone? Or, should I use some JavaScript like technologies to make those functions available in real world's practices? Hi All - I'm trying to see if the below is possible using PHP. is it possible for php to allow a user to check if a port is open/listening on a remote server/PC, from their local machine. I've seen scripts on the web that talk about opening cmd.exe - this won't work as not all of my users will be on windows. Also saw fsock.. but the remote server is not serving http page(s). Also saw telnet, but again, some of my users may not have that windows feature enabled. Desired workflow: 1. user enters the server hostname/IP and a port 2. my php webapp will emulate checking if that hostname and port is open from the local user's computer.
thanks! I'm trying to learn how to validate a form using the php server side method. Everything I search is very different and old. Anyone have knowledge of a good tutorial or source that I could use? None of my books have anything about it either! Thanks! I have a text box and a submit button. I want that when the submit button is pressed, the value on the text box will be checked if it matches the values that are on my server before proceeding, and if they don't match it should give an error report and stop. All I can make myself is the text box and the submit button, I have tried for hours to find a way to do the rest, but all I can find on the internet are vague explanations and information that a novice like me cannot use. It would be a shame to let me web site that I have worked hard on to go to waste because I cannot do this myself Thank you in advance I’m trying to write a post-panel where the user can see the preview of his post to the right of the text area he’s writing into. I tried the following into a file called writepost.php : <?php $text=(isset($_GET['message']))?$_GET['message']:''; $formatted_text=nl2br(stripslashes(htmlspecialchars($text))); echo '<form method="post" action="proceedtopost.php?>'. '<table>'. '<td style width="50%"><tr>'. '<fieldset> Write your post here : <br> <textarea cols="50" rows="12" '. 'id="message" name="message">'.$text.'</textarea>'. '</fieldset> <p> '. '<input type="submit" name="submit" formaction="writepost.php" value="Preview" /> '. '<input type="submit" name="submit" value="Sent" /> '. '</p>'. '</td>'. '<td>'. '<fieldset> Your post will appear as follows :<br><p> '. $formatted_text. '</fieldset>'. '</td></tr>'. '</table>'. '</form>';There are several things wrong with this code : 1) When the user hits the "Preview" button, I expect writepost.php to be reloaded (this is what happens), and the current content of the textarea to be stored in $_GET['message'] (this is not what happens). 2) Why does my browser output the preview part under the text area (or in other words outputs the HTML table as a single column of two cells), when I insist in my HTML code for the table to be displayed as a single row ? need a little help guys! I use the script below to display profile images, trouble is it shows 1 on top of the other, and i need it to double up 2 profile images on top of 2 profile images ect any ideas how i can do this. require("./include/mysqldb.php"); $con = mysql_connect("$dbhost","$dbuser","$dbpass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("$dbame", $con); $result = mysql_query("SELECT * FROM Search_profiles_up WHERE upgrade_one ='1' ORDER BY RAND() LIMIT 40"); print "<table width=\"293\" height=\"111\" border=\"0\"> <tr>\n"; while($row = mysql_fetch_array($result)) { print "<td width=\"142\"><img src=" . $row['search_small_image'] . " width=\"144\" height=\"169\" /></td>\n"; print " </tr>\n"; print " <tr> \n"; print "<td>" . $row['star'] . "</td>\n"; print " </tr>\n"; print " <tr>\n"; print "<td>" . $row['username_search'] . "</td>\n"; print " </tr>\n"; print " <tr> \n"; print "<td>" . $row['phone_search'] . "</td>\n"; print " </tr> \n"; } print "</table>"; mysql_close($con); ?> I have a few tables in php and want them to be side by side instead of under each other like below. I have spent about 2 days trying to figure it out, Anyone got a clue? This is the code im using <?php $con = mysql_connect("localhost","user","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("People", $con); $result = mysql_query("SELECT * FROM wang"); echo "<table border='1'> <tr> <th>Wang Total Report</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['got'] . "</td>"; echo "</tr>"; } echo "</table>"; $result2 = mysql_query("SELECT * FROM miah"); echo "<table border='1'> <tr> <th>Miah Total Report</th> </tr>"; while($row = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row['got'] . "</td>"; echo "</tr>"; } echo "</table>"; $result3 = mysql_query("SELECT * FROM vinc"); echo "<table border='1'> <tr> <th>Vinc Total Report</th> </tr>"; while($row = mysql_fetch_array($result3)) { echo "<tr>"; echo "<td>" . $row['got'] . "</td>"; echo "</tr>"; } echo "</table>"; $result4 = mysql_query("SELECT * FROM ketarie"); echo "<table border='1'> <tr> <th>Ketarie Report</th> </tr>"; while($row = mysql_fetch_array($result4)) { echo "<tr>"; echo "<td>" . $row['got'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Dear all, I'm working on a website that is hosted on a server with 10Mb of file size limit via HTTP file uploading approach (eg. PHP file uploading form using move_uploaded_file()), although there's no file size limit via FTP file uploading approach (eg. Using FTP client). Therefore, I was thinking about using PHP FTP functions to bypass the file size limit. However, when I upload file bigger than 10Mb, I still got this error message telling me that my file can't be over 10Mb... So my question is...what exactly are the differences between PHP FTP and FTP Client, that the web server used to determine whether to block the file bigger than 10Mb or not? Thank you very much! Below is my code: Code: [Select] <?php echo '<form action="" method="post" enctype="multipart/form-data">'; echo 'Click the Browse button to find the file you wish to upload'; echo '<input type="file" name="add_file">'; echo '<INPUT TYPE="submit" name="upload" value="upload">'; echo '</form>'; if($_POST['upload']) { $add_file = $_FILES['add_file']; //change these values to suit your site $ftp_user_name = 'username'; $ftp_user_pass = 'password'; $ftp_server = 'ftp.domainname.com'; $ftp_root = '/'; //File upload $temp_path = $ftp_root . $add_file['tmp_name']; $target_path = basename($add_file['name']); $max_size = 26214400; if($add_file['error'] == 0 && $add_file['size'] < $max_size) { // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload a file ftp_chdir($conn_id, '/root/second/'); if (ftp_put($conn_id, $target_path, $temp_path, FTP_ASCII)) { echo "successfully uploaded " . $target_path; } else { echo "There was a problem while uploading " . $target_path; } } else { echo "There's been an error, please try again later."; } // close the connection ftp_close($conn_id); } ?> I have two questions, I was wondering what would be the best method to go about building client side API functions on top of a already built API eg. http://docs.whmcs.com/API:Functions
We would like to provide our clients access to API functions related to their accounts without giving them access to the whole Admin API where they can see a lot of our other client information.
The other question we have an API built using Basic HTTP Auth for API authenication (HTTPS). eg curl username:password http://api.etc.com) If so what would be the best way to secure this method?
Thank you I feel like I was 75% there, and now I'm only 25% there. I'm trying to put my links onto my page. http://thingsihateaboutyou.net/michelle is my testing page. So I have register (register.php), login (login.php), logout (logout.php), and the members area. The members area is going to be their username.php, so I assumed this would be $username.php like I have it in the redirect link from the point where you login to the point where you see your client page. This works fine. The part I'm having trouble with is the visibility of the links on my page to these, AND adding a PHP variable ($username) into the "members area" tag. When you click on members area, it should send you to http://thingsihateaboutyou.net/michelle/*whatever you are logged in as*.php As for the visibility, if you are not logged in I obviously don't want you to see a link called "log out" or a link called "members area," and vise versa. It's been like 5 hours now, and I keep getting further and further away. I had to bail on my Wordpress so I don't have a Content Management System in place. All of this DID work and it worked excellent, but after I made the switch earlier today it kind of blew up in my face. I am attaching a ZIP file with everything included... in desperate need of an answer. Hi everyone, I've been trying to find a decent SOAP client library for PHP. The problem with PHPs own SoapClient is that it's very basic and doesn't really have support for different namespaces and headers with namespaces. It doesn't have the option to make custom attributes on soap headers or params. It can't make nested headers with SoapVars or Params and so on. Same goes to Zends SoapClient which is basicly just a wrapper for PHPs SoapClient. Is there any good client library that could handle all this stuff? Hello All, I'm working with a SOAP WSDL API for the first time, i need to send off some params to the server so it returns the data i'm after, i've read the SoapClient manual and looked at a few tutorials but I can't seem to work out how to actually send the data. I have been provided a sample XML document of how the request should be formatted which I have attached. All I have worked out so far is how to run the client: Code: [Select] $client = new SoapClient($url); The request XML the server is looking for is as follows: Code: [Select] <?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ARN_ReadRQ TransactionIdentifier="f8f766bb-87c0-42c0-83d5-29416b8477b7" TimeStamp="2007-07-31T14:33:52.1051647-07:00" EchoToken="Retrieve" Version="1.0" xmlns="http://www.domain.com/"> <POS> <Source> <RequestorID ID="Username" MessagePassword="Password"/> </Source> </POS> <ReadRequests> <ReadRequest> <UniqueID ID="1020-322162" Type="14"/> </ReadRequest> </ReadRequests> </ARN_ReadRQ> </s:Body> </s:Envelope> I am under the assumption this stuff goes in an array? If so how do I format it and how do I send it across? Any help greatly appreciated, Cheers. |