Jump to content

python01

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by python01

  1. Thanks for the quick reply. Is there a name to this type of encoding of DB?
  2. I had website build by someone else and he encoded the payment info in the following format: payment_data card_first_name + card_last_name + card_adres + card_city + card_province + card_postal_code + card_nomber + card_month + card_year +card_cvv2 OR email When I query this information as a regular text data type I get the following: John|Doe|222 Thames Way|City|ON|X0X0X0|4512121214147878|/|456 So each value is separated by vertical line, what do I need to do to have them separated as individual values?
  3. I modified my file and now I get the message that the maximum execution time of 30 seconds is exceeded on line 121 or 106. Not sure why it is happening because I only moved some of the code from the main program area into subroutine. Before that it was running ok. I am posting the code below. Wonder if anyone can take a look at it and see what is holding it up. I went through it few times but can not find the issue. <?php $PropertyID = $_GET["ID"]; include "./db/db_textback.inc.php"; ?> <?php if(!isset($_GET['screen_check'])) { // $_GET['Width']=0; /* This code will be executed if screen resolution has not been detected.*/ echo "<script type='text/javascript'> <!-- document.location=\"?ID=$PropertyID&screen_check=done&Width=\"+screen.width+\"&Height=\"+screen.height; //--> </script>"; } else { /* This code will be executed after screen resolution is detected.*/ if(isset($_GET['Width'])){// && isset($_GET['Height'])) // Resolution detected $ScreenWidth=$_GET['Width'] * 0.9; } else { // Resolution not detected $ScreenWidth=235; } } echo "Screen width = ".$ScreenWidth; ?> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"/> </head> <?php //$TelNumberQuery = mysql_query("SELECT * FROM Txtlog WHERE TelNumber = '$fromNumber'"); // $TelNumberNum = mysql_num_rows($TelNumberQuery); // $TelNumberInfo = mysql_fetch_array($TelNumberQuery); function ImageSize($img, $maxwidth){ list($width, $height) = getimagesize($img); if ($width>$maxwidth){ $ratio=$maxwidth/$width; $newwidth=$maxwidth; $newheight=$height*$ratio; } else{ $newwidth=$width; $newheight=$height; } echo $newwidth." ".$newheight; return array($newwidth, $newheight); } function AgentMessage($AgentInfoContent){ if($AgentInfoContent['DisplayName']!=NULL){ echo $AgentInfoContent['DisplayName']; } else{ echo $AgentInfoContent['FirstName']." ".$AgentInfoContent['LastName']; } ?></br><?php if($AgentInfoContent['Title']!=NULL){ echo $AgentInfoContent['Title']; ?></br><?php } if($AgentInfoContent['Brokerage']!=NULL){ echo $AgentInfoContent['Brokerage']; ?></br><?php } if($AgentInfoContent['Telephone']!=NULL && $AgentInfoContent['DisplayTelephone']==1){ echo "Telephone: ".$AgentInfoContent['Telephone']; ?></br><?php } if($AgentInfoContent['Cell']!=NULL && $AgentInfoContent['DisplayCell']==1){ echo "Cell: ".$AgentInfoContent['Cell']; ?></br><?php } if($AgentInfoContent['Fax']!=NULL && $AgentInfoContent['DisplayFax']==1){ echo "Fax: ".$AgentInfoContent['Fax']; ?></br><?php } if($AgentInfoContent['Email']!=NULL && $AgentInfoContent['DisplayEmail']==1){ echo "Email: ".$AgentInfoContent['Email']; ?></br><?php } } function BodyDisplay(){ GLOBAL $PropertyInfo; GLOBAL $Title; GLOBAL $Count; GLOBAL $PictureURL; GLOBAL $PictureAlt; GLOBAL $AgentInfo; ?> <center><h3><?php echo $Title ?></h3></center> <?php //echo "Property id ".$PropertyID; while($Index<4 && $Index<$Count){ if($PropertyPicsNum>0){ $image=$PictureURL[$Index]; $alt=$PictureAlt[$Index]; list($newwidth, $newheight)=ImageSize($PictureURL[$Index],$ScreenWidth); ?> <center> <img src="<?php echo $PictureURL[$Index];?>" alt="<?php echo $PictureAlt[$Index]; ?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" /> </center></br> <?php $Index+=1; } ?> <?php //$Index+=1; } if($PropertyInfo['MLS']!=NULL){ ?> <center><?php echo "MLS# ".$PropertyInfo['MLS']; ?></center></br> <?php } if($PropertyInfo['Price']!=NULL){ ?> <center><?php echo "Price $".$PropertyInfo['Price']; ?></center></br> <?php } if($PropertyInfo['WebDescription']!=NULL){ ?> <center><?php echo $PropertyInfo['WebDescription']; ?></center></br> <?php } $AgentID=$PropertyInfo['AgentID']; $AgentInfoQuery=mysql_query("SELECT * FROM Agents WHERE ID = $AgentID"); $AgentNum=mysql_num_rows($AgentInfoQuery); if($AgentNum>0){ $AgentInfo=mysql_fetch_array($AgentInfoQuery); if($AgentInfo['Picture']==NULL){ AgentMessage($AgentInfo); } else{ $MaxAgentPicWidth=$ScreenWidth/10; list($newagentwidth, $newagentheight)=ImageSize($AgentInfo['Picture'],$MaxAgentPicWidth); ?> <table border="0" width="100%"> <tr> <td width="10%" valign="top" align="center"><img src="<?php echo $AgentInfo['Picture'];?>" alt="<?php echo $AgentInfo['DisplayName']; ?>" width="<?php echo $newagentwidth; ?>" height="<?php echo $newagentheight; ?></td> <td width="90%" valign="top" align="left"><?php AgentMessage($AgentInfo); ?></td> </tr> </table> <?php } } while($Index<$Count){ if($PropertyPicsNum>0){ $image=$PictureURL[$Index]; $alt=$PictureAlt[$Index]; list($newwidth, $newheight)=ImageSize($PictureURL[$Index],$ScreenWidth); ?> <center> <img src="<?php echo $PictureURL[$Index];?>" alt="<?php echo $PictureAlt[$Index]; ?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" /> </center></br> <?php $Index+=1; } } } //$PropertyID=2; $PropertyPicsQuery=mysql_query("SELECT * FROM PropertyPics WHERE PropertyID = '$PropertyID'"); $PropertyPicsNum=mysql_num_rows($PropertyPicsQuery); $Index=0; while($PropertyPicsInfo=mysql_fetch_array($PropertyPicsQuery)){ $PictureURL[$Index]=$PropertyPicsInfo['PicURL']; $PictureAlt[$Index]=$PropertyPicsInfo['PicAlt']; $Index+=1; } $Count=$Index; $Index=0; $PropertyInfoQuery=mysql_query("SELECT * FROM Properties WHERE ID = $PropertyID"); $PropertyInfo=mysql_fetch_array($PropertyInfoQuery); //echo "Number"; //echo $PropertyPicsNum; $Title = $PropertyInfo['Number']." ".$PropertyInfo['Street'].", ".$PropertyInfo['City'].", ".$PropertyInfo['Province']; ?> <body> <?php if($ScreenWidth<700){ BodyDisplay(); } else{ BodyDisplay(); } ?> </body>
  4. I think I was too happy too quickly but it seems that the issue occurs when the same page is reloaded or loaded again without closing the browser. If the page is loaded first time or the browser is closed and opened again before second page viewing everything is ok. It is almost like the values are adding up somehow if the cache is not cleared. Wonder if it can be resolved somehow. My actual code is below. <?php $PropertyID = $_GET["ID"]; include "./db/db_textback.inc.php"; ?> <?php if(!isset($_GET['screen_check'])) { // $_GET['Width']=0; /* This code will be executed if screen resolution has not been detected.*/ echo "<script type='text/javascript'> <!-- document.location=\"?ID=$PropertyID&screen_check=done&Width=\"+screen.width+\"&Height=\"+screen.height; //--> </script>"; } else { /* This code will be executed after screen resolution is detected.*/ if(isset($_GET['Width'])){// && isset($_GET['Height'])) // Resolution detected $ScreenWidth=$_GET['Width']; } else { // Resolution not detected $ScreenWidth=235; } } echo "Screen width = ".$ScreenWidth; ?> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"/> </head> <?php //$TelNumberQuery = mysql_query("SELECT * FROM Txtlog WHERE TelNumber = '$fromNumber'"); // $TelNumberNum = mysql_num_rows($TelNumberQuery); // $TelNumberInfo = mysql_fetch_array($TelNumberQuery); function ImageSize($img, $maxwidth){ list($width, $height) = getimagesize($img); if ($width>$maxwidth){ $ratio=$maxwidth/$width; $newwidth=$maxwidth; $newheight=$height*$ratio; } else{ $newwidth=$width; $newheight=$height; } echo $newwidth." ".$newheight; return array($newwidth, $newheight); } function AgentMessage(){ if($AgentInfo['DisplayName']!=NULL){ echo $AgentInfo['DisplayName']; } else{ echo $AgentInfo['FirstName']." ".$AgentInfo['LastName']; } ?></br><?php if($AgentInfo['Title']!=NULL){ echo $AgentInfo['Title']; ?></br><?php } if($AgentInfo['Brokerage']!=NULL){ echo $AgentInfo['Brokerage']; ?></br><?php } if($AgentInfo['Telephone']!=NULL && $AgentInfo['DisplayTelephone']==1){ echo "Telephone: ".$AgentInfo['Telephone']; ?></br><?php } if($AgentInfo['Cell']!=NULL && $AgentInfo['DisplayCell']==1){ echo "Cell: ".$AgentInfo['Cell']; ?></br><?php } if($AgentInfo['Fax']!=NULL && $AgentInfo['DisplayFax']==1){ echo "Fax: ".$AgentInfo['Fax']; ?></br><?php } if($AgentInfo['Email']!=NULL && $AgentInfo['DisplayEmail']==1){ echo "Email: ".$AgentInfo['Email']; ?></br><?php } } //$PropertyID=2; $PropertyPicsQuery=mysql_query("SELECT * FROM PropertyPics WHERE PropertyID = '$PropertyID'"); $PropertyPicsNum=mysql_num_rows($PropertyPicsQuery); $Index=0; while($PropertyPicsInfo=mysql_fetch_array($PropertyPicsQuery)){ $PictureURL[$Index]=$PropertyPicsInfo['PicURL']; $PictureAlt[$Index]=$PropertyPicsInfo['PicAlt']; //START OF IMAGE CHANGE ROUTINE /* $maxwidth = 120; $maxheight = 150; $img = imagecreatefromjpeg($jpgimage); //or imagecreatefrompng,imagecreatefromgif,etc. depending on user's uploaded file extension $width = imagesx($img); //get width and height of original image $height = imagesy($img); //determine which side is the longest to use in calculating length of the shorter side, since the longest will be the max size for whichever side is longest. if ($height > $width) { $ratio = $maxheight / $height; $newheight = $maxheight; $newwidth = $width * $ratio; { else { $ratio = $maxwidth / $width; $newwidth = $maxwidth; $newheight = $height * $ratio; } //create new image resource to hold the resized image $newimg = imagecreatetruecolor($newwidth,$newheight); $palsize = ImageColorsTotal($img); //Get palette size for original image for ($i = 0; $i < $palsize; $i++) //Assign color palette to new image { $colors = ImageColorsForIndex($img, $i); ImageColorAllocate($newimg, $colors['red'], $colors['green'], $colors['blue']); } //copy original image into new image at new size. imagecopyresized($newimg, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($newimg,$outputfile); //$output file is the path/filename where you wish to save the file. //Have to figure that one out yourself using whatever rules you want. Can use imagegif() or imagepng() or whatever. */ //END OF IMAGE CHANGE ROUTINE $Index+=1; } $Count=$Index; $Index=0; $PropertyInfoQuery=mysql_query("SELECT * FROM Properties WHERE ID = $PropertyID"); $PropertyInfo=mysql_fetch_array($PropertyInfoQuery); //echo "Number"; //echo $PropertyPicsNum; $Title = $PropertyInfo['Number']." ".$PropertyInfo['Street'].", ".$PropertyInfo['City'].", ".$PropertyInfo['Province']; ?> <body> <center><h3><?php echo $Title ?></h3></center> <?php //echo "Property id ".$PropertyID; while($Index<4 && $Index<$Count){ if($PropertyPicsNum>0){ $image=$PictureURL[$Index]; $alt=$PictureAlt[$Index]; list($newwidth, $newheight)=ImageSize($PictureURL[$Index],$ScreenWidth); ?> <center> <img src="<?php echo $PictureURL[$Index];?>" alt="<?php echo $PictureAlt[$Index]; ?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" /> </center></br> <?php $Index+=1; } ?> <?php //$Index+=1; } if($PropertyInfo['MLS']!=NULL){ ?> <center><?php echo "MLS# ".$PropertyInfo['MLS']; ?></center></br> <?php } if($PropertyInfo['Price']!=NULL){ ?> <center><?php echo "Price $".$PropertyInfo['Price']; ?></center></br> <?php } if($PropertyInfo['WebDescription']!=NULL){ ?> <center><?php echo $PropertyInfo['WebDescription']; ?></center></br> <?php } $AgentID=$PropertyInfo['AgentID']; $AgentInfoQuery=mysql_query("SELECT * FROM Agents WHERE ID = $AgentID"); $AgentNum=mysql_num_rows($AgentInfoQuery); if($AgentNum>0){ $AgentInfo=mysql_fetch_array($AgentInfoQuery); if($AgentInfo['Picture']==NULL){ AgentMessage(); } else{?> <table border="0" width="100%"> <tr> <td width="50%">row 1, cell 1</td> <td width="50%">row 1, cell 2</td> </tr> </table> <?php } } while($Index<$Count){ if($PropertyPicsNum>0){ $image=$PictureURL[$Index]; $alt=$PictureAlt[$Index]; list($newwidth, $newheight)=ImageSize($PictureURL[$Index],$ScreenWidth); ?> <center> <img src="<?php echo $PictureURL[$Index];?>" alt="<?php echo $PictureAlt[$Index]; ?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" /> </center></br> <?php $Index+=1; } } ?> </body>
  5. I posted wrong file but on the good note I think I got it. The screen width detection script was under the <head> section which contains the viewport meta tag and it seem that this was the issue. I moved it above the head section of the file and now everything works good, at least for the time being. I would like to thank everyone who took time to help me solve this issue.
  6. <?php include "db/db_textback.inc.php"; /** * Include twilio-php, the offical Twilio PHP Helper Library, which can be found at * http://www.twilio.com/docs/libraries */ require "Services/Twilio.php"; function sendSMS($ReplytoNumber, $Message, $NotifyAgent, $SendFinancial) { // Set AccountSid and AuthToken from www.twilio.com/user/account $AccountSid = "*******"; $AuthToken = "*******"; //Instantiate a new Twilio Rest Client $client = new Services_Twilio($AccountSid, $AuthToken); if($msgLen>160){ } $sms = $client->account->sms_messages->create("*******", $ReplytoNumber, $Message); if($SendFinancial==1) { $sms = $client->account->sms_messages->create("********", $ReplytoNumber, "Financial Info"); } } function timeDiff($firstTime,$lastTime) { // convert to unix timestamp $firstTime=strtotime($firstTime); $timeDiff=$lastTime-$firstTime; // return the difference return $timeDiff; } function NewKeywordReceived($result1,$fromNumber1) { $sql="SELECT * FROM Properties WHERE Keyword = '$result1'"; $KeywordQuery = mysql_query($sql); $KeywordNum=mysql_num_rows($KeywordQuery); $KeywordInfo = mysql_fetch_array($KeywordQuery); $Description = $KeywordInfo['Description']; if($KeywordNum>0){ mysql_query("INSERT INTO Txtlog (`ID`, `TelNumber`, `Keyword`, `Extended`, `TimeStamp`) VALUES (NULL, '$fromNumber1', '$result1', '0', CURRENT_TIMESTAMP)"); $Msg = "Please reply with house number."; sendSMS($fromNumber1,$Msg,0,0); } else{ $Msg = "Keyword ".$result1." not found. Please try again or reply with CLEAR to remove previous keywords from system and start over. Std msg rates may apply."; sendSMS($fromNumber1,$Msg,0,0); } } /* Read the contents of the 'Body' field of the Request. */ $body = $_REQUEST['Body']; $fromNumber = $_REQUEST['From']; /* Remove formatting from $body until it is just lowercase characters without punctuation or spaces. */ //$result = preg_replace("/[^A-Za-z0-9]/u", " ", $body); $result = $body; $result = trim($result); $result = strtolower($result); //$result = '111'; //$fromNumber = '+********'; /* ##Router## */ if($result == 'clear'){ mysql_query("DELETE FROM Txtlog WHERE TelNumber = '$fromNumber'"); mysql_query("DELETE FROM TxtlogExtended WHERE Telephone = '$fromNumber'"); sendSMS($fromNumber,"Your keywords have been cleared, please send valid keyword to get more info.\nStd msg rates may apply.",0,0); } else{ $TelNumberQuery = mysql_query("SELECT * FROM Txtlog WHERE TelNumber = '$fromNumber'"); $TelNumberNum = mysql_num_rows($TelNumberQuery); $TelNumberInfo = mysql_fetch_array($TelNumberQuery); $extended=$TelNumberInfo['Extended']; if($TelNumberNum > 0){ $CurrTime = time(); $PrevTime = $TelNumberInfo['TimeStamp']; $TimeDiff = timeDiff($PrevTime,$CurrTime); if($TimeDiff < 600){ $CurrKeyword = $TelNumberInfo['Keyword']; $PropertyInfoQuery = mysql_query("SELECT * FROM Properties WHERE Keyword = '$CurrKeyword' AND Subkeyword = '$result'"); $PropertyInfoNum = mysql_num_rows($PropertyInfoQuery); if($PropertyInfoNum == 1){ $PropertyInfo2 = mysql_fetch_array($PropertyInfoQuery); $PropertyID=$PropertyInfo2['ID']; $PropertyDescription = $PropertyInfo2['Description']; $AgentNotify=0; $Financial=$PropertyInfo2['FinancialNotify']; $MLS = $PropertyInfo2['MLS']; $Number = $PropertyInfo2['Number']; $Street = $PropertyInfo2['Street']; $City = $PropertyInfo2['City']; $Province = $PropertyInfo2['Province']; $Agent = $PropertyInfo2['Agent']; $AgentID = $PropertyInfo2['AgentID']; $Price = $PropertyInfo2['Price']; $Date = date("d.m.y"); if($FinancialNotify=NULL) $FinancialNotify=0; $AgentInfoQuery = mysql_query("SELECT * FROM Agents WHERE ID = '$AgentID'"); $AgentInfoNum = mysql_num_rows($AgentInfoQuery); else{ $AgentInfo = mysql_fetch_array($AgentInfoQuery); $AgentName = $AgentInfo['DisplayName']; $AgentTelephone = $AgentInfo['Telephone']; $AgentBrokerage = $AgentInfo['Brokerage']; $AgentInfoMessage = $AgentName." ".$AgentTelephone; if($AgentBrokerage!=NULL){ $AgentInfoMessage = $AgentInfoMessage."\n".$AgentBrokerage; } } $MessageText=$Number." ".$Street."\n".$PropertyDescription." a411.co/index.php?ID=".$PropertyID; if($MLS!=NULL){ $MessageText="MLS# ".$MLS."\n".$MessageText; } if($Price != NULL){ $MessageText=$MessageText." Price \$".$Price; } if($AgentInfoMessage!=NULL){ $MessageText = $MessageText."\n".$AgentInfoMessage; } sendSMS($fromNumber,$MessageText,$AgentNotify,$Financial); mysql_query("INSERT INTO Propertylog SET Active='Y', MLS='$MLS', Number='$Number', Street='$Street', City='$City', Province='$Province', Agent='$Agent', Telephone='$fromNumber', Notify=1, Date='$Date', TimeStamp=CURRENT_TIMESTAMP"); } else if($PropertyInfoNum > 1 OR $extended==1){ $id = $TelNumberInfo['ID']; if($extended==0){ mysql_query("UPDATE Txtlog SET TimeStamp = CURRENT_TIMESTAMP, Extended = '1' WHERE ID = $id"); $Index = 1; $Msg="Multiple Properties found\n"; while($PropertyInfo3 = mysql_fetch_array($PropertyInfoQuery)){ $HouseID[$Index]=$PropertyInfo3['ID']; $HouseKeyword[$Index]=$PropertyInfo3['Keyword']; $HouseSubkeyword[$Index]=$PropertyInfo3['Subkeyword']; $HouseNumber[$Index]=$PropertyInfo3['Number']; $HouseStreet[$Index]=$PropertyInfo3['Street']; $HouseCity[$Index]=$PropertyInfo3['City']; $HouseProvince[$Index]=$PropertyInfo3['Province']; $HouseTempKeyword[$Index]=$HouseSubkeyword[$Index].$Index; mysql_query("INSERT INTO TxtlogExtended (`ID`, `Telephone`, `Keyword`, `Subkeyword`, `TempKeyword`, `Index`) VALUES (NULL, '$fromNumber', '$HouseKeyword[$Index]', '$HouseSubkeyword[$Index]', '$HouseTempKeyword[$Index]', '$HouseID[$Index]')"); $Msg=$Msg.$HouseNumber[$Index]." ".$HouseStreet[$Index]." text ".$HouseTempKeyword[$Index]."\n"; $Index+=1; } sendSMS($fromNumber,$Msg,0,0); } else{ $MulitPropertyInfoQuery = mysql_query("SELECT * FROM TxtlogExtended WHERE TempKeyword = `$result`"); $MulitPropertyInfoNum = mysql_num_rows($MultiPropertyInfoQuery); if($MultiPropertyInfoNum == 1){ $MultiPropertyInfo = mysql_fetch_array($MultiPropertyInfoQuery); $MultiPropertyID = $MultiPropertyInfo['Index']; $FinalMultiPropertyInfoQuery=mysql_query("SELECT * FROM Properties WHERE ID = '$MultiPropertyID'"); $FinalMultiPropertyInfo=mysql_fetch_array($FinalMultiPropertyInfoQuery); $FinalMultiPropertyDescription=$FinalMultiProprtyInfo[Description]; $AgentNotify=0; $Financial=$FinalMultiPropertyInfo['FinancialNotify']; if($FinancialNotify=NULL) $FinancialNotify=0; sendSMS($fromNumber,$FinalMultiPropertyDescription,$AgentNotify,$Financial); mysql_query("UPDATE Txtlog SET Extended = '0' WHERE TelNumber = $fromNumber"); mysql_query("DELETE FROM TxtlogExtended WHERE Telephone = '$fromNumber'"); } else{ $Msg = "Property ".$result." not found. Please check the keyword and try again or reply with CLEAR to remove previous keywords from system and start over."; sendSMS($fromNumber,$Msg,0,0); } } } else{ $Msg = "Property number ". $result." not found, please try again or reply with CLEAR to remove previous keywords from system and start over. Std msg rates may apply."; sendSMS($fromNumber,$Msg,0,0); } } else{ mysql_query("DELETE FROM Txtlog WHERE TelNumber = '$fromNumber'"); NewKeywordReceived($result,$fromNumber); } } else{ NewKeywordReceived($result,$fromNumber); } } ?> I just tried it again without any changes to the script detecting the width and it showed width of 480 although the device was held vertical and it should have showed 320px The url show the width of 480px now, the full url looks like this: http://a411.co/index.php?ID=4&screen_check=done&Width=480&Height=241 Dont know where it takes the values for width and height, the display of my phone is 320px wide and 480px high mod edit: removed account/phone numbers
  7. Unfortunatelly neither Mahngiel nor Little Guy suggestion works. Is there a way to make this script reliable or is there more reliable way all together?
  8. Unfortunately the exit command does not make any difference.
  9. I am working on mobile webpage. The screen width is detected and the page properly sized when displayed on mobile devices but when I check it on PC the screen size is so large everything looks out of place. How can I make sure that the page will be displayed properly on PC screen as well even if it means that there will be a lot of gray area around the actual page? I guess one way would be to use php and do something like: if($screensize<700){ //Display mobile version } else{ //Display pc version } where the pc version would use css or tables to properly format the content but I wonder if there is easier/faster/better way to do it? Thanks.
  10. I am using the following script to detect the width of the users display to size the pictures properly <?php if(!isset($_GET['screen_check'])) { /* This code will be executed if screen resolution has not been detected.*/ echo "<script language='JavaScript'> <!-- document.location=\"?ID=$PropertyID&screen_check=done&Width=\"+screen.width+\"&Height=\"+screen.height; //--> </script>"; } else { /* This code will be executed after screen resolution is detected.*/ if(isset($_GET['Width'])){// && isset($_GET['Height'])) // Resolution detected $ScreenWidth=$_GET['Width']; } else { // Resolution not detected $ScreenWidth=235; } } echo "Screen width = ".$ScreenWidth; ?> My telephone is 320 x480px but sometimes it shows the width of 800, almost like it is adding these two values, other times it shows the correct values. Can anyone tell me why is it so and what can be done to prevent this issue? Thanks.
  11. Works great, thank you everyone for helping with this trouble.
  12. not sure if it will help but here is my actual URL being typed in/linked: http://www.lottocomplete.com/textback/mweb/index.php?ID=2 after the enter here is what I have in the URL field: http://www.lottocomplete.com/textback/mweb/index.php?screen_check=done&Width=1366&Height=768 I thought that before the URL gets replaced with the screen_check variables the ID would be saved to variable since it is the first thing in my program but for what ever reason it is not happening. Is there any way to combine these variables being passed? Is my initial URL correct? Is my problem completely something different? If I insert $PropertyID=2; somwhere in my code everything is working fine so I know the reminder of the code is working it is just the passing of the variable that causing my headache right now.
  13. I actually do have ?ID=2 in my url so it is matching, made mistake when I typed up this post. And it still does not work. Any ideas anyone? Thank you.
  14. <?php $PropertyID = $_GET["ID"]; ?> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"/> </head> <?php if(!isset($_GET['screen_check'])) { /* This code will be executed if screen resolution has not been detected.*/ echo "<script language='JavaScript'> <!-- document.location=\"$PHP_SELF?screen_check=done&Width=\"+screen.width+\"&Height=\"+screen.height; //--> </script>"; } else { /* This code will be executed after screen resolution is detected.*/ if(isset($_GET['Width'])){// && isset($_GET['Height'])) // Resolution detected $ScreenWidth=$_GET['Width']; } else { // Resolution not detected $ScreenWidth=235; } } echo "Screen width = ".$ScreenWidth; ?> If I do echo $PropertyID; nothing shows up so it looks that the variable is empty and did not get the value from $_GET. What am I doing wrong here?
  15. I am working on mobile workpage which would get variable passed in url and based on that id populate the webpage with information from database. I am also using the $GET['screen_check'] to get devices screen resolution. When I click on the link for example webpage.com/index.php?id=2 the id=2 part gets overwritten with the display resolution info and the information I am looking for does not appear. I have the $id=$GET_['id'] above the screen_check script so I think it should work but it does not What would be the correct way to do them both in the same php file? Thanks.
  16. I am new to databases and to web design at all and have to wrap my mind around how some stuff is done in mySQL. Lets say I want to have mySQL database to store daily weather conditions in major cities, which means I would have table with date, temperature, cloud cover, humidity, wind direction and wind speed. How would this be accomplished in mySQL? Would I have to create new table for each city every day and put this data into it or is there a function to add new table every day with the same template just by naming the original table/template? Would they be named automatically and which php keywords be used to do it? What is the auto-increment for?
×
×
  • 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.