Jump to content

siri

Members
  • Posts

    56
  • Joined

  • Last visited

siri's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. siri

    Email Validation

    It's not working .Can anyone tell me what's the mistake in my code
  2. siri

    Email Validation

    he following code snippet always displays invalid.Here is the code snippet I used for email Validation:if(isset($_POST['submit'])){if(!eregi('^[a-zA-Z0-9-\_.]+@[a-zA-Z0-9-\_.]+\.[a-zA-Z0-9.]{2,5}$',$email)){$msg="Invalid";}else{$msg="Valid";}}Please let me know where exactly I am going wrong
  3. siri

    Image uploading

    Hi,I tried the follwing code for uploading images but I am getting follwing error Warning: move_uploaded_file(/67ff50fd1e1519ec658b190ef4fd280a.jpg): failed to open stream: Read-only file system in on line 14Warning: move_uploaded_file(): Unable to move '/tmp/phpSXlIXr' to '/67ff50fd1e1519ec658b190ef4fd280a.jpg' in on line 14Here is the code:************************************<html><?php $path=$_SERVER[DOCUMENT_ROOT];if(isset($_post['submit'])){ $title=$_POST['title']; $thumb=$_POST['thumb']; $id=$_POST['alb']; $name= $_FILES['flimage']['name']; $ext=strchr($name,"."); $newname=md5(rand()*time()).$ext; $file=$path.$newname; $result = move_uploaded_file($_FILES['flimage']['tmp_name'], $file);if(!result){die('couldnot upload');}else{ echo 'Success';}if (!get_magic_quotes_gpc()) { $title = addslashes($title); $thumb = addslashes($thumb); $file=addslashes($file); } $conn=mysql_connect("db5.awardspace.com","pa","********");mysql_select_db("pa",$conn);$sql="insert into images(title,fname,alb_id,thumbnail) values('$title','$file',$id,'$thumb')";$result=mysql_query($sql);if(!result)die('Error');mysql_close($conn);}?><form action="" method=post enctype="multipart/form-data"><table border=1><tr><td>Title: </td><td><input type=text name=title></td></tr><tr><td>Thumbnail: </td><td><input type=text name=thumb></td></tr><tr><td>Album Id: </td><td><input type=text name=alb></td></tr><tr><td>File Name: </td><td><input type=file name=flimage></td></tr><tr><td><input type=submit name=submit value="Submit"></tr></table></form></body></html>
  4. siri

    creating thumbnails

    How to create the thumbnail for images in php ?
  5. siri

    serialize function

    Can anyone explain what exactly the serialize function does in the following code snippet:if (isset($_SESSION[products])) { 12: print "<b>Your cart:</b><ol>\n"; 13: foreach (unserialize($_SESSION[products]) as $p) { 14: print "<li>$p";
  6. I am having the following code to check if the radio button was selected or not*********************************************************************<html><head><script language="javascript">var ifunction check(){for(i=0;i<3;i++){if(document.frm.choice.checked){ return true;}else{ return false }} }</script></head><body><form name=frm method=post action="mailto:abc@xyz.com" onSubmit="return check()"><input type=radio name=choice value="Excellent">Excellent<br><input type=radio name=choice value="Good">Good<br><input type=radio name=choice value="Nothing special">Nothing Special<br><input type=submit name=submit value=submit></form></body></html>*****************************************But the code is not working.Where exactly is the mistake.
  7. I am really finding regular expressions really tough.Can anyone suggest me some good sites for the same.I wish if w3schools.com can have some tutorials on regular expressions.
  8. siri

    Free Asp.net Hosting

    I tried aspspider.net but they have closed the free registrationAny other site which offers free asp.net hosting?
  9. siri

    Free Asp.net Hosting

    I am looking for free asp.net hosting so that I can learn asp.net.Can anyone give the list of sites which offer free asp.net hosting ?Thanks in advance.RegardsSiri
  10. siri

    Destroying Session

    I just want to know how I can clear the session variable after a specified time.I tried using the sleep function as follows:sleep(60);unset($_SESSION['members'];But it's not working.
  11. siri

    Unique Page views

    Friends,How to display the no of active users online and how to create a unique page views.I tried the following code:*********************************************************************<?phpsession_start();if(isset($_SESSION['views'])){$_SESSION['views']=$_SESSION['views']+1; if(isset($_COOKIE['visitors'])) { $_SESSION['views']=$_SESSION['VIEWS']-1; }}else{$_SESSION['views']=1;setcookie("visitors",1);}echo "Views: ".$_SESSION['views'];?>*************************************************************************Initially when I run this program it shows 1 but when I reload the page it displays as -1 .So how to create the unique page views.I tried to use cookies so that if the same visitor reloads the page then the session variable must be the same.So where exactly is the mistake.
  12. siri

    What's wrong

    The program is working after using the phpmyadmin tool.I created the table named person and defined the follwing fields: firstnames lastname and age.and now my display.php is displaying the contents properly.But I am having one doubt regarding the php's built in functions for mysql.When I tried to create the table using php code (See main.php and insert.php code) it was giving me the error.But when i used the phpmyadmin it's working.So how to achieve the same functionality without using phpmyadmin
  13. siri

    What's wrong

    Friends,I created the following php files : display.php*********************************<?php$con=mysql_connect("db5.awardspace.com","siri_online","********");if(!con){ die('could not connect' . mysql_error());}mysql_select_db("siri_online",$con);$result = mysql_query("select * from person");while($row = mysql_fetch_array($result)){ echo $row['firstname'] . " " . $row['lastname']; echo "<br/>";}mysql_close($con);?>****************************************insert.php file***************************************<?php$con=mysql_connect("db5.awardspace.com","siri_online","******");if(!con){ die('could not connect' . mysql_error());}mysql_select_db("siri_online",$con);mysql_query("insert into person(firstname,lastname,age)values('sami','gomes','21')");mysql_close($con);?>****************************************main.php file****************************************<?php$con=mysql_connect("db5.awardspace.com","siri_online","******");if(!con){ die('could not connect' . mysql_error());}mysql_select_db("siri_online",$con);$sql="create table person{ firstname varchar(12);lastname varchar(12);age int;}";mysql_query($sql,$con);mysql_close($con);?>******************************************but when i open the link http://myname.awardspace.com/display.php I am getting the following error :Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource inSo where exactly I am going wrong.
  14. siri

    Secure Email

    I know but plz explain the syntax of this function and how it works in this case.
  15. Friends,I want to do a real life project in PHP/MySQL. So can anyone suggest me some good sites for the same.I would really appreciate any kind of help in this regard.Thanks in advance.
×
×
  • Create New...