Jump to content

jagat21

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by jagat21

  1. this also might help u ............. http://in.php.net/file_get_contents
  2. you can do something like this : if(isset($_GET['sortorder']) && $_GET['sortorder']=='ASC') { echo'<a href="users.php?sortby=id&sortorder=DESC">Sort By Descending Order</a>'; } else if(isset($_GET['sortorder']) && $_GET['sortorder']=='DESC') { echo'<a href="users.php?sortby=id&sortorder=ASC">Sort By Ascending Order</a>'; }
  3. After firing the select query u have written, "select hobbies from tablename ", u can use explode() function in order to get the individual values of each hobbies. i.e. u have stored following values of hobbies in database table : id ..... hobbies 1...... reading, music, cricket now after selecting this record from query, $hobbies = explode(',',$row['hobbies']); this will give u an array of all hobbies that u have stored in single field. so u can access individual hobbies as an array elements.
  4. For selecting multiple values for hobbies field u can use checkboxes. And @ the time of inserting record combine them in a single string. and store the value.
  5. ya, but check the version of php/ mysql installed on the linux server. The syntax of the language will be same in both case.
  6. You can check in your hosting panel that if any database user is created for accessing the databases on your server. And if the database user is created on your database server, then check that its assign to the database you are using.
  7. Hi, Have a look at PHP Process Control Functions. http://in.php.net/pcntl this might help u.
  8. Hi, now try this : <?php if ($user_sel_date>=$mycurrentdate) { if ($from>=$my_current_time) { ?> <form name="time" method="post"> <table width="300px" border="0" cellspacing="0" cellpadding="0"> <tr> Other form elements here </tr> </table> </table> </form> <? } else { echo "Time cannot be less than current time."; } } else { // this is line 192 ?> <table width="300px" border="0" cellspacing="0" cellpadding="0"> <tr><Td align="center" valign="middle" class="content_heading"><br />You cannot register on the previous date...</Td> </tr></table> <? } ?>
  9. Hi, As u have tried no. of server, then may be some problem in ur email script. Can u please put ur code here so that others can check it, if some problem is there in ur script.
  10. Try to set following variable's value : php_value max_input_time 3600 in ur htacess file.
  11. Hi, try this <?php if (!is_authed()) { print ('You are not permitted to view this page, <a href="index.php">click here</a> to go back.'); } else { ?> <h2>Membership Registration</h2><hr /> <?php if(isset($_POST['submit'])) { $submit = $_POST['submit']; } function show_form() { global $_POST, $print_again, $error; global $first_name, $last_name, $interests, $username, $newsletter; ?> <form method="post" id="login" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <fieldset> <legend>Username</legend> <p class="hint">Please enter a username for your user account. Note that username should be between 4 and 30 characters.</p> <p><label for="username">Username:</label> <input type="text" <?php error_bool($error, "username"); ?> title="Please enter a username" id="username" name="username" size="30" value="<?php echo $username; ?>" /></p> </fieldset> <fieldset> <legend>About You</legend> <p><label for="first_name">Forename:</label> <input type="text" <?php error_bool($error, "first_name"); ?> title="Please enter your first name" id="first_name" name="first_name" size="30" value="<?php echo $first_name; ?>" /></p> <p><label for="last_name">Surname:</label> <input type="text" <?php error_bool($error, "last_name"); ?> title="Please enter your last name" id="last_name" name="last_name" size="30" value="<?php echo $last_name; ?>" /></p> <p class="hint">Please enter any interests/hobbies you have (optional).</p> <p><label for="interests">Your Interests:</label> <input type="text" title="Please enter any interests/hobbies you have" id="interests" name="interests" size="30" value="<?php echo $interests; ?>" /></p> </fieldset> <fieldset> <legend>Newsletter</legend> <p class="hint">Sign up for jackgodfrey.org.uk newsletter. This newsletter includes what forthcoming events we are arranging, the latest Honeylands news and our latest news. You can Opt-out at any time....so sign up and give it a try!!</p> <p><label for="newsletter">Newsletter:</label> <input style="border:none" type="radio" value="yes" id="newsletter" checked="checked" name="newsletter" />Opt-in <input style="border:none" type="radio" value="no" name="newsletter" />Opt-out</p> </fieldset> <p><label for="Submit" style="width: 20px"> </label> <input type="submit" name="submit" value="Edit Profile" class="sendbutton" /> <input type="reset" value="Reset Fields" class="sendbutton" /></p> </form> <?php } if(isset($submit)) { check_form(); } else { show_form(); } function check_form() { global $_POST, $error, $print_again; global $first_name, $last_name, $username, $newsletter; $first_name = check_input($_POST['first_name']); $last_name = check_input($_POST['last_name']); $interests = check_input($_POST['interests']); $username = check_input($_POST['username']); $newsletter = $_POST['newsletter']; $error['first_name'] = false; if(empty($first_name)) { $error['first_name'] = true; $print_again = true; $message="<li>The <span><b>Forename</b></span> field is empty</li>"; } else if(!ereg("^[A-Za-z]{2,30}$",$first_name)) { $error['first_name'] = true; $print_again = true; $message="<li><span><b>Forename</b></span> must contain letters only</li>"; } if(empty($last_name)) { $error['last_name'] = true; $print_again = true; $message.="<li>The <span><b>Surname</b></span> field is empty</li>"; } else if(!ereg("^[A-Za-z\-]{2,30}$",$last_name)) { $error['last_name'] = true; $print_again = true; $message.="<li><span><b>Surname</b></span> must contain letters only</li>"; } if(empty($username)) { $error['username'] = true; $print_again = true; $message.="<li>The <span><b>Username</b></span> field is empty</li>"; } else if( mysql_num_rows(mysql_query("SELECT username FROM users WHERE username = '$username'")) ) { $error['username'] = true; $print_again = true; $message.="<li>The username you have selected has already been used by another member in our database. Please choose a different Username!</li>"; } else if(!ereg("^[A-Za-z0-9 \-]{4,30}$",$username)) { $error['username'] = true; $print_again = true; $message.="<li><span><b>Username</b></span> must contain letters and numbers only</li>"; } if($print_again) { echo "<h2 class=\"errorhead\">There has been an error:</h2><p>You forgot to enter the following field(s)</p> <ul id=\"validation\">$message</ul>"; show_form(); } else { // Stop the form being used from an external URL // Get the referring URL $referer = $_SERVER['HTTP_REFERER']; // Get the URL of this page $this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]; // If the referring URL and the URL of this page don't match then // display a message and don't send the email. if ($referer != $this_url) { echo "You do not have permission to use this script from another URL.<br />"; echo "If you are behind a firewall please check your referrer settings."; exit; } echo "done"; } } } ?>
  12. Hi, u can encode the query string variables while sending them. And on the other page u can decode it and use it again. Use following functions : 1) base64_encode() 2) base64_decode()
  13. can u mention what error u r getting while executing the script ?
  14. Hi, try this. $txt = "yetrwueyrkw sjdfgskjdhfg kdjfgskjdfhgk dhfgskjdfhgs kjfhgskjf gskdjfh slkjdfhsl f"; echo $txt; $newtext = wordwrap($txt, 20); echo "<br>" . $newtext . "....";
  15. As per ur requirement, u can also use Snoopy class available for php for the same thing. And regarding the link, u have to check the source code of the page on which u are posting this variable. I think, [b]form action[/b] of that particular web page. And u can use that form action URL in snoopy class for posting your variables.
  16. i have tested this code and then posted. Its working fine on my system.
  17. Hi, Check this code... <form action='<?php $_SERVER['PHP_SELF'] ?>' method='post'> <input type='text' name='id' size='10' /> <input type='submit' name='btnClick' value='Click Me' /> </form> <?php /* checks if $id is numeric */ if(isset($_POST['btnClick'])) { if(is_numeric($_POST['id'])) { echo "The Entered Value is Numeric"; } else { echo "The Entered Value is not Numeric"; } } ?>
  18. You can use following function : filemtime($yourfilename);
  19. Hi, try this code : if (isset($_POST['yes']) || isset($_POST['no'])){ echo "Are you sure you want to delete {$_GET['user']}?<br>"; echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\"> <label> <input type=\"submit\" name=\"yes\" id=\"yes\" value=\"Yes\" /> </label> <label> <input type=\"submit\" name=\"no\" id=\"no\" value=\"No\" /> </label> </form>"; if(isset($_POST['yes'])) { mysql_query("DELETE FROM user_info WHERE username = '$_GET[user]'"); echo "You have deleted this user. Click <p><a href=\"index.php\">here</a></p> to go back to the admin CP."; exit; } if(isset($POST['no'])){ header("Location: user.php?user={$_GET['user']}"); exit; }}
  20. Hi, can u show the code what u have written ? So that i can come 2 knw where is the problem.
  21. Hi, you can use following php function to delete a file : unlink($filename); and if u want to delete and file from specific location then : unlink($filepath . $filename);
  22. Hi, in given code there is a function named as dbConnect() in which u have written : $user = nm; $pwd = ps; here what is nm and ps ? if they are any variables then they should be used like $nm and $ps. And if they are any normal string then they must be quoted by single quote or double quote. Another problem with mysql_connect function is that u have written : $conn = mysql_connect(sql1.bravehost.com, nm, ps) or die ('Cannot connect to server'); in this statement there are some syntax errors. it has to be written like this based on ur variables or string. if "nm" and "ps" are normal string then it will be written as $conn = mysql_connect('sql1.bravehost.com','nm', 'ps') or die ('Cannot connect to server'); And if they are varibles then it will be written like this : $conn = mysql_connect('sql1.bravehost.com',$nm, $ps) or die ('Cannot connect to server'); Check it ......
  23. Hi all, i have following strings : $subject = "LEAD IT-PROGRAMMER/ANLST-SFLD"; $subject = 'PROGRAMMER/ANLST-SFLD'; now i want to generate a regular expression which can match/fetch the "PROGRAMMER/ANLST" from any of the string. Pls help...
  24. For sending email to inbox, you have to set some headers in your email header section. Following are some of the headers that u can provide : $headers .= 'From: webmaster@example.com' . "\r\n"; // Sender's Email Address $headers .= 'Return-Path: MyName <myname@myhost.com> /n'; // Indicates Return-path $headers .= 'Reply-To: MyName <myname@myhost.com> /n'; // Reply-to Address $headers .= 'X-Mailer: PHP/' . phpversion(); // For X-Mailer $headers .= '"Content-type: text/plain; charset=iso-8859-1"'; // Set Content Type For Text Email Add this headers and try again to send the email.
  25. Try this code.... <?php $query_deg_cc_member = "SELECT * from cc_degrees WHERE member_no = '$cc_ass_mem_number_out'"; $result_deg_cc_member = mysql_query($query_deg_cc_member); $num_deg_cc_member = @mysql_num_rows($result_deg_cc_member); if ($num_deg_cc_member == 0) { $query_deg_member1 = "INSERT INTO cc_degrees (member_no, royal, royal_day, royal_month, royal_year, select, select_day, select_month, select_year, sem, sem_day, sem_month, sem_year, master_lodge) VALUES ('$cc_ass_mem_number_out', '$com_royal_out', '$royal_day_out', '$royal_month_out', '$royal_year_out', '$com_select_out', '$select_day_out', '$select_month_out', '$select_year_out', '$com_sem_out', '$sem_day_out', '$sem_month_out', '$sem_year_out', '$master_lodge_out')"; $result_deg_member1 = @mysql_query ($query_deg_member1); } if ($num_deg_cc_member != 0) { print "Not Equal"; $query_deg_in = "UPDATE cc_degrees SET royal = '$com_royal_out', royal_day = '$royal_day_out', royal_month = '$royal_month_out', royal_year = '$royal_year_out', select = '$com_select_out', select_day = '$select_day_out', select_month = '$select_month_out', select_year = '$select_year_out', sem = '$com_sem_out', sem_day = '$sem_day_out', sem_month = '$sem_month_out', sem_year = '$sem_year_out', master_lodge = '$master_lodge_out' WHERE member_no = '$cc_ass_mem_number_out'"; $result_deg_in = @mysql_query ($query_deg_in); } ?>
×
×
  • 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.