-
Posts
242 -
Joined
-
Last visited
Everything posted by ankur0101
-
Hi, I have a page such as www.xyz.com/search.php?name=john.b Using .htaccess, I want it as www.xyz.com/john.b Is it possible ?
-
Thank you so much, problem solved.
-
Hi, I am making a whois script, where textbox name is domain $domain = $_POST['domain']; A user should submit domain such as abc123-abc.tld abc123-abc can consist of small alpha, numbers and '-' tld can consist only of small alpha So I want to write something like if (resular ex condition as I asked above) { Success } else { Invalid domain name } Need help
-
Hi, Following is a code of D:/xampp/htdocs/zend/index.php <?php // Load Front controller class require_once('Zend/Controller/Front.php'); $frontController = Zend_Controller_Front::getInstance(); $frontController->addModuleDirectory('/application/modules'); $frontController->throwException(true); $frontController->dispatch(); ?> If I make it as application/modules i.e. removing slash /, it gives following error : Fatal error: Call to undefined method Zend_Controller_Front::throwException() in D:\xampp\htdocs\zend\index.php on line 10
-
Hi, Here is a structure of my testing site : under document root ->>> Uploaded with ImageShack.us When I go to localhost/zend , I get following error : What to do ?
-
How to check condition again and again until it satisfy ?
ankur0101 replied to ankur0101's topic in PHP Coding Help
This thought came in my mind, we are limiting attempts by counter. This is not exactly what I want but this will work Thanks -
How to check condition again and again until it satisfy ?
ankur0101 replied to ankur0101's topic in PHP Coding Help
The whole script is loading again and again even that part which is out of function, when I try to execute script again, it gives me 500 Server error -
How to check condition again and again until it satisfy ?
ankur0101 replied to ankur0101's topic in PHP Coding Help
I did so, But script has went into loop which will never stop. From 5 minutes, it is loading, loading and loading. Now I am removing sleep(15) I will get back here -
How to check condition again and again until it satisfy ?
ankur0101 replied to ankur0101's topic in PHP Coding Help
I am doing modifications with my code, I will get back here. -
How to check condition again and again until it satisfy ?
ankur0101 replied to ankur0101's topic in PHP Coding Help
Hi, Can I do without creating a function ? -
Hello, I am making a full backup of cPanel account. It takes few seconds for zipping 4 to 10 MB of data but when there are more than 200 MB of data on cpanel account, obviously it will take some more time, say for example 2 minutes. On cpanel based servers, while zipping, it temporarily creates a ZIP file of 33KB And this file's size stays at 33KB until the process get completed i.e. till it completes a backup file So conditionCHK is >> If example.zip > 33KB then, backup ZIP file is ready else sleep(15) and check conditionCHK again Point is that, it should check condition again and again until it satisfy. So in my case, it script will check again and again whether example.zip has become more than 33KB or not. If it not, then sleep for 15 seconds and again check Once condition will satisfy, it will show "Success" Which loop can I use here ? I am totally confused in developing a logic. Thanks.
-
How to store file names derived from glob() in variable array
ankur0101 replied to ankur0101's topic in PHP Coding Help
Hello, It worked. Thank you. -
How to store file names derived from glob() in variable array
ankur0101 replied to ankur0101's topic in PHP Coding Help
Hi, Finally I have uploaded files on amazon s3, but problem is my files are in folder home and glod() shows path like /home/ankur123.zip So problem is it has created folder home on s3 which I dont want. how can I print only name of file ? -
How to store file names derived from glob() in variable array
ankur0101 replied to ankur0101's topic in PHP Coding Help
uploading to amazon s3 using AmazonS3::create_mpu_object() -
How to store file names derived from glob() in variable array
ankur0101 replied to ankur0101's topic in PHP Coding Help
Hi, It worked. here is my code. <?php $files_in_directory = "home/"; $files = array(); foreach (glob($files_in_directory."*.zip") as $filename) { $files[] = $filename; } $counter = count($files); echo "<p>$counter</p>"; print_r($files); for($i=0; $i<$counter; $i++) { echo "<p>$files[$i]</p>"; } ?> Can I use $files[$i] to upload file using FOR LOOP ? -
How to store file names derived from glob() in variable array
ankur0101 replied to ankur0101's topic in PHP Coding Help
I will try and get back here. -
How to store file names derived from glob() in variable array
ankur0101 replied to ankur0101's topic in PHP Coding Help
No, What I mean s if there are 3 files, then PHP will first count number of files. (May be using for loop or whatever) Then at every count it will do $count++ so as to know how many files exist i.e. number of files Then $files[0] = xyz.txt $files[1] = pqr.txt . . . $files[n] = nfile.txt -
Hi, I want to store files to variable array using glob() like $files[0] = xyz.txt $files[1] = pqr.txt . . . $files[n] = nfile.txt I know how to list files from directory using glob() <?php foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } ?> How can I do that ?
-
Form Validation : Showing errors without passing inputs
ankur0101 replied to ankur0101's topic in PHP Coding Help
Hi, The following method worked /* Validating username field */ if (isset($_POST['submit'])){ // only execute inside if the form was submitted if ($username != NULL) { /* Bunch of stuff in here*/ } else { echo "<p>Username cannot be Blank</p>"; } /* Remaining form validation logic here...*/ } -
Hello, I am doing a php registration form, file name is register.php <?php include("config.php"); $submit = strip_tags($_POST['submit']); $username = strip_tags($_POST['user_box']); $password = md5(strip_tags($_POST['pass_box'])); $cpassword = md5(strip_tags($_POST['c_pass_box'])); $email = strip_tags($_POST['email_box']); $mobile = $_POST['mobile_box']; $ip = $_SERVER['REMOTE_ADDR']; $date = date('Y-m-d'); $time = date('h-i-s'); $i = 0; $checkusername = mysql_num_rows(mysql_query("SELECT * FROM members WHERE username='$username'")); $checkemail = mysql_num_rows(mysql_query("SELECT * FROM members WHERE email='$email'")); /* Validating username field */ if($username != NULL) { if (strlen($username) > 15 || strlen($username) < 6) { echo "<p>Username must be in range of 6 to 15 Characters.</p>"; } else { //check in DB if ($checkusername == 1) { echo "<p>Username already exist in database.</p>"; } else { $i++; } } } else { echo "<p>Username cannot be Blank</p>"; } /* ----------validating password field---------- */ if ($password != "d41d8cd98f00b204e9800998ecf8427e" || $cpassword != "d41d8cd98f00b204e9800998ecf8427e") { if ($password == $cpassword) { if (strlen($password) > 16 && strlen($password) < 4) { echo "<p>password must be in range of 4 to 16 Characters.</p>"; } else { $i++; } } else { echo "<p>Passwords do not match.</p>"; } } else { echo "<p>Password cannot be empty</p>"; } /* ----------Validating Passwords End---------- */ /* ----------Validating Email field Starts---------- */ if($email != NULL) { if($checkemail == 1) { echo "<p>Email already exist.</p>"; } else { $i++; } } else { echo "<p>Email field cannot be empty.</p>"; } /* ----------Validating Email fiend ends---------- */ /* ----------Validating Email field Starts---------- */ if($mobile != NULL) { if(strlen($mobile) >10) { echo "<p>Mobile cannot be more than 10 digits long</p>"; } else { $i++; } } else { echo "<p>Mobile field cannot be empty.</p>"; } /* ----------Validating Email fiend ends---------- */ if ($i == 4) { mysql_query("INSERT INTO members (username, password, email, mobile, ip, date, time) VALUES ('$username', '$cpassword', '$email', '$mobile', '$ip', '$date', '$time')"); echo "<p>Successful Registration Done !</p>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action=""> <table width="576" height="229" border="0"> <tr> <td width="139">Username :</td> <td colspan="2"><label for="user_box"></label> <input type="text" name="user_box" id="user_box" size="30" height="30" /> (Between 6 to 15 Characters)</td> </tr> <tr> <td>Password :</td> <td colspan="2"><label for="pass_box"></label> <input type="password" name="pass_box" id="pass_box" size="30" height="30" /> (Between 4 to 16 Characters)</td> </tr> <tr> <td>Confirm Password :</td> <td colspan="2"><label for="c_pass_box"></label> <input type="password" name="c_pass_box" id="c_pass_box" size="30" height="30" /></td> </tr> <tr> <td>Email Address :</td> <td colspan="2"><label for="email_box"></label> <input type="text" name="email_box" id="email_box" size="30" height="30" /></td> </tr> <tr> <td>Mobile No. :</td> <td colspan="2"><label for="mobile_box"></label> <input type="text" name="mobile_box" id="mobile_box" size="30" height="30" /> (10 Characters)</td> </tr> <tr> <td> </td> <td width="171"><input type="submit" name="submit" id="submit" value="Submit" /></td> <td width="252"><input type="reset" name="button2" id="button2" value="Reset" /></td> </tr> </table> </form> </body> </html> When I load page, it shows following errors before Username cannot be Blank Password cannot be empty Email field cannot be empty. Mobile field cannot be empty. What I want is on loading page i.e. before giving any inputs, it should not show any errors. Need help
-
Hi guys, I just have converted html theme into wordpres, my themes name is blue mania. All sidebars and xtra additional sidebars are done. So I headed to create Theme options. On my theme at bottom, there are 3 icons, Facebook, Twitter and FLickr. I want admin to enter their values from backend (i.e. Theme Options) Following is a code in my functions.php <?php if (get_option('bluemania_theme_options')) { $theme_options = get_option('bluemania_theme_options'); } else { add_option('bluemania_theme_options', array( 'facebook_url' => 'http://www.facebook.com/pages/xyz', 'twitter_url' => 'http://twitter.com/#!/xyz', 'flickr_url' => 'http://www.flickr.com' )); $theme_options = get_option('bluemania_theme_options'); } ?> <?php add_action('admin_menu', 'theme_page_add'); function theme_page_add() { add_submenu_page('themes.php', 'Theme Options', 'Theme Options', 8, 'themeoptions', 'theme_page_options'); } function theme_page_options(){ global $theme_options; $new_values = array ( 'facebook_url' => htmlentities($_POST['facebook_url'], ENT_QUOTES), 'twitter_url' => htmlentities($_POST['twitter_url'], ENT_QUOTES), 'flickr_url' => htmlentities($_POST['flickr_url'], ENT_QUOTES) ); update_option('bluemania_theme_options', $new_values); $theme_options = $new_values; echo '<div>'; echo '<h2>Blue Mania Theme Options</h2>'; ?> <form id="form1" name="form1" method="post" action="themes.php?page=themeoptions"> <label for="facebook_url">Facebook URL : <input type="text" name="facebook_url" id="facebook_url" value="<?php echo $theme_options['facebook_url']; ?>"/> </label> <p> <label for="twitter_url">Twitter URL : <input type="text" name="twitter_url" id="twitter_url" value="<?php echo $theme_options['twitter_url']; ?>"/> </label> </p> <p> <label for="flickr_url">Flickr URL : <input type="text" name="flickr_url" id="flickr_url" value="<?php echo $theme_options['flickr_url']; ?>"/> </label> </p> <p> <label> <input type="submit" name="submit" id="submit" value="Update Options" /> </label> </p> </form> <?php echo '<>'; } ?> So problem starts here >> I go to Theme Options I enter links I press update button. I refresh my wordpres home page to check whether given entered vales are giving output or not. It gives output. I come back to admin part and again click on Theme options. Now in those 3 text box, it should fetch data which I have already entered but it shows nothing in textbox. I dont click on Update Button. I just go to my wordpress home url and refresh and that previous links disappeared. Conclusion : After entering values on keyboard and submitting, it just wipe outs entered values from database once I open theme options again. Whats wrong in code ?
-
It doesn't work with all domains. It is giving blank output for few domains
-
Problem Solved. Thanks
-
Hi friends I have following code function UseOfSSL($domain_name) { $site = ($domain_name); $port = 443; $fp = fsockopen($site,$port,$errno,$errstr,10); if(!$fp) { echo "Not Installed"; } else{ echo "Yes, it is installed"; fclose($fp); } } If domain name from $domain_name has installed SSL, it will show it is installed else not installed. Problem is that I tried this with both types of sites, those who are using SSL and those who are not and always, it says Yes, it is installed. 443 is used because https uses port 443 What is the cause ?
-
I use CentOS for hosting service. 2 PCs in our office are using ubuntu. Never used RHEL. If you want to run/test PHP applications, I would suggest CentOS as it is free.