marksie1988 Posted September 28, 2009 Share Posted September 28, 2009 Hi, i have a php script which will include other php files but this is causing some issues so i was wondering is there any way of changing this: include('ingram.php'); include('etc.php'); include('c2000.php'); to something like step 1 run ingram.php on success goto step2 on fail write to log then continue to step2 step2 run etc.php on success go to step3 on fail write to log then continue to step3 step3 run c2000.php on success finish on fail write to log then exit is this possible if so how? ive never done this before so a point in the right direction or a snippet would be helpful thanks Steve Link to comment https://forums.phpfreaks.com/topic/175821-how-to-do-once-step-1-complete-move-to-step-2/ Share on other sites More sharing options...
KFredje Posted September 28, 2009 Share Posted September 28, 2009 what's your exact problem? Link to comment https://forums.phpfreaks.com/topic/175821-how-to-do-once-step-1-complete-move-to-step-2/#findComment-926482 Share on other sites More sharing options...
redarrow Posted September 28, 2009 Share Posted September 28, 2009 add the links and log your self straight froward.... this is a three page example where the user can only go from a.php,b.php,c.php anywhere else get thrown back to the relevant page. page name a.php <?php if(!$_SERVER['PHP_SELF']=="a.php"){ header("location: b.php"); } ?> page name b.php <?php if(!$_SERVER['PHP_SELF']=="b.php"){ header("location: c.php"); } ?> page name c.php <?php if(!$_SERVER['PHP_SELF']=="c.php"){ header("location: b.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/175821-how-to-do-once-step-1-complete-move-to-step-2/#findComment-926495 Share on other sites More sharing options...
marksie1988 Posted September 28, 2009 Author Share Posted September 28, 2009 what's your exact problem? in each of the .php includes they import a csv file into mssql the issue with using include is that i get insert errors as if all of them are executing at once which is not good. i need each of the .php includes to run one at a time and log any failures in a txt or log file and then move on to next step even if it fails. Link to comment https://forums.phpfreaks.com/topic/175821-how-to-do-once-step-1-complete-move-to-step-2/#findComment-926499 Share on other sites More sharing options...
marksie1988 Posted September 28, 2009 Author Share Posted September 28, 2009 add the links and log your self straight froward.... this is a three page example where the user can only go from a.php,b.php,c.php anywhere else get thrown back to the relevant page. page name a.php <?php if(!$_SERVER['PHP_SELF']=="a.php"){ header("location: b.php"); } ?> page name b.php <?php if(!$_SERVER['PHP_SELF']=="b.php"){ header("location: c.php"); } ?> page name c.php <?php if(!$_SERVER['PHP_SELF']=="c.php"){ header("location: b.php"); } ?> to do it this way would mean editing each individual .php file i dont want to do this as in the actual file i have about 50 of these included files. csvimport.php (the one with the include statements in) would need to run all of the scripts step by step i dont want to edit all of the other included files if there was no other way to do this than edit all of the files i guess i would need to just a pain in the butt. Link to comment https://forums.phpfreaks.com/topic/175821-how-to-do-once-step-1-complete-move-to-step-2/#findComment-926503 Share on other sites More sharing options...
redarrow Posted September 28, 2009 Share Posted September 28, 2009 any good? They are examples, there only to be used or thort as a way to do something, sorry if there no good but sometimes other programmers would say do it all a different way all again.... page name a.php <?php echo"<a href='b.php?page=a></a>"; if(($_GET['page']=="b.php")||($_GET['page']=="c.php")){ header("location: {$_GET['psgename']}"); } $_SERVER['pagename']=$_SERVER['PHP_SELF']; echo"<a href='b.php?page={$_SESSION['pagename']}></a>"; ?> page name b.php <?php session_start(); if($_GET['page']=="c.php"){ header("location: {$_GET['page']}"); } $_SERVER['pagename']=$_SERVER['PHP_SELF']; echo"<a href='c.php?page={$_SESSION['pagename']}></a>"; ?> page name c.php <?php if($_GET['page']=="c.php"){ header("location: {$_GET['page']}"); } $_SERVER['pagename']=$_SERVER['PHP_SELF']; echo"<a href='b.php?page={$_SESSION['pagename']}></a>"; ?> Link to comment https://forums.phpfreaks.com/topic/175821-how-to-do-once-step-1-complete-move-to-step-2/#findComment-926506 Share on other sites More sharing options...
redarrow Posted September 28, 2009 Share Posted September 28, 2009 you also need to lockup the php function file_get_contents() << can also be used for this task? Link to comment https://forums.phpfreaks.com/topic/175821-how-to-do-once-step-1-complete-move-to-step-2/#findComment-926507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.