PHP - Can't Open Url In New Tab
I am new to website development. I can't figure out how to open a new tab for the following javasript. I went through related questions but nothing worked for me. I want the browser to open a new tab when someone clicks on the link (example.com) below. The code target="_blank doesn't work here... What code should I add and where should I place that code?
Similar TutorialsI'm trying to open a URL using fopen() and I keep getting this error: Code: [Select] Failed to open stream: Permission deniedI can not work out what is wrong, it's not a firewall as far as I can tell. Not to say that this occurs in every php software out there, but I far too occasionally notice that the application is written with scattered php open and close tags, for instance
<?php if(true) ?> <?php { ?> Blah blah blah, because it's true <?php } else { ?> because it's not true <?php } ?>To me, it is extremely irritating. Regardless, I see a lot of open source software written this way and I can't help but think that there must be some underlying reason for it. Magento, for example, is written exactly in this manner. The templates are infested with these opened and closed php snippets. Obscurity is not security so I'm ruling security reasons out. Maybe it is more efficient? -- But I couldn't understand why, if so. It seems like that would put more of a drag on the system itself causing php to start and stop parsing continually and excessively, then again, I'm no expert in the field of memory consumption and other operating system complexities. Honestly, in my opinion, it is stupid. i would never write a program that way.. HEREDOCs are much more useful and eye pleasing than that awful <?php { ?> I had the misfortune a few months ago when I purchased an invoicing/customer maintenance system that I didn't know was written for PHP 5.2 or something lower, one that allowed short tags; and thus short tags were used in the same manner as I've described. Is this just plain disorganization or is there some deep-seated inner lining advantage that I'm not aware of? Hi, I need to open an RTF File on client side. When user submit form, the system will write some data in database and at the end, it has to open an rtf file in order to user be able to print it. Any ideas? Thanks Hugo It might be a funny question, but I hope the pro can help me. I want to use ?id= to display the other page/url instead of showing the full address due to certain reasons. What do I mean is like there are 2 different static page e.g. main.php and subpage.php I would like to use id to display as the url for subpage.php i.e. main.php?id=1 actually is displaying subpage.php Any idea?? Help!! Thanks! Hi i have been working on a cow management program PHP based. it works beautifull but now i'm stuck , and i hope i post it in the right forum. On demand php has to generate an export.txt file with basic cow information (tag#, transponder#, Bdate) this will be read by the parlour computer an Eprom based computer serial connected. I finished the script and it creates a beautifull TXt file exxept it's php http://localhost/tmp/test.php if i open that URL in notepad, it prints the txt file: Quote DH9900010090000624000900002080 VH990001 Dairy Comp 305 20100203 DN99000200312008080003000020800030000303000300035 08000300357080003001940800030003308000300036020 VN99000200001034000014010052009112620100922201102 042001111706 VN99000200001061000009420032010032820100906????????2007120101 VN99000200001083000067850032010061720100927????????2002030706 VN99000200001104000055440052009062720100817201101 032002080605 VN99000200001116000078540042010083120110207????????2002082205 VN990002000011470000816800220101226????????????????2003010806 VN99000200001153000070120032010030420100906????????2003020305 but when i enter that URL in the sync.BAT nothing happends.. my question is, doe anyone know if there is a way to fool DOS for accepting a PHP url?. OR is there a way for Apache to treat one TXT file as an PHP file? my script: Code: [Select] <?php //request sql cow info $db_host = 'localhost'; $db_user = ''; $db_pwd = ''; $database = 'cowdbase'; $table = 'cows'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // sending query $result = mysql_query("SELECT * FROM {$table}"); if (!$result) { die("Query to show fields from table failed"); } //quiery alle info $query="SELECT * FROM {$table}"; $result=mysql_query($query); // hoeveel rijen zijn er? $num=mysql_numrows($result); //Type the header from the text file echo "DH9900010090000624000900002080" . PHP_EOL ; echo "VH990001 Dairy Comp 305 20100203" . PHP_EOL ; echo "DN9900020031200808000300002080003000030300030003508000300357080003001940800030003308000300036020" . PHP_EOL ; mysql_close(); $i=0; while ($i < $num) { $cowtag=mysql_result($result,$i,"cowTag"); $bdate=mysql_result($result,$i,"Bdate"); $group=mysql_result($result,$i,"group"); $alpro=mysql_result($result,$i,"Alpro_trans"); // LIST ALLE KOEIEN KOE VOOR KOE /// unknown cowtag unknown-0000 #### Alpro tag 00 Group 20 Fresh dateyymmdd 20 Heatdate yymmdd, Drydate YYYYMMDD, Birthdate YYYYMMDD Lactation number ## echo "VN9900020000" . str_pad($cowtag, 4, "0", STR_PAD_LEFT) . "0000" . str_pad($alpro, 4, "0", STR_PAD_LEFT) . "00" . "$group" . "20" . "0000" . "????????????????" . "00000000" . "01" . PHP_EOL ; $i++; } echo "EN" . PHP_EOL ; echo "ZN" . PHP_EOL ; ?> Hi Guys, I have a question, is it possible to leave an ELSE statement open within an Include file and end the ELSE statement later in the main page? For example: <?php include 'PHP/db.php'; //include database info include 'PHP/login-top.php'; //include PHP code for Login functions info ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="CSS/login.css"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <form class="form-signin" method="POST"> <?php if(isset($fmsg)){ ?> <div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div> <?php } ?> <h2 class="form-signin-heading">Please Login</h2> <div class="input-group"> <span class="input-group-addon" id="basic-addon1">@</span> <input type="text" name="Email" class="form-control" placeholder="Email" required> </div> <label for="inputPassword" class="sr-only">Password</label> <input type="password" name="Password" id="inputPassword" class="form-control" placeholder="Password" required> <button class="btn btn-lg btn-primary btn-block" type="submit">Login</button> <a class="btn btn-lg btn-primary btn-block" href="register.php">Register</a> </form> </body> </html> <?php } ?> At the moment I'm getting the following error: QuoteParse error: syntax error, unexpected '}', expecting end of file in C:\xampp\htdocs\BETA\login.php on line 46 But the } on line 46 is the closing of the ELSE { part within login-top.php include file. If i take all the code out of the include file (login-top.php) and place it in the same file as login.php it all works fine. But my aim to try and make the pages less cluttered and more easy to edit the design/HTML side of things which is why im placing the important PHP code in seperate files and including them when they need to be included. Any help would be great, and thank you! I have an excel file with many rows and columns but depending on the user I need it to show only one row. I am a php newbie. Hi I am trying to get the structure of some folders/files on my server to create an xml "Feed" which then goes to a flash file. I keep getting the error message that I can't open the folder (it is set to 755) ERROR: Could not open folder: http://www.name/templates/bluezoo/mp3s What am I doing wrong please. Many thanks in advance Edward Here's some php: Code: [Select] $directoryLocation="http://www.name/templates/bluezoo/mp3s"; // XML Doctype $xml = new DomDocument('1.0', 'UTF-8'); $xml->xmlStandalone = false; // XML Root element $root = $xml->createElement('mp3s'); $root = $xml->appendChild($root); // Grab a list of folders from the specified directory if ($dir = @opendir($directoryLocation)) { while (false !== ($file = readdir($dir))) { if (is_dir($directoryLocation . DIRECTORY_SEPARATOR . $file) && $file != '.' && $file != '..') { // If it is a folder, put it in the folders array $folders[] = $file; } } I have a url like http://www.northplanet.co.uk/blog.php?empty_cache= and i want to use curl to run the url, when the url is accessed in the browser it clears the cache how can i make php access and run the url in the background? Hi Guys,
I have a Url which allows me to send sms to a number. The url usually asks for id , number and few other things. When I paste the url in browser and press enter it opens and a sms is sent.
Now I want to code in php a way to send sms without redirecting to that page. For e.g. I ask user his mobile number and then I should be able to call/run that url and a sms should be sent to his number. If I use php header then it redirects to that page. I have tried using file_get_contents and php cURL but it has not worked so far.
Can you guys help me out ?
Thank you,
Cheers,
GR
Hi there again all I am making a site that has a popout music player. My question is since the player is opened by javascript is there a way to let the original page know that the popout is open? hi there i have a basic image gallery. it displays smaller thumbnails in a folder and when you click on them it displays a larger image. how can i make the larger image open in a seperate window of 640x480 when the thumbnail is clicked? thanks here is the code: <?php include('connect.php'); $images = "images/"; # Location of small versions $big = "big/"; # Location of big versions (assumed to be a subdir of above) $cols = 4; # Number of columns to display if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($big,"/")) { $files[] = $file; } } closedir($handle); } $colCtr = 0; echo '<table width="50%" cellspacing="3" align=center ><tr>'; foreach($files as $file) { if($colCtr %$cols == 0) echo '</tr><tr><td colspan="10" ></td></tr><tr>'; echo '<td ><a href="' . $images . $big . $file . '" ><img src="' . $images . $file . '" /></a></td>'; $colCtr++; } echo '</table>' . "\r\n"; ?> I have this code: $shell = new COM('WScript.Shell'); $shell->Run("C:\WINDOWS\system32\cmd.exe /K ".$ini['indexer']['command'], 0, false); When it runs, it opens the command line, but then when it is done, it leaves the process open. How can I close it when the process is complete? I would like to open a new IE window. But, failed to do that. Is there any wrong with my statements? Code: [Select] <?php $url='http://www.google.com'; $browser = new COM("InternetExplorer.Application"); $browser->Visible = true; $browser->Navigate($url); ?> Can anyone help me with this pls? Thank you. Regards, juzz If I want to open a new tab try target = blank in anchor tab I have a form with action e.g. register.php I also have a Google group API link - https://www.pakainfo.com/ in short... Is there any PHP function for open page in new tab; on page load... Hi, i need to check 150 pages, i allready have the links in a list. Instand of clicking one, going back to the document click another one etc. I want a faster way to open them all in once. how can i make a page that if i open the page the pages gets opened in tabs? (I also tried a fireflox plug in called snapLinksMod but it's quite a old build and it doesn't seem to work anymore). I had some errors in my script but I solved the most of them except two: Warning: require_once(/home/a3443899/smarty/libs/Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /home/a3443899/public_html/include/config.php on line 32 Fatal error: require_once() [function.require]: Failed opening required '/home/a3443899/smarty/libs/Smarty.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a3443899/public_html/include/config.php on line 32 And I checked the map what he couldn't open the map names are just good Here is the config.php script: Code: [Select] <? $config = array(); // Begin Configuration // This Template was Downloaded From GrabTemplates.com $config['basedir'] = 'something'; $config['baseurl'] = 'something'; $DBTYPE = 'mysql'; $DBHOST = 'my host'; $DBUSER = 'my username'; $DBPASSWORD = 'my pass'; $DBNAME = 'my dbname'; // End Configuration ini_set('session.save_path', $config['basedir']. '/temporary/sessions'); session_start; $config['adminurl'] = $config[baseurl].'/administrator'; $config['cssurl'] = $config[baseurl].'/css'; $config['imagedir'] = $config[basedir].'/images'; $config['imageurl'] = $config[baseurl].'/images'; $config['picdir'] = $config[basedir].'/pics'; $config['picurl'] = $config[baseurl].'/pics'; $config['tpicdir'] = $config[basedir].'/pics/thumbs'; $config['tpicurl'] = $config[baseurl].'/pics/thumbs'; $config['membersprofilepicdir'] = $config[imagedir].'/membersprofilepic'; $config['membersprofilepicurl'] = $config[imageurl].'/membersprofilepic'; $config['mbgdir'] = $config[imagedir].'/mbg'; $config['mbgurl'] = $config[imageurl].'/mbg'; require_once($config[basedir].'/smarty/libs/Smarty.class.php'); require_once($config[basedir].'/libraries/mysmarty.class.php'); require_once($config[basedir].'/libraries/SConfig.php'); require_once($config[basedir].'/libraries/SError.php'); require_once($config[basedir].'/libraries/adodb/adodb.inc.php'); require_once($config[basedir].'/libraries/phpmailer/class.phpmailer.php'); require_once($config[basedir].'/libraries/SEmail.php'); function strip_mq_gpc($arg) { if (get_magic_quotes_gpc()) { $arg = str_replace('"',"'",$arg); $arg = stripslashes($arg); return $arg; } else { $arg = str_replace('"',"'",$arg); return $arg; } } $conn = &ADONewConnection($DBTYPE); $conn->PConnect($DBHOST, $DBUSER, $DBPASSWORD, $DBNAME); @mysql_query("SET NAMES 'UTF8'"); $sql = "SELECT * from config"; $rsc = $conn->Execute($sql); if($rsc){while(!$rsc->EOF) { $field = $rsc->fields['setting']; $config[$field] = $rsc->fields['value']; STemplate::assign($field, strip_mq_gpc($config[$field])); @$rsc->MoveNext(); }} if ($_REQUEST['language'] != "") { if ($_REQUEST['language'] == "english") { SESSION_REGISTER("language"); $_SESSION[language] = "english"; } elseif ($_REQUEST['language'] == "spanish") { SESSION_REGISTER("language"); $_SESSION[language] = "spanish"; } elseif ($_REQUEST['language'] == "french") { SESSION_REGISTER("language"); $_SESSION[language] = "french"; } } if ($_SESSION['language'] == "") { SESSION_REGISTER("language"); $_SESSION[language] = "english"; } if ($_SESSION['language'] == "english") { include("lang/english.php"); } elseif ($_SESSION['language'] == "spanish") { include("lang/spanish.php"); } elseif ($_SESSION['language'] == "french") { include("lang/french.php"); } else { include("lang/english.php"); } for ($i=0; $i<count($lang)+1; $i++) { STemplate::assign('lang'.$i, $lang[$i]); } STemplate::assign('baseurl', $config['baseurl']); STemplate::assign('basedir', $config['basedir']); STemplate::assign('adminurl', $config['adminurl']); STemplate::assign('cssurl', $config['cssurl']); STemplate::assign('imagedir', $config['imagedir']); STemplate::assign('imageurl', $config['imageurl']); STemplate::assign('picdir', $config['picdir']); STemplate::assign('picurl', $config['picurl']); STemplate::assign('tpicdir', $config['tpicdir']); STemplate::assign('tpicurl', $config['tpicurl']); STemplate::assign('membersprofilepicdir', $config['membersprofilepicdir']); STemplate::assign('membersprofilepicurl', $config['membersprofilepicurl']); STemplate::assign('mbgdir', $config['mbgdir']); STemplate::assign('mbgurl', $config['mbgurl']); STemplate::setCompileDir($config['basedir']."/temporary"); STemplate::setTplDir($config['basedir']."/themes"); ?> Hello, I'm working with Zend Framework on Linux, and I'm trying to generate a CAPTCHA using Zend_Form_Element_Captcha. Whenever the CAPTCHA page loads I get this error: [12-Jan-2011 18:14:54] PHP Warning: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Unable to open '/var/www/square/application/../public/captcha/ebf44d292149b3ebda05571c54c463a8.png' for writing: Permission denied in /usr/local/zend/share/ZendFramework/library/Zend/Captcha/Image.php on line 563 Here's my code for generating the CAPTCHA: // create captcha $captcha = new Zend_Form_Element_Captcha('captcha', array( 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'width' => 300, 'height' => 100, 'imgUrl' => '/captcha', 'imgDir' => APPLICATION_PATH . '/../public/captcha', 'font' => APPLICATION_PATH . '/../public/fonts/LiberationSansRegular.ttf', ) )); I've checked permissions, and all directories mentioned above are accessible to root. Has anyone had a similar problem or have an idea how I can fix this? Kind Regards, Mike Can i open a pdf within a page? e.g. within <td> or <table> of htmls so that it appears on a section of a page where someone can just read through and still able to browse the web page. I dont want the PDF downloading or taking the whole page or even opening a new window and filling it. Thanks in advance. I want to do something like the following: exec('open /Applications/Safari.app'); I can run exec on other commands like: $output = exec('ls -ll); echo $output; And I can run the open command via Terminal, but I can't seem to run the open command via a PHP page using exec(). I've tried the permissions of the .app file at 777 and the open binary at 777. Any suggestions? |