Jump to content

watthehell

Members
  • Posts

    143
  • Joined

  • Last visited

    Never

Everything posted by watthehell

  1. Thanks for pointing that, I will do it ...
  2. Yes the link comes like this , and when i give the user password to PHP My Admin, they can go inside CPanel while logging out through PHP MyAdmin, and from there they can access the CPanel. Can't we make like http://www.mydomain.com/_pma so that the the user directly opens the php my admin, I Searched in PHP MyAdmin docs i found nothing related to Cpanel. Any further help ??
  3. Hi all, Does anybody knows how to set up PHP MyAdmin on the server using Cpanel. I have seen other sites which has access to PHP MyAdmin like http://www.mydomain.com/_pma and it directly opens the PHP myAdmin login page. I searched the help docs in Cpanel but nothing written on that. Any help please...
  4. Yeah, it is not working in IE-6, without seeing the code it is hard to tell ... But one guess If you have <?php include("banner.php"); ?> // or whatever file name you gave Then there must be some problem in that file. Same thing happened to me too so just a guess... post your code then someone could help you out... cheers...
  5. <?php if (empty($_POST['balance'])) { $balance = $_POST['totalPymts']; } else { $balance = $_POST['balance']; } ?>
  6. Yes if you use names then there will be two results for $row['name'], so it will be hard to fetch the one you want, I guess there wont be problem with number though...
  7. Try running this code in PHP My Admin and see the result... how the fields are displayed then you can assign by no. i.e. <?php echo $row[0]; echo $row[1]; ?> like this
  8. Hi all.. Now i got to make a website which has a complicated (for me) requirement. I just want to know if this can be done or not. It goes like this : ------------------------------------------------- The website sells motor parts (online). In the front end it shows price and model of different parts found in the market. The admin enters all the stuff at the back end (price and model ) which is reflected in the front end. The complicated part what the client wants is : He wants a script which will run online (basically PHP) which will run in the background and will gather the PRICE from other (rival) websites and update in its own MySQL database. This script will run every hour and update the existing database. This has to be fully automated (as the client says). Is this possible ??? ??? ??? Then how ? Thanks a lot... for seeing
  9. printf("<td align=center><a href=ad_editmgroup.php?myid=".$grp_id.">Edit</a></td>", $myrow['grp_id']); And on other page use $yourvarname=$_REQUEST['myid'];
  10. <?php if (!empty($error)) { // this checks for is empty or not if (!$error) { //like this ?> <?php if (isset($mem_id)) { ?> html html html <? } ?>
  11. hi all i got this code <?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> <? } ?> It gives an error Parse error: syntax error, unexpected T_ELSE in c:\wamp\www\pankopat\reservation.php on line 192
  12. Thanks a lot for your help... Closing this thread now..
  13. Thanks a lot Can you explain this please printf ("<option value='%02d'>%02d</option>\n", $i, $i); what is %02d for anyway thanks it worked..
  14. hi, i was doing a for.. loop which comes at 10 interval and populate a list box, can anyone guide me i write this didn't work <? for($i=10;$i<=60;$i++){?> <option value="<?=$i+9;?>"><? echo $i;?></option> <? }?> the output should be like this 00 10 20 30 40 50 any help.. plz
  15. See this example I did for Quiz.. it is almost same like yours hope this helps .... <? session_start(); ob_start(); include("./include/userconfig.php"); /// here is the function to show the paging function showPaging($curpage) { global $sCurpageurl; global $offset; global $limit; global $nTotalrows; global $nTotalpage; global $sOrderpagetype; global $sOrderfield; echo" <table width=100% border=0 cellspacing=0 cellpadding=5 class=flash_info >"; echo "<tr>"; $lastrowno=$offset+$limit; if($lastrowno>=$nTotalrows) $lastrowno=$nTotalrows; if($nTotalrows==0) $startrow=0; else $startrow=$offset+1; echo"<td align=left width=50% class='flash_info'><b></b> " .$startrow ." - ". ($lastrowno) ." of ". $nTotalrows ."</td>"; echo"<td align=right width=50% class='flash_info'>"; echo "<b>Page : </b>"; /* -- for prev if($curpage<=$totalpage&&$curpage!=1) { $prepage=$curpage-1; echo"<a href=broadcast.php?pno=".$prepage. "&field=".$orderfield."&pord=".$orderpagetype."> Prev</a> "; } */ for($i=1;$i<=$nTotalpage;$i++) { $curOffset=($i-1)*$limit; if($i==$curpage) echo "<b> ".$i."</b>"; else if ( strpos($sCurpageurl,"?")>0) { echo" <a href=".$sCurpageurl."&offset=".$curOffset."&pno=".$i."&field=".$sOrderfield."&pord=".$sOrderpagetype." admin_menu_link>".$i."</a>" ; } else { echo" <a href=".$sCurpageurl."?offset=".$curOffset."&pno=".$i."&field=".$sOrderfield."&pord=".$sOrderpagetype." admin_menu_link>".$i."</a>" ; } } /* for next if($curpage<$totalpage&&$curpage!=$totalpage) { $nextpage=$curpage+1; echo" <a href=broadcast.php?pno=".$nextpage ."&field=".$orderfield."&pord=".$orderpagetype.">Next</a>"; } */ echo"</td></tr></table>"; } function totalPages($strsql){ global $limit; global $nTotalrows; global $nTotalpage; $rs1=mysql_query( $strsql)or die("query failed11".mysql_error()); $rowno=mysql_num_rows($rs1); if($rowno>0) $nTotalpage=ceil($rowno/$limit); else $nTotalpage=0; $nTotalrows=$rowno; } // end of functions // request id from Main Page $id=$_REQUEST['tid']; Connect(); $sTable ="quiz_question"; $sCurpageurl="permis_test.php"; // store the requsted variable in the id $tid = $id; // PAging code if(!isset($_REQUEST["offset"])) { // This variable is set to zero for the first page $offset = 0; } else $offset=$_REQUEST["offset"]; // passing offeset value in next page if (isset($_POST['offset'])) $offset = $_POST['offset']; //echo $offset; // // $eu = ($offset - 0); $limit =5; // no. of result to be shown // check for pno also.. it is passed from hidden value when submit is pressed if(isset($_REQUEST["pno"])) { $current = $_REQUEST["pno"]; } else { if (isset($_POST['pno']) ) { $current=$_POST['pno']; } else { $current=1; } } $back = $eu - $limit; $next = $eu + $limit; $nextoffset = ($offset + 5); $nextpno = $current + 1; // select questions $qry="SELECT * FROM $sTable where test_id=".$id." order by que_id asc"; totalPages($qry); $query=$qry." limit ".$offset .",".$limit; $result=mysql_query($query); ?> <!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=iso-8859-1" /> </head> <body> <form name="frmsubmit" method="POST" action="permis_test.php?tid=<?=$id?>" enctype="multipart/form-data"> <tr> <td height="33" colspan="3" align="center" valign="top"> <input type="image" name="btnSubmit" id="btnSubmit" src="images/checkanswer.gif" value="Check" /> <!--<input type="image" name="btnSubmit" id="btnSubmit" src="images/checkanswer.jpg" value="Check" /> --> <input type="hidden" name="offset" value="<?=$offset?>"> <input type="hidden" name="pno" value="<?=$current?>"> <input type="hidden" name="questions" value="questions"> </td> <td width="3"></td> </tr> <tr> <td width="78" height="28" valign="middle" class="contactTextBold"> <a href="permis.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('retour','','images/retour_on.gif',1)"><img src="images/retour_off.gif" alt="Re Tour" name="retour" width="55" height="14" border="0" id="retour" /></a><a href="permis.php" class="contactTextBold"></a> </td> <td width="159" align="center" valign="middle" class="home_dynamic_text"> <a href="test.php?offset=<?=$nextoffset?>&pno=<?=$nextpno?>&tid=<?=$tid?>" class="contactTextBold"> Next >></a> </td> <td></td> </tr> </form>
  16. Oops.. i didn't mean that please have a look I got this function function DisplayCalender($id,$month,$year) { $date=date("d"); $month_curr=date("n"); $year_curr=date("Y"); // and i saved the value in session here if($i==$date && $year_curr==$year && $month_curr==$month) { // save the curr date in session $_SESSION['mycurrdate']=$year_curr.'-'.$month_curr.'-'.$i; $_SESSION['myselecteddate']=$month_curr.'-'.$year_curr; $_SESSION['currmonth'] = $month_curr; $_SESSION['curryear'] = $year_curr; $class_bg="cal_font_current"; $date_class="cal_font_current"; //$symbol1="car_curr"; //$symbol2="curr_sym"; } // other codes // end of function } And i called it here <td width="212" height="35" align="center" valign="middle" bgcolor="#EB208C" class="cal_font_month" style="background-image:url(images/navigationbg.jpg);"><?php echo @$_SESSION['mycurrdate']; ?></td> And after that i called the function <td height="226" colspan="2" valign="top" bgcolor="#EB208C"><? $id=1; $month=date("n"); $year=date("Y"); DisplayCalender($id,$month,$year); ob_end_flush(); ?></td> So any idea...
  17. Is that an answer ??? > Are you going to do it ???
  18. check this now... <?php //This function reads the extension of the file. //It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. //The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an error occures. //If the error occures the file will not be uploaded. $errors=0; //checks if the form has been submitted if(isset($_POST['Submit'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { /// this if is not closed i think //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Unknown extension!</h1>'; $errors=1; } else { //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=rand().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="imgs/".$image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } else { $imageDirectory = "imgs/"; $imageName = $image_name; $thumbDirectory = "imgs2/"; $thumbWidth = 100; $quality = 80; function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth, $quality){ $details = getimagesize("$imageDirectory/$imageName") or die('Please only upload images.'); $type = preg_replace('@^.+(?<=/)(.+)$@', '$1', $details['mime']); eval('$srcImg = imagecreatefrom'.$type.'("$imageDirectory/$imageName");'); $thumbHeight = $details[1] * ($thumbWidth / $details[0]); $thumbImg = imagecreatetruecolor($thumbWidth, $thumbHeight); imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $details[0], $details[1]); eval('image'.$type.'($thumbImg, "$thumbDirectory/$imageName"'. (($type=='jpeg')?', $quality':'').');'); imagedestroy($srcImg); imagedestroy($thumbImg); } foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "data/$name"); createThumbnail("/car_images", $name, "/car_images_new", 100, 80); //100 = thumb width :: 80 = thumb quality (1-100) } } //********** for was not closed //This gets all the other information from the form $nameb=$_POST['name']; $country=$_POST['menuFilesDMA']; $type=$_POST['Catagory']; $Email=$_POST['Email']; $Title=$_POST['title']; $Abstract=$_POST['message']; $Article=$_POST['messagetwo']; $pic=($name); // Connects to your Database mysql_connect("localhost", "adder", "clifford") or die(mysql_error()) ; mysql_select_db("real") or die(mysql_error()) ; //Writes the information to the database mysql_query($sql = "insert into `items` (`name`, `country`, `type`, `Email`, `Title`, `Abstract`, `Article`, `photo`) values ('$nameb', '$country', '$type', '$Email', '$Title', '$Abstract', '$Article', '$pic')"); //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } } } //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
  19. There must be a way somehow.. Does storing $_SESSION value inside a function shows this session value before calling the same function ??
  20. Check this ... <form name="form1" method="post" action="test3.php"> <input name=search class="arial"id=Username value="" size="15"></td> <input type="submit" name="GO" value="GO"> </form> and search and paginging code<?php if($_POST['GO']!="") { $link = mysql_connect('localhost', 'root', ''); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('admin', $link); if (!$db_selected) { die ('Can\'t connect to database : ' . mysql_error()); } // All database details will be included here $page_name= "test3.php"; // If you use this code with a different page ( or file ) name then change this if(!isset($start)) { // This variable is set to zero for the first page $start =0; } $eu = ($start -0); $limit = 4; // No of records to be shown per page. $this = $eu + $limit; $back = $eu - $limit; $next = $eu + $limit; /////////////// WE have to find out the number of records in our table. We will use this to break the pages/////// $query2=" SELECT * FROM description where cat_ID='".$_POST['search']."'";//Url and Title like '%$_POST[search]%' $result2=mysql_query($query2); echo mysql_error(); $nume=mysql_num_rows($result2); echo $nume; /////// The variable nume above will store the total number of records in the table//// ////////////// Now let us start executing the query with variables $eu and $limit set at the top of the page/////////// $query=" SELECT * FROM description where cat_ID='".$_POST['search']."' limit $eu, $limit "; $result=mysql_query($query); echo mysql_error(); //////////////// Now we will display the returned records in side the rows of the table///////// echo "<table width=450 cellpadding=0 cellspacing=0 border=0>"; while($noticia = mysql_fetch_array($result)) { if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';} else{$bgcolor='#f1f1f1';} echo "<tr><td><a href='http://www.gmail.com' >$noticia[cat_ID][/url]</td></tr>"; echo "<tr><td >$noticia</td></tr>"; }echo "</table>";////////////////////////////// End of displaying the table with records ///////////////////////////// Variables set for advance paging///////////$p_limit=1000; // This should be more than $limit and set to a value for whick links to be breakedif(!isset($p_f)){$p_f=0;}$p_fwd=$p_f+$p_limit;$p_back=$p_f-$p_limit;//////////// End of variables for advance paging ////////////////////////////// Start the buttom links with Prev and next link with page numbers /////////////////echo "<table align = 'center' width='350 '><tr><td align='left' width='20%'>";//if($p_f==0){print "<a href='$page_name?start=$p_back&p_f=$p_back'><font face='Verdana' size='2'>PREV $p_limit</font>"; } echo "</td><td align='left' width='10%'>"; //// if our variable $back is equal to 0 or more then only we will display the link to move back //////// if($back >=0 and ($back >=$p_f)) { print "<a href='$page_name?start=$back&p_f=$p_f'><font face='Verdana' size='2' class=toplink>PREV</font>[/url]"; } //////////////// Let us display the page links at center. We will not display the current page as a link /////////// echo "</td><td align=center width='30%'>"; for($i=$p_f;$i < $nume and $i<($p_f+$p_limit);$i=$i+$limit){ if($i <> $eu){ $i2=$i+$p_f; //echo " <a href='$page_name?start=$i&p_f=$p_f'><font face='Verdana' size='2'>$i</font>[/url] "; } //else { echo "<font face='Verdana' size='4' color=red>$i</font>";} /// Current page is not displayed as link and given font color red } echo "</td><td align='right' width='10%'>"; ///////////// If we are not in the last page then Next link will be displayed. Here we check that ///// if($this < $nume and $this <($p_f+$p_limit)) { print "<a href='$page_name?start=$next&p_f=$p_f'><font face='Verdana' size='2' class=toplink>NEXT</font>[/url]";} echo "</td><td align='right' width='20%'>"; //if($p_fwd < 1){ //print "<a href='$page_name?start=$p_fwd&p_f=$p_fwd'><font face='Verdana' size='2'>Last $p_limit 1</font>[/url]"; //} echo "</td></tr></table>"; } ?>
  21. There is no If for this else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> check ur code
  22. I tweaked your code lil' bit and finally the output was really great thanks But another problem it returned the time as 14.20 when my pc time is 2:20. Can't we get 2.20 instead of 14 ?? Is that possible...
  23. I don't need date only time i did $t = time(); print $t; it come like this 1189757419
  24. How to get a current time from PHP time() function : When i did $my_current_time=time(); echo $my_current_time; it returns 1189757415 as the result. How to get in hour:min format i didnt find any help from PHP manual
×
×
  • 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.